Class: Rockstar::Venue
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#events ⇒ Object
Returns the value of attribute events.
-
#images ⇒ Object
Returns the value of attribute images.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#long ⇒ Object
Returns the value of attribute long.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phonenumber ⇒ Object
Returns the value of attribute phonenumber.
-
#postalcode ⇒ Object
Returns the value of attribute postalcode.
-
#street ⇒ Object
Returns the value of attribute street.
-
#url ⇒ Object
Returns the value of attribute url.
-
#vid ⇒ Object
Returns the value of attribute vid.
-
#website ⇒ Object
Returns the value of attribute website.
Class Method Summary collapse
Instance Method Summary collapse
- #image(which = :medium) ⇒ Object
-
#initialize(id, name) ⇒ Venue
constructor
A new instance of Venue.
Methods inherited from Base
connection, fetch_and_parse, get_instance
Constructor Details
#initialize(id, name) ⇒ Venue
Returns a new instance of Venue.
33 34 35 36 37 38 |
# File 'lib/rockstar/venue.rb', line 33 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 |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def country @country end |
#events ⇒ Object
Returns the value of attribute events.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def events @events end |
#images ⇒ Object
Returns the value of attribute images.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def images @images end |
#lat ⇒ Object
Returns the value of attribute lat.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def lat @lat end |
#long ⇒ Object
Returns the value of attribute long.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def long @long end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def name @name end |
#phonenumber ⇒ Object
Returns the value of attribute phonenumber.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def phonenumber @phonenumber end |
#postalcode ⇒ Object
Returns the value of attribute postalcode.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def postalcode @postalcode end |
#street ⇒ Object
Returns the value of attribute street.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def street @street end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def url @url end |
#vid ⇒ Object
Returns the value of attribute vid.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def vid @vid end |
#website ⇒ Object
Returns the value of attribute website.
4 5 6 |
# File 'lib/rockstar/venue.rb', line 4 def website @website end |
Class Method Details
.find(name, country = nil, limit = nil, page = nil) ⇒ Object
49 50 51 |
# File 'lib/rockstar/venue.rb', line 49 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 |
.new_from_xml(xml, doc) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rockstar/venue.rb', line 8 def new_from_xml(xml, doc) v = Venue.new( (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 v.street = xml.search("/location/street").inner_html.strip v.postalcode = xml.search("/location/postalcode").inner_html.strip v.lat = xml.search("geo:lat").inner_html.strip v.long = xml.search("geo:long").inner_html.strip v.url = xml.search("/url").inner_html.strip v.website = xml.search("/website").inner_html.strip v.phonenumber= xml.search("/phonenumber").inner_html.strip v.images = {} xml.search('/image').each {|image| v.images[image['size']] = image.inner_html if v.images[image['size']].nil? } v end |
Instance Method Details
#image(which = :medium) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/rockstar/venue.rb', line 40 def image(which=:medium) which = which.to_s raise ArgumentError unless ['small', 'medium', 'large', 'extralarge', 'mega'].include?(which) if (self.images.nil?) load_info end self.images[which] end |