Class: HipcallSdk::Client
- Inherits:
-
Object
- Object
- HipcallSdk::Client
- Defined in:
- lib/hipcall/client.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #calls ⇒ Object
- #companies ⇒ Object
- #connection ⇒ Object
- #contacts ⇒ Object
- #extensions ⇒ Object
- #greetings ⇒ Object
-
#initialize(api_key:, version: "v3", base_url: "https://use.hipcall.com/api/", adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
constructor
A new instance of Client.
- #numbers ⇒ Object
- #tasks ⇒ Object
- #teams ⇒ Object
- #users ⇒ Object
Constructor Details
#initialize(api_key:, version: "v3", base_url: "https://use.hipcall.com/api/", adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 |
# File 'lib/hipcall/client.rb', line 8 def initialize(api_key:, version: "v3", base_url: "https://use.hipcall.com/api/", adapter: Faraday.default_adapter, stubs: nil) @api_key = api_key @version = version @base_url = base_url @adapter = adapter @stubs = stubs end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/hipcall/client.rb', line 6 def adapter @adapter end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/hipcall/client.rb', line 6 def api_key @api_key end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/hipcall/client.rb', line 6 def base_url @base_url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/hipcall/client.rb', line 6 def version @version end |
Instance Method Details
#calls ⇒ Object
25 26 27 |
# File 'lib/hipcall/client.rb', line 25 def calls CallResource.new(self) end |
#companies ⇒ Object
29 30 31 |
# File 'lib/hipcall/client.rb', line 29 def companies CompanyResource.new(self) end |
#connection ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/hipcall/client.rb', line 16 def connection @connection ||= Faraday.new (base_url + version) do |connection| connection.request :authorization, :Bearer, api_key connection.request :json, :accept => 'application/json' connection.response :json, content_type: "application/json" connection.adapter adapter, @stubs end end |
#contacts ⇒ Object
33 34 35 |
# File 'lib/hipcall/client.rb', line 33 def contacts ContactResource.new(self) end |
#extensions ⇒ Object
37 38 39 |
# File 'lib/hipcall/client.rb', line 37 def extensions ExtensionResource.new(self) end |
#greetings ⇒ Object
41 42 43 |
# File 'lib/hipcall/client.rb', line 41 def greetings GreetingResource.new(self) end |
#numbers ⇒ Object
45 46 47 |
# File 'lib/hipcall/client.rb', line 45 def numbers NumberResource.new(self) end |
#tasks ⇒ Object
49 50 51 |
# File 'lib/hipcall/client.rb', line 49 def tasks TaskResource.new(self) end |
#teams ⇒ Object
53 54 55 |
# File 'lib/hipcall/client.rb', line 53 def teams TeamResource.new(self) end |
#users ⇒ Object
57 58 59 |
# File 'lib/hipcall/client.rb', line 57 def users UserResource.new(self) end |