Class: Core::Models::Decorators::Gateway
- Inherits:
-
Draper::Decorator
- Object
- Draper::Decorator
- Core::Models::Decorators::Gateway
- Defined in:
- lib/core/models/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.
15 16 17 18 19 |
# File 'lib/core/models/decorators/gateway.rb', line 15 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.
11 12 13 |
# File 'lib/core/models/decorators/gateway.rb', line 11 def action @action end |
#logger ⇒ Object
Returns the value of attribute logger.
13 14 15 |
# File 'lib/core/models/decorators/gateway.rb', line 13 def logger @logger end |
Instance Method Details
#delete(session:, url:, params:) ⇒ Object
Shortcut to make a DELETE request on the API.
25 26 27 |
# File 'lib/core/models/decorators/gateway.rb', line 25 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.
33 34 35 |
# File 'lib/core/models/decorators/gateway.rb', line 33 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.
41 42 43 |
# File 'lib/core/models/decorators/gateway.rb', line 41 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.
49 50 51 |
# File 'lib/core/models/decorators/gateway.rb', line 49 def put(session:, url:, params:) return make_request(verb: 'put', session: session, url: url, params: params) end |