Class: Inplat::SignedRequest
- Inherits:
-
Object
- Object
- Inplat::SignedRequest
- Defined in:
- lib/inplat/api.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
Instance Method Summary collapse
-
#initialize(params) ⇒ SignedRequest
constructor
A new instance of SignedRequest.
- #request_body ⇒ Object
- #signed_uri ⇒ Object
Constructor Details
#initialize(params) ⇒ SignedRequest
Returns a new instance of SignedRequest.
5 6 7 8 9 10 |
# File 'lib/inplat/api.rb', line 5 def initialize(params) @host = params.fetch(:host) @request_params = params.fetch(:request_params) @secret = params.fetch(:secret) @api_key = params.fetch(:api_key) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/inplat/api.rb', line 3 def api_key @api_key end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/inplat/api.rb', line 3 def host @host end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
3 4 5 |
# File 'lib/inplat/api.rb', line 3 def secret @secret end |
Instance Method Details
#request_body ⇒ Object
12 13 14 |
# File 'lib/inplat/api.rb', line 12 def request_body @request_body ||= @request_params.to_json end |
#signed_uri ⇒ Object
16 17 18 |
# File 'lib/inplat/api.rb', line 16 def signed_uri @uri ||= "#{host}/?api_key=#{api_key}&sign=#{sign}" end |