dustinlakin / twitch-rb

Twitch API gem
MIT License
51 stars 28 forks source link

Making read me easier to understand and method calls more intuitive #23

Open TopOneOfTopOne opened 8 years ago

TopOneOfTopOne commented 8 years ago

My apologies @dustinlakin if this is not the right way to discuss about this as you can clearly tell I am a new programmer.

  1. Make read me easier to understand e.g. Add a getting started section for both rails application and normal ruby program. Add more detail to each method call examples.
  2. send access token via header in request.rb rather than in the URL
  3. Make method calls more intuitive by getting rid of the need to specify username e.g. Twitch#follow_channel(username, channel) becomes Twitch#follow_channel(channel). The tests will have to be renamed.

Finally, what are your thoughts on using introspection? This would greatly reduce the code but most of the old code would probably not be used if it were implemented.

dustinlakin commented 8 years ago

Hey @TopOneOfTopOne appreciate all the work you put into this.

  1. I am always up for better documentation if you feel like it needs updating. I agree that the readme isn't spectacular, and while this is a nice little gem that simplifies some of the api work, Twitch's REST API page goes into much more detail about the calls. That still isn't a great excuse to why our documentation should lack though.
  2. This does look similar to the issues seen by @travisdmathis in #21, which I know you also commented on. Have you tried anything with this yet?
  3. I agree this is a better way to do that call.

I am not sure exactly what you mean by introspection, are you saying to look back over the library as a whole for ways to improve it, or expanding on a sort of metaprogramming?

TopOneOfTopOne commented 8 years ago

For my No.2 point, the reason was to refactor code. Rather then having to add ?oauth_token=#{@access_token} each time to the path we could add a single line of code in request.rb e.g. `'Authorization' => "OAuth #{@access_token}" but I don't think there is much point given the code is already written.

I have done some testing for issue #21 and it didn't seem to matter how I passed the access token it always resulted in 500 error in fact even if I did not pass the access token it still resulted in 500 error.

Something like what flickraw is doing https://github.com/hanklords/flickraw obviously my skill is no where near writing that sought of code but I believe I could write something far simpler but still gain the benefits of using introspection. And yes I meant metaprogramming so we do not have to hard code all the requests.