Class: MusicBrainz::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty, Hashie
Defined in:
lib/musicbrainz/client.rb

Constant Summary collapse

DEFAULT_USER_AGENT =
"musicbrainz-ruby gem #{MusicBrainz::VERSION}"

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Provide your username and password to make authenticated calls



14
15
16
17
18
19
20
21
22
23
# File 'lib/musicbrainz/client.rb', line 14

def initialize(options = {})
  if options[:username] and options[:password]
    self.class.digest_auth options[:username], options[:password]
  end
  if options[:'User-Agent']
    self.class.headers 'User-Agent' => options[:'User-Agent']
  else
    self.class.headers 'User-Agent' => DEFAULT_USER_AGENT
  end
end

Instance Method Details

#artist(params = {}) ⇒ Object



25
26
27
# File 'lib/musicbrainz/client.rb', line 25

def artist(params = {})
  request('artist', params)
end

#collection(params = {}) ⇒ Object



61
62
63
# File 'lib/musicbrainz/client.rb', line 61

def collection(params = {})
  request('collection', params)
end

#discid(params = {}) ⇒ Object



65
66
67
# File 'lib/musicbrainz/client.rb', line 65

def discid(params = {})
  request('discid', params)
end

#isrc(params = {}) ⇒ Object



73
74
75
# File 'lib/musicbrainz/client.rb', line 73

def isrc(params = {})
  request('isrc', params)
end

#iswc(params = {}) ⇒ Object



77
78
79
# File 'lib/musicbrainz/client.rb', line 77

def iswc(params = {})
  request('iswc', params)
end

#label(params = {}) ⇒ Object



29
30
31
# File 'lib/musicbrainz/client.rb', line 29

def label(params = {})
  request('label', params)
end

#puid(params = {}) ⇒ Object



69
70
71
# File 'lib/musicbrainz/client.rb', line 69

def puid(params = {})
  request('puid', params)
end

#rating(params = {}) ⇒ Object



53
54
55
# File 'lib/musicbrainz/client.rb', line 53

def rating(params = {})
  request('rating', params)
end

#recording(params = {}) ⇒ Object



33
34
35
# File 'lib/musicbrainz/client.rb', line 33

def recording(params = {})
  request('recording', params)
end

#release(params = {}) ⇒ Object



45
46
47
# File 'lib/musicbrainz/client.rb', line 45

def release(params = {})
  request('release', params)
end

#release_group(params = {}) ⇒ Object



37
38
39
# File 'lib/musicbrainz/client.rb', line 37

def release_group(params = {})
  request('release-group', params)
end

#tag(params = {}) ⇒ Object



57
58
59
# File 'lib/musicbrainz/client.rb', line 57

def tag(params = {})
  request('tag', params)
end

#work(params = {}) ⇒ Object



41
42
43
# File 'lib/musicbrainz/client.rb', line 41

def work(params = {})
  request('work', params)
end