Class: Contactually::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/contactually/interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_token: nil, api_key: nil, base_url: nil) ⇒ Interface

Returns a new instance of Interface.



5
6
7
8
9
10
# File 'lib/contactually/interface.rb', line 5

def initialize(auth_token: nil, api_key: nil, base_url: nil)
  @auth_token = auth_token
  @api_key = api_key
  @adapter = Contactually.configuration.adapter || :net_http
  @base_url = base_url
end

Instance Attribute Details

#adapterObject (readonly)

Returns the value of attribute adapter.



3
4
5
# File 'lib/contactually/interface.rb', line 3

def adapter
  @adapter
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



3
4
5
# File 'lib/contactually/interface.rb', line 3

def api_key
  @api_key
end

#auth_tokenObject (readonly)

Returns the value of attribute auth_token.



3
4
5
# File 'lib/contactually/interface.rb', line 3

def auth_token
  @auth_token
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



3
4
5
# File 'lib/contactually/interface.rb', line 3

def base_url
  @base_url
end

#connectionObject (readonly)

Returns the value of attribute connection.



3
4
5
# File 'lib/contactually/interface.rb', line 3

def connection
  @connection
end

#headersObject (readonly)

Returns the value of attribute headers.



3
4
5
# File 'lib/contactually/interface.rb', line 3

def headers
  @headers
end

Instance Method Details

#destroy(url) ⇒ Object



24
25
26
# File 'lib/contactually/interface.rb', line 24

def destroy(url)
  connection.delete(build_full_url(url))
end

#get(url, params) ⇒ Object



12
13
14
# File 'lib/contactually/interface.rb', line 12

def get(url, params)
  connection.get(build_full_url(url), params)
end

#patch(url, body) ⇒ Object



16
17
18
# File 'lib/contactually/interface.rb', line 16

def patch(url, body)
  connection.patch(build_full_url(url), body)
end

#post(url, body) ⇒ Object



20
21
22
# File 'lib/contactually/interface.rb', line 20

def post(url, body)
  connection.post(build_full_url(url), body)
end