Class: Discogs::Wrapper
- Inherits:
-
Object
- Object
- Discogs::Wrapper
- Defined in:
- lib/wrapper/wrapper.rb
Constant Summary collapse
- @@root_host =
"http://www.discogs.com"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
- #get_artist(name) ⇒ Object
- #get_label(name) ⇒ Object
- #get_release(id) ⇒ Object
-
#initialize(api_key = nil) ⇒ Wrapper
constructor
A new instance of Wrapper.
- #search(term, type = :all) ⇒ Object
Constructor Details
#initialize(api_key = nil) ⇒ Wrapper
Returns a new instance of Wrapper.
17 18 19 |
# File 'lib/wrapper/wrapper.rb', line 17 def initialize(api_key=nil) @api_key = api_key end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
15 16 17 |
# File 'lib/wrapper/wrapper.rb', line 15 def api_key @api_key end |
Instance Method Details
#get_artist(name) ⇒ Object
25 26 27 |
# File 'lib/wrapper/wrapper.rb', line 25 def get_artist(name) query_and_build "artist/#{name}", Discogs::Artist end |
#get_label(name) ⇒ Object
29 30 31 |
# File 'lib/wrapper/wrapper.rb', line 29 def get_label(name) query_and_build "label/#{name}", Discogs::Label end |
#get_release(id) ⇒ Object
21 22 23 |
# File 'lib/wrapper/wrapper.rb', line 21 def get_release(id) query_and_build "release/#{id}", Discogs::Release end |
#search(term, type = :all) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/wrapper/wrapper.rb', line 33 def search(term, type=:all) params = { :q => term, :type => type } data = query_api("search", params) resource = Discogs::Search.new(data) resource.build_with_resp! end |