Class: LastFM::Venue

Inherits:
Struct
  • Object
show all
Defined in:
lib/lastfm/venue.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

from_xml, inherited, #initialize, package, #to_json

Constructor Details

This class inherits a constructor from LastFM::Struct

Instance Attribute Details

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id


2
3
4
# File 'lib/lastfm/venue.rb', line 2

def id
  @id
end

#imagesObject

Returns the value of attribute images

Returns:

  • (Object)

    the current value of images


2
3
4
# File 'lib/lastfm/venue.rb', line 2

def images
  @images
end

#locationObject

Returns the value of attribute location

Returns:

  • (Object)

    the current value of location


2
3
4
# File 'lib/lastfm/venue.rb', line 2

def location
  @location
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name


2
3
4
# File 'lib/lastfm/venue.rb', line 2

def name
  @name
end

#phone_numberObject

Returns the value of attribute phone_number

Returns:

  • (Object)

    the current value of phone_number


2
3
4
# File 'lib/lastfm/venue.rb', line 2

def phone_number
  @phone_number
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url


2
3
4
# File 'lib/lastfm/venue.rb', line 2

def url
  @url
end

#websiteObject

Returns the value of attribute website

Returns:

  • (Object)

    the current value of website


2
3
4
# File 'lib/lastfm/venue.rb', line 2

def website
  @website
end

Class Method Details

.get_events(params) ⇒ Object

Get a list of upcoming events for a venue.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :venue (Fixnum, required)

    the id for the venue to fetch event listings for

  • :festivalsonly (Boolean, optional)

    whether only festivals should be returned, or all events

See Also:


32
33
34
# File 'lib/lastfm/venue.rb', line 32

def get_events( params )
  LastFM.get( "venue.getEvents", params )
end

.get_past_events(params) ⇒ Object

Get a paginated list of all the events held at this venue in the past.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :venue (Fixnum, required)

    the id for the venue to fetch event listings for

  • :festivalsonly (Boolean, optional)

    whether only festivals should be returned, or all events

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:


43
44
45
# File 'lib/lastfm/venue.rb', line 43

def get_past_events( params )
  LastFM.get( "venue.getPastEvents", params )
end

.search(params) ⇒ Object

Search for a venue by venue name.

Parameters:

  • params (Hash)

    a customizable set of options

Options Hash (params):

  • :venue (String, required)

    the venue name to search for

  • :country (String, optional)

    a country name used to limit results, as defined by ISO 3166-1

  • :page (Fixnum, optional)

    the page number to fetch. defaults to first page

  • :limit (Fixnum, optional)

    the number of results to fetch per page. defaults to 50

See Also:


54
55
56
# File 'lib/lastfm/venue.rb', line 54

def search( params )
  LastFM.get( "venue.search", params )
end

Instance Method Details

#update_from_node(node) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lastfm/venue.rb', line 4

def update_from_node(node)
  case node.name.to_sym
    when :id
      self.id = node.content.to_i
    when :name
      self.name = node.content
    when :location
      # ??? city, country, street, postalcode, geo:lat, geo:long
    when :url
      self.url = node.content
    when :website
      self.website = node.content
    when :phoneNumber
      self.phone_number = node.content
    when :image
      self.images ||= {}
      self.images.merge!({node['size'].to_sym => node.content})
  end
end