Class: Datawow::Connector
- Inherits:
-
Object
- Object
- Datawow::Connector
- Defined in:
- lib/datawow/connector.rb
Overview
:nodoc:
Instance Method Summary collapse
- #delete(data = {}, query_str = true) ⇒ Object
- #get(data = {}, query_str = true) ⇒ Object
-
#initialize(path, type, token: '', version_api: 'v1') ⇒ Connector
constructor
A new instance of Connector.
- #post(data = {}) ⇒ Object
- #put(data = {}) ⇒ Object
Constructor Details
#initialize(path, type, token: '', version_api: 'v1') ⇒ Connector
Returns a new instance of Connector.
13 14 15 16 17 18 19 |
# File 'lib/datawow/connector.rb', line 13 def initialize(path, type, token: '', version_api: 'v1') @version_api = version_api @type = type @path = path @token = token @method = :GET end |
Instance Method Details
#delete(data = {}, query_str = true) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/datawow/connector.rb', line 46 def delete(data = {}, query_str = true) @method = :DELETE response = send_request(data, query_str) body = JSON.parse response.body Response.new(body['data'], response.code, body['meta']['message'], body['meta'], body['meta']['total_count']) end |
#get(data = {}, query_str = true) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/datawow/connector.rb', line 30 def get(data = {}, query_str = true) @method = :GET response = send_request(data, query_str) body = JSON.parse response.body Response.new(body['data'], response.code, body['meta']['message'], body['meta'], body['meta']['total_count']) end |