Class: Bixby::SignedJsonRequest
- Inherits:
-
JsonRequest
- Object
- JsonRequest
- Bixby::SignedJsonRequest
- Defined in:
- lib/bixby-common/api/signed_json_request.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
Attributes inherited from JsonRequest
Instance Method Summary collapse
- #body ⇒ Object
- #body=(str) ⇒ Object
-
#initialize(json_request, access_key = nil, secret_key = nil) ⇒ SignedJsonRequest
constructor
A new instance of SignedJsonRequest.
-
#path ⇒ Object
api-auth requires a path.
- #to_wire ⇒ Object
Methods inherited from JsonRequest
Methods included from HttpClient
#http_get, #http_get_json, #http_post, #http_post_download, #http_post_json
Methods included from Jsonify
Methods included from Hashify
Constructor Details
#initialize(json_request, access_key = nil, secret_key = nil) ⇒ SignedJsonRequest
Returns a new instance of SignedJsonRequest.
9 10 11 12 13 14 15 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 9 def initialize(json_request, access_key=nil, secret_key=nil) @operation = json_request.operation @params = json_request.params @access_key = access_key @secret_key = secret_key @headers = {} end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
7 8 9 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 7 def headers @headers end |
Instance Method Details
#body ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 26 def body if @body.nil? then hash = { :operation => operation, :params => params } @body = MultiJson.dump(hash) end return @body end |
#body=(str) ⇒ Object
22 23 24 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 22 def body=(str) @body = str end |
#path ⇒ Object
api-auth requires a path
18 19 20 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 18 def path "/api" end |
#to_wire ⇒ Object
34 35 36 37 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 34 def to_wire ApiAuth.sign!(self, @access_key, @secret_key) body end |