Class: Arkaan::Decorators::Gateway
- Inherits:
-
Draper::Decorator
- Object
- Draper::Decorator
- Arkaan::Decorators::Gateway
- Defined in:
- lib/arkaan/decorators/gateway.rb
Overview
Decorator for a service, providing methods to make requests on it.
Instance Attribute Summary collapse
-
#action ⇒ String
The action of the route using this API.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#delete(session:, url:, params:) ⇒ Object
Shortcut to make a DELETE request on the API.
-
#get(session:, url:, params:) ⇒ Object
Shortcut to make a GET request on the API.
-
#initialize(action, _object) ⇒ Gateway
constructor
A new instance of Gateway.
-
#post(session:, url:, params:) ⇒ Object
Shortcut to make a POST request on the API.
-
#put(session:, url:, params:) ⇒ Object
Shortcut to make a PUT request on the API.
Constructor Details
#initialize(action, _object) ⇒ Gateway
Returns a new instance of Gateway.
14 15 16 17 18 |
# File 'lib/arkaan/decorators/gateway.rb', line 14 def initialize(action, _object) super(_object) @logger = Logger.new(STDOUT) @action = action end |
Instance Attribute Details
#action ⇒ String
Returns the action of the route using this API.
10 11 12 |
# File 'lib/arkaan/decorators/gateway.rb', line 10 def action @action end |
#logger ⇒ Object
Returns the value of attribute logger.
12 13 14 |
# File 'lib/arkaan/decorators/gateway.rb', line 12 def logger @logger end |
Instance Method Details
#delete(session:, url:, params:) ⇒ Object
Shortcut to make a DELETE request on the API.
24 25 26 |
# File 'lib/arkaan/decorators/gateway.rb', line 24 def delete(session:, url:, params:) return make_request_without_body(verb: 'delete', session: session, url: url, params: params) end |
#get(session:, url:, params:) ⇒ Object
Shortcut to make a GET request on the API.
32 33 34 |
# File 'lib/arkaan/decorators/gateway.rb', line 32 def get(session:, url:, params:) return make_request_without_body(verb: 'get', session: session, url: url, params: params) end |
#post(session:, url:, params:) ⇒ Object
Shortcut to make a POST request on the API.
40 41 42 |
# File 'lib/arkaan/decorators/gateway.rb', line 40 def post(session:, url:, params:) return make_request(verb: 'post', session: session, url: url, params: params) end |
#put(session:, url:, params:) ⇒ Object
Shortcut to make a PUT request on the API.
48 49 50 |
# File 'lib/arkaan/decorators/gateway.rb', line 48 def put(session:, url:, params:) return make_request(verb: 'put', session: session, url: url, params: params) end |