Class: Sidemash::Sdk::HttpRequest
- Inherits:
-
Object
- Object
- Sidemash::Sdk::HttpRequest
- Defined in:
- lib/sidemash/sdk/http_request.rb
Instance Attribute Summary collapse
-
#body_hash ⇒ Object
readonly
Returns the value of attribute body_hash.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#nonce ⇒ Object
readonly
Returns the value of attribute nonce.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#query_string ⇒ Object
readonly
Returns the value of attribute query_string.
-
#signed_headers ⇒ Object
readonly
Returns the value of attribute signed_headers.
Instance Method Summary collapse
-
#initialize(signed_headers, method, path, query_string, body_hash) ⇒ HttpRequest
constructor
A new instance of HttpRequest.
- #to_message ⇒ Object
Constructor Details
#initialize(signed_headers, method, path, query_string, body_hash) ⇒ HttpRequest
Returns a new instance of HttpRequest.
11 12 13 14 15 16 17 18 19 |
# File 'lib/sidemash/sdk/http_request.rb', line 11 def initialize(signed_headers, method, path, query_string, body_hash) now = Time.now @nonce = now.to_i + now.usec / 1000 @signed_headers = signed_headers @method = method @path = path @query_string = query_string @body_hash = body_hash end |
Instance Attribute Details
#body_hash ⇒ Object (readonly)
Returns the value of attribute body_hash.
9 10 11 |
# File 'lib/sidemash/sdk/http_request.rb', line 9 def body_hash @body_hash end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/sidemash/sdk/http_request.rb', line 6 def method @method end |
#nonce ⇒ Object (readonly)
Returns the value of attribute nonce.
4 5 6 |
# File 'lib/sidemash/sdk/http_request.rb', line 4 def nonce @nonce end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/sidemash/sdk/http_request.rb', line 7 def path @path end |
#query_string ⇒ Object (readonly)
Returns the value of attribute query_string.
8 9 10 |
# File 'lib/sidemash/sdk/http_request.rb', line 8 def query_string @query_string end |
#signed_headers ⇒ Object (readonly)
Returns the value of attribute signed_headers.
5 6 7 |
# File 'lib/sidemash/sdk/http_request.rb', line 5 def signed_headers @signed_headers end |
Instance Method Details
#to_message ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sidemash/sdk/http_request.rb', line 21 def result = '' result += @nonce.to_s result += @signed_headers.map { |header_name, header_value| header_name + ':' + header_value }.join('') result += @method result += @path result += !@query_string.nil? ? @query_string : '' result += !@body_hash.nil? ? @body_hash : '' result end |