lib/firstfm/geo.rb in firstfm-0.4.1 vs lib/firstfm/geo.rb in firstfm-0.5.0
- old
+ new
@@ -11,11 +11,11 @@
lat = params.delete(:lat)
lng = params.delete(:lng)
page = params.delete(:page) || 1
distance = params.delete(:distance)
- response = get("/2.0/", {:query => {:method => 'geo.getevents', :location => location, :page => page, :lat => lat, :lng => lng, :distance => distance, :api_key => Firstfm::CONFIG['api_key']}})
+ response = get("/2.0/", {:query => {:method => 'geo.getevents', :location => location, :page => page, :lat => lat, :lng => lng, :distance => distance, :api_key => Firstfm.config.api_key}})
events = response && response['lfm'] ? Event.init_events_from_hash(response['lfm']) : []
collection = WillPaginate::Collection.create(page, 10) do |pager|
pager.replace events
pager.total_entries = response['lfm']['events']['total'].to_i
@@ -31,11 +31,11 @@
response = get("/2.0/", {:query => {
:method => 'geo.gettopartists',
:country => country,
:page => page,
:limit => limit,
- :api_key => Firstfm::CONFIG['api_key']
+ :api_key => Firstfm.config.api_key
}})
artists_array = (response and response['lfm'] and response['lfm']['topartists'] and response['lfm']['topartists']['artist']) || []
artists = Artist.init_from_array(artists_array)
WillPaginate::Collection.create(page, limit) do |pager|
@@ -70,10 +70,10 @@
:metro => metro,
:start => start_timestamp,
:end => end_timestamp,
:page => page,
:limit => limit,
- :api_key => Firstfm::CONFIG['api_key'] }.reject {|k,v| v.nil?}
+ :api_key => Firstfm.config.api_key }.reject {|k,v| v.nil?}
})
artists_array = (response and response['lfm'] and response['lfm']['topartists'] and response['lfm']['topartists']['artist']) || []
artists = Artist.init_from_array(artists_array)
WillPaginate::Collection.create(page, limit) do |pager|
\ No newline at end of file