Class: HipcallSdk::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#adapterObject (readonly)

Returns the value of attribute adapter.



6
7
8
# File 'lib/hipcall/client.rb', line 6

def adapter
  @adapter
end

#api_keyObject (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_urlObject (readonly)

Returns the value of attribute base_url.



6
7
8
# File 'lib/hipcall/client.rb', line 6

def base_url
  @base_url
end

#versionObject (readonly)

Returns the value of attribute version.



6
7
8
# File 'lib/hipcall/client.rb', line 6

def version
  @version
end

Instance Method Details

#callsObject



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

def calls
	CallResource.new(self)
end

#companiesObject



29
30
31
# File 'lib/hipcall/client.rb', line 29

def companies
	CompanyResource.new(self)
end

#connectionObject



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

#contactsObject



33
34
35
# File 'lib/hipcall/client.rb', line 33

def contacts
	ContactResource.new(self)
end

#extensionsObject



37
38
39
# File 'lib/hipcall/client.rb', line 37

def extensions
	ExtensionResource.new(self)
end

#greetingsObject



41
42
43
# File 'lib/hipcall/client.rb', line 41

def greetings
	GreetingResource.new(self)
end

#numbersObject



45
46
47
# File 'lib/hipcall/client.rb', line 45

def numbers
	NumberResource.new(self)
end

#tasksObject



49
50
51
# File 'lib/hipcall/client.rb', line 49

def tasks
	TaskResource.new(self)
end

#teamsObject



53
54
55
# File 'lib/hipcall/client.rb', line 53

def teams
	TeamResource.new(self)
end

#usersObject



57
58
59
# File 'lib/hipcall/client.rb', line 57

def users
	UserResource.new(self)
end