Class: SongstatsSDK::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, base_url: HTTPClient::DEFAULT_BASE_URL, timeout: HTTPClient::DEFAULT_TIMEOUT_SECONDS, max_retries: 2, http_adapter: nil, user_agent: nil) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/songstats_sdk/client.rb', line 7

def initialize(api_key:, base_url: HTTPClient::DEFAULT_BASE_URL, timeout: HTTPClient::DEFAULT_TIMEOUT_SECONDS,
  max_retries: 2, http_adapter: nil, user_agent: nil)
  @http = HTTPClient.new(
    api_key: api_key,
    base_url: base_url,
    timeout: timeout,
    max_retries: max_retries,
    adapter: http_adapter,
    user_agent: user_agent
  )

  @info = Resources::Info.new(@http)
  @tracks = Resources::Tracks.new(@http)
  @artists = Resources::Artists.new(@http)
  @collaborators = Resources::Collaborators.new(@http)
  @labels = Resources::Labels.new(@http)
end

Instance Attribute Details

#artistsObject (readonly)

Returns the value of attribute artists.



5
6
7
# File 'lib/songstats_sdk/client.rb', line 5

def artists
  @artists
end

#collaboratorsObject (readonly)

Returns the value of attribute collaborators.



5
6
7
# File 'lib/songstats_sdk/client.rb', line 5

def collaborators
  @collaborators
end

#infoObject (readonly)

Returns the value of attribute info.



5
6
7
# File 'lib/songstats_sdk/client.rb', line 5

def info
  @info
end

#labelsObject (readonly)

Returns the value of attribute labels.



5
6
7
# File 'lib/songstats_sdk/client.rb', line 5

def labels
  @labels
end

#tracksObject (readonly)

Returns the value of attribute tracks.



5
6
7
# File 'lib/songstats_sdk/client.rb', line 5

def tracks
  @tracks
end

Instance Method Details

#closeObject



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

def close
  @http.close
end