Class: SocialstatsSDK::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/socialstats_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
# File 'lib/socialstats_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)
  @creators = Resources::Creators.new(@http)
  @posts = Resources::Posts.new(@http)
end

Instance Attribute Details

#creatorsObject (readonly)

Returns the value of attribute creators.



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

def creators
  @creators
end

#infoObject (readonly)

Returns the value of attribute info.



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

def info
  @info
end

#postsObject (readonly)

Returns the value of attribute posts.



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

def posts
  @posts
end

Instance Method Details

#closeObject



23
24
25
# File 'lib/socialstats_sdk/client.rb', line 23

def close
  @http.close
end