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.
7 8 9 10 11 12 13 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 7 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.
5 6 7 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 5 def headers @headers end |
Instance Method Details
#body ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 24 def body if @body.nil? then hash = { :operation => operation, :params => params } @body = MultiJson.dump(hash) end return @body end |
#body=(str) ⇒ Object
20 21 22 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 20 def body=(str) @body = str end |
#path ⇒ Object
api-auth requires a path
16 17 18 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 16 def path "/api" end |
#to_wire ⇒ Object
32 33 34 35 |
# File 'lib/bixby-common/api/signed_json_request.rb', line 32 def to_wire ApiAuth.sign!(self, @access_key, @secret_key) body end |