Class: Bandcamp::Band
Instance Attribute Summary collapse
-
#band_id ⇒ Object
readonly
Returns the value of attribute band_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#offsite_url ⇒ Object
readonly
Returns the value of attribute offsite_url.
-
#subdomain ⇒ Object
readonly
Returns the value of attribute subdomain.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #discography ⇒ Object
-
#initialize(band) ⇒ Band
constructor
A new instance of Band.
Methods inherited from Base
Constructor Details
#initialize(band) ⇒ Band
Returns a new instance of Band.
29 30 31 32 33 34 35 |
# File 'lib/bandcamp.rb', line 29 def initialize(band) @name = band['name'] @url = band['url'] @band_id = band['band_id'] @subdomain = band['subdomain'] @offsite_url = band['offsite_url'] end |
Instance Attribute Details
#band_id ⇒ Object (readonly)
Returns the value of attribute band_id.
27 28 29 |
# File 'lib/bandcamp.rb', line 27 def band_id @band_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
27 28 29 |
# File 'lib/bandcamp.rb', line 27 def name @name end |
#offsite_url ⇒ Object (readonly)
Returns the value of attribute offsite_url.
27 28 29 |
# File 'lib/bandcamp.rb', line 27 def offsite_url @offsite_url end |
#subdomain ⇒ Object (readonly)
Returns the value of attribute subdomain.
27 28 29 |
# File 'lib/bandcamp.rb', line 27 def subdomain @subdomain end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
27 28 29 |
# File 'lib/bandcamp.rb', line 27 def url @url end |
Class Method Details
.find(name) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/bandcamp.rb', line 43 def find(name) response = get("/band/3/search", :query => { :key => Bandcamp::Base.api_key, :name => name }) if response && response['results'] response['results'].map { |band| new(band) } else response end end |
.load(*band_ids) ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bandcamp.rb', line 52 def load(*band_ids) response = get("/band/3/info", :query => { :key => Bandcamp::Base.api_key, :band_id => band_ids.join(",") }) if band_ids.length > 1 band_ids.map { |band_id| new(response[band_id.to_s]) } else new(response) if response end end |