Class: Contactually::Interface
- Inherits:
-
Object
- Object
- Contactually::Interface
- Defined in:
- lib/contactually/interface.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.
-
#auth_token ⇒ Object
readonly
Returns the value of attribute auth_token.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
- #destroy(url) ⇒ Object
- #get(url, params) ⇒ Object
-
#initialize(auth_token: nil, api_key: nil, base_url: nil) ⇒ Interface
constructor
A new instance of Interface.
- #patch(url, body) ⇒ Object
- #post(url, body) ⇒ Object
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
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
3 4 5 |
# File 'lib/contactually/interface.rb', line 3 def adapter @adapter end |
#api_key ⇒ Object (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_token ⇒ Object (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_url ⇒ Object (readonly)
Returns the value of attribute base_url.
3 4 5 |
# File 'lib/contactually/interface.rb', line 3 def base_url @base_url end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/contactually/interface.rb', line 3 def connection @connection end |
#headers ⇒ Object (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 |