class Gracenote::Client

Attributes

client_id[R]
country[RW]
lang[RW]
user_id[R]

Public Class Methods

new(client_id:, user_id: nil, lang: nil, country: nil) click to toggle source
# File lib/gracenote/client.rb, line 20
def initialize(client_id:, user_id: nil, lang: nil, country: nil)
  @client_id = client_id
  @user_id = user_id
  @lang = lang || "eng"
  @country = country || "usa"
end

Public Instance Methods

auth() click to toggle source
# File lib/gracenote/client.rb, line 31
def auth
  raise "user_id is empty" unless user_id
  { client: client_id, user: user_id }
end
query(cmd, options = {}, &block) click to toggle source
# File lib/gracenote/client.rb, line 36
def query(cmd, options = {}, &block)
  request = build_query(cmd, options, &block).to_xml
  response = post(request)
  Response.new(response)
end
short_client_id() click to toggle source
# File lib/gracenote/client.rb, line 27
def short_client_id
  client_id.split("-", 2)[0]
end