lib/rockstar/venue.rb in rockstar-0.6.3 vs lib/rockstar/venue.rb in rockstar-0.6.4
- old
+ new
@@ -1,15 +1,15 @@
module Rockstar
class Venue < Base
-
+
attr_accessor :vid, :name, :city, :country, :street, :postalcode, :lat, :long, :url,
:website, :phonenumber, :images, :events
class << self
def new_from_xml(xml, doc)
v = Venue.new(
- (xml).at(:id).inner_html,
+ (xml).at(:id).inner_html,
(xml).at(:name).inner_html
)
v.city = xml.search("/location/city").inner_html.strip
v.country = xml.search("/location/country").inner_html.strip
@@ -26,31 +26,31 @@
v.images[image['size']] = image.inner_html if v.images[image['size']].nil?
}
v
end
+
+ def find(name, country = nil, limit = nil, page = nil)
+ get_instance("venue.search", :venues, :venue, {:venue => name, :country => country, :limit => limit, :page => page})
+ end
end
-
+
def initialize(id, name)
raise ArgumentError, "ID is required" if id.blank?
raise ArgumentError, "Name is required" if name.blank?
@vid = id
@name = name
end
-
+
def image(which=:medium)
which = which.to_s
- raise ArgumentError unless ['small', 'medium', 'large', 'extralarge', 'mega'].include?(which)
+ raise ArgumentError unless ['small', 'medium', 'large', 'extralarge', 'mega'].include?(which)
if (self.images.nil?)
load_info
- end
+ end
self.images[which]
end
-
- def self.find(name, country = nil, limit = nil, page = nil)
- get_instance("venue.search", :venues, :venue, {:venue => name, :country => country, :limit => limit, :page => page})
- end
-
+
def events
@events ||= get_instance("venue.getEvents", :events, :event, {:venue => vid})
end
end
end