class Firstfm::Venue

Attributes

id[RW]
images[RW]
location[RW]
name[RW]
phonenumber[RW]
url[RW]
website[RW]

Public Class Methods

get_events(venue_id) click to toggle source
# File lib/firstfm/venue.rb, line 20
def self.get_events(venue_id)
  response = get("/2.0/", {:query => {:method => 'venue.getEvents', :venue => venue_id, :api_key => Firstfm.config.api_key, :format => :json}})
  events = response['events'] && response['events']['event'] ? Event.init_events_from_hash(response) : []
end
init_venue_from_hash(hash) click to toggle source
# File lib/firstfm/venue.rb, line 38
def self.init_venue_from_hash(hash)
  venue = Venue.new
  venue.id          = hash["id"]
  venue.name        = hash["name"]
  venue.url         = hash["url"]
  venue.location    = Location.init_location_from_hash(hash["location"])
  venue.website     = hash["website"]
  venue.phonenumber = hash["phonenumber"]
  venue.images = hash["image"]
  venue
end
init_venues_from_hash(hash) click to toggle source
# File lib/firstfm/venue.rb, line 29
def self.init_venues_from_hash(hash)
  return [] unless hash["results"] && hash["results"]["venuematches"] && hash["results"]["venuematches"]["venue"]
  return [init_venue_from_hash(hash["results"]["venuematches"]["venue"])] if hash["results"]["venuematches"]["venue"].is_a?(Hash)
  hash["results"]["venuematches"]["venue"].inject([]) do |arr, venue_hash|
    arr << init_venue_from_hash(venue_hash)
    arr
  end
end

Public Instance Methods

get_events() click to toggle source
# File lib/firstfm/venue.rb, line 25
def get_events
  self.class.get_events(self.id)
end