Class: FDDB::API

Inherits:
Object
  • Object
show all
Defined in:
lib/fddb.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key, lang = 'de', format = :json) ⇒ API

Returns a new instance of API.



11
12
13
14
15
16
# File 'lib/fddb.rb', line 11

def initialize (api_key, lang = 'de', format= :json)
  @api_key = api_key
  @lang = lang
  @base_url = 'http://fddb.info/api/v8'
  @format  =  format
end

Instance Method Details

#get_item(query) ⇒ Object



18
19
20
21
# File 'lib/fddb.rb', line 18

def get_item (query)
  response = make_http_request :item, query
  FDDB::Item.new response
end

#search(query) ⇒ Object



23
24
25
26
# File 'lib/fddb.rb', line 23

def search (query)
  response = make_http_request :search, query
  FDDB::Items.new response
end