Class: IActionable::Request
- Inherits:
-
Struct
- Object
- Struct
- IActionable::Request
- Defined in:
- lib/iactionable/connection.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
Returns the value of attribute path.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
-
#initialize(settings) ⇒ Request
constructor
A new instance of Request.
- #to(path) ⇒ Object
- #with_api_key ⇒ Object
- #with_app_key ⇒ Object
- #with_body(body = {}) ⇒ Object
- #with_params(params = {}) ⇒ Object
Constructor Details
#initialize(settings) ⇒ Request
Returns a new instance of Request.
9 10 11 12 13 14 15 |
# File 'lib/iactionable/connection.rb', line 9 def initialize(settings) @settings = settings self.path = nil self.params = {} self.headers = {} self.body = {} end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
6 7 8 |
# File 'lib/iactionable/connection.rb', line 6 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers
6 7 8 |
# File 'lib/iactionable/connection.rb', line 6 def headers @headers end |
#params ⇒ Object
Returns the value of attribute params
6 7 8 |
# File 'lib/iactionable/connection.rb', line 6 def params @params end |
#path ⇒ Object
Returns the value of attribute path
6 7 8 |
# File 'lib/iactionable/connection.rb', line 6 def path @path end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
7 8 9 |
# File 'lib/iactionable/connection.rb', line 7 def settings @settings end |
Instance Method Details
#to(path) ⇒ Object
17 18 19 20 |
# File 'lib/iactionable/connection.rb', line 17 def to(path) self.path = path unless path.nil? || path.empty? self end |
#with_api_key ⇒ Object
22 23 24 |
# File 'lib/iactionable/connection.rb', line 22 def with_api_key (self.headers[:Authorization] = @settings.api_key) and self end |
#with_app_key ⇒ Object
26 27 28 |
# File 'lib/iactionable/connection.rb', line 26 def with_app_key (self.params[:appKey] = @settings.app_key) and self end |
#with_body(body = {}) ⇒ Object
34 35 36 |
# File 'lib/iactionable/connection.rb', line 34 def with_body(body={}) self.body.merge!(body) and self end |
#with_params(params = {}) ⇒ Object
30 31 32 |
# File 'lib/iactionable/connection.rb', line 30 def with_params(params={}) self.params.merge!(params) and self end |