Fixes
This commit is contained in:
parent
f0f1730fc3
commit
08a5673933
|
@ -28,14 +28,14 @@ Robbie.setup(api_key: "your api key", api_secret: "your api secret")
|
|||
|
||||
foo = Robbie::Artist.find_by_name("foo fighters")
|
||||
# <Robbie::Artist:0x007fb9cbd7c120
|
||||
# @id="MA0000002613",
|
||||
# @id="MN0000184043",
|
||||
# @name="Foo Fighters",
|
||||
# @is_group=true,
|
||||
# @genres=[#<Robbie::Genre:0x007fb9cbd7c2b0 @id="MA0000002613", @name="Pop/Rock">]
|
||||
# >
|
||||
|
||||
# ...or directly by id
|
||||
foo = Robbie::Artist.find("MA0000002613")
|
||||
foo = Robbie::Artist.find("MN0000184043")
|
||||
|
||||
foo.albums.last
|
||||
# <Robbie::Album:0x007fb9cc16b790 @id="MW0002115022", @title="Wasting Light">
|
||||
|
|
|
@ -18,6 +18,7 @@ require "robbie/autocomplete"
|
|||
|
||||
module Robbie
|
||||
@@cache_enabled = false
|
||||
|
||||
class << self
|
||||
def setup(params)
|
||||
const_set(:API_KEY, params[:api_key])
|
||||
|
|
|
@ -6,6 +6,10 @@ module Robbie
|
|||
def search(q)
|
||||
Parsers::Search.search(q).keep_if{ |item| item.instance_of?(Robbie::Album) }
|
||||
end
|
||||
|
||||
def find(id)
|
||||
Parsers::Album.find(id)
|
||||
end
|
||||
end
|
||||
|
||||
def tracks
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
module Robbie
|
||||
class BaseModel
|
||||
def initialize(values)
|
||||
values.each do |key, val|
|
||||
send(:"#{key}=", val)
|
||||
end
|
||||
values.each{ |key, val| send(:"#{key}=", val) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
module Robbie
|
||||
class Track < BaseModel
|
||||
attr_accessor :id, :disc_id, :position, :artists, :title, :duration
|
||||
|
||||
class << self
|
||||
def find(id)
|
||||
Parsers::Track.find(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue