Class: Multiapi::Client
- Inherits:
-
Object
- Object
- Multiapi::Client
- Defined in:
- lib/multiapi/client.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
- #delete(path, params = {}) ⇒ Object
- #get(path, params = {}) ⇒ Object
-
#initialize(api_key:, base_url: 'https://api.multiapi.com') ⇒ Client
constructor
A new instance of Client.
- #post(path, body = {}) ⇒ Object
- #put(path, body = {}) ⇒ Object
- #transactions ⇒ Object
- #users ⇒ Object
Constructor Details
#initialize(api_key:, base_url: 'https://api.multiapi.com') ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 |
# File 'lib/multiapi/client.rb', line 11 def initialize(api_key:, base_url: 'https://api.multiapi.com') @api_key = api_key @base_url = base_url @connection = create_connection end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/multiapi/client.rb', line 9 def api_key @api_key end |
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
9 10 11 |
# File 'lib/multiapi/client.rb', line 9 def base_url @base_url end |
Instance Method Details
#delete(path, params = {}) ⇒ Object
37 38 39 |
# File 'lib/multiapi/client.rb', line 37 def delete(path, params = {}) handle_response(@connection.delete(path, params)) end |
#get(path, params = {}) ⇒ Object
25 26 27 |
# File 'lib/multiapi/client.rb', line 25 def get(path, params = {}) handle_response(@connection.get(path, params)) end |
#post(path, body = {}) ⇒ Object
29 30 31 |
# File 'lib/multiapi/client.rb', line 29 def post(path, body = {}) handle_response(@connection.post(path, body.to_json)) end |
#put(path, body = {}) ⇒ Object
33 34 35 |
# File 'lib/multiapi/client.rb', line 33 def put(path, body = {}) handle_response(@connection.put(path, body.to_json)) end |
#transactions ⇒ Object
21 22 23 |
# File 'lib/multiapi/client.rb', line 21 def transactions @transactions ||= Resources::Transaction.new(self) end |