coderhs / ruby_open_weather_map

A ruby wrapper for open weather map
MIT License
79 stars 52 forks source link

get current weather info by city, city id or latitude and longitude #3

Closed deepakkumarnd closed 10 years ago

deepakkumarnd commented 11 years ago

will write more tests for edge cases and update readme one I mock the requests. Otherwise the tests are going to consume more time waiting for the actual response from the server.

coderhs commented 11 years ago

I was thinking of Going for a more Ruby Style API, we are using Ruby, So why use the regular method. So rather than building one function that fetches via City, City id or Lal or Lon.

Else it would be like we just wrote wrapper for the HTTParty class.

So the User just needs to write functions likes : OpenWeather::Current.city(''Cochin,In") and he gets the current weather of the city Cochin.

I have pushed the code tat i meant to current_weather_dev branch current_weather.rb

Also I was thinking of making the output into a Mash? what do you think?

deepakkumarnd commented 11 years ago

OpenWeather::Current.city(''Cochin,In") This method sounds good but this is not object oriented way to model this problem. I was thinking an API as an object which can fetch info from server with a cache for storing the result. If u actually send the request from a browser you can see the end point accepts any combination of options so we should allow the same with options.

coderhs commented 11 years ago

Indeed the usage OpenWeather::Current.city(''Cochin,In") is not object oriented, but its self documenting and clearer.

Maybe we can provide both, an abstraction and wrapper style.

http://wynnnetherland.com/journal/what-makes-a-good-api-wrapper

deepakkumarnd commented 11 years ago

hmm agree to that

coderhs commented 11 years ago

I will merge your code, then create my function to use your private function.

How about it?I will do it today evening.

And which, we can start on the next part of the API. Getting Forecasting Weather Data. Also I am still not that good with TDD, let me write the test for that part, making use of the ones you wrote for Current Data as a guide. :)

deepakkumarnd commented 11 years ago

ok that is great, we should strictly follow TDD then only it will be a accepted by community

coderhs commented 11 years ago

+1

deepakkumarnd commented 11 years ago

ping ping

coderhs commented 11 years ago

Will start working on it again this weekend :-D