Sha256: ec044eafb0be0a387ac9d59eaacc9877080f0c069b55ee426ca790a87dd56d66
Contents?: true
Size: 859 Bytes
Versions: 9
Compression:
Stored size: 859 Bytes
Contents
module Firstfm class Geo include HTTParty base_uri 'ws.audioscrobbler.com' format :xml def self.get_events(params = {}) location = params.delete(:location) 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']}}) 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 end end end end
Version data entries
9 entries across 9 versions & 1 rubygems