Class: Songlink

Inherits:
Object
  • Object
show all
Includes:
Request, Version
Defined in:
lib/songlink.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Request

base_url, #http

Methods included from Version

api_version, version

Constructor Details

#initialize(api_key = ENV['SONGLINK_API_KEY']) ⇒ Songlink



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

def initialize(api_key = ENV['SONGLINK_API_KEY'])
  @version = Version.version
  @api_version = Version.api_version
  @api_key = api_key
  @url = Request.base_url
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



9
10
11
# File 'lib/songlink.rb', line 9

def api_key
  @api_key
end

#api_versionObject

Returns the value of attribute api_version.



9
10
11
# File 'lib/songlink.rb', line 9

def api_version
  @api_version
end

#urlObject

Returns the value of attribute url.



9
10
11
# File 'lib/songlink.rb', line 9

def url
  @url
end

#versionObject

Returns the value of attribute version.



9
10
11
# File 'lib/songlink.rb', line 9

def version
  @version
end

Instance Method Details

#request(params = {}) ⇒ Object



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

def request(params = {})
  http.get("/#{api_version}/links", _params(params))
end