pilha icon indicating copy to clipboard operation
pilha copied to clipboard

No support for other Stackexchange sites

Open jrgifford opened this issue 14 years ago • 6 comments

There is no support for any of the other Stackexchange network sites.

How should this be added? Replicate the StackOverflow parts, just re-name it to the appropriate SE site name, or do something else? I'm open to working on this.

jrgifford avatar Sep 13 '11 14:09 jrgifford

Hi, James. Sorry for the belayed answer.

I think it would be better to avoid duplication and reuse most parts of the gem, like the Client and the Base class. If we just rename the classes we'll have lots of duplication. What do you think of it?

I'm also open to other implementation strategies.

dlt avatar Sep 15 '11 13:09 dlt

Well, maybe I'm thinking this through the wrong way.

Perhaps what it should be is you have the stackexchange class, and the site class - have all API methods defined once in the stackexchange class, and then have a master class that accepts different API endpoints - so api.stackoverflow.com would work, as would api.<new-stackexchange-site-that-isn't-in-existence-yet>.com, if that makes sense.

jrgifford avatar Sep 15 '11 15:09 jrgifford

I think that It makes sense. Can you build a prototype so that we can work on this together?

dlt avatar Sep 15 '11 16:09 dlt

Not sure how I'd go about starting something like this - I'm fairly new to Ruby and programming in general. :P

jrgifford avatar Sep 16 '11 21:09 jrgifford

If I understand this issue correctly, you're looking for a way to query other SE sites?

The default URL is set to http://api.stackoverflow.com but it's possible to change this in the config block, where you also set your API key.

StackExchange::StackOverflow::Client.config do |options|
  options.url = 'http://api.gaming.stackexchange.com'
end

example

I guess the other issue here is how everything is nested underneath a module of StackOverflow, which is pretty confusing in itself as the gem isn't SO-specific. (Also, changing the targeted API URL should probably be in the readme)

thomas-mcdonald avatar Sep 21 '11 17:09 thomas-mcdonald

I agree with you, @thomas-mcdonald. The Client class (and maybe some others) shouldn't be nested in the StackOverflow module. I haven't had the time to take a deep look into this issue yet, and I think that a good way to start the feature requested by @jrgifford would be to refactor the Client class to be more "site-agnostic". I also think that the remaining "model" classes should extend the same Base (also "site-agnostic") class.

dlt avatar Sep 21 '11 20:09 dlt