Class: SimpleApiAuth::Request
- Inherits:
-
Object
- Object
- SimpleApiAuth::Request
- Includes:
- Helpers::Request
- Defined in:
- lib/simple-api-auth/request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_verb ⇒ Object
Returns the value of attribute http_verb.
-
#query_string ⇒ Object
Returns the value of attribute query_string.
-
#uri ⇒ Object
Returns the value of attribute uri.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Request
constructor
A new instance of Request.
- #time ⇒ Object
Methods included from Helpers::Request
#normalize, #normalize_headers
Constructor Details
#initialize(options = {}) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 12 13 |
# File 'lib/simple-api-auth/request.rb', line 7 def initialize( = {}) .each do |k, v| send("#{k}=", v) end self.headers = normalize_headers(headers) self.http_verb = normalize(http_verb) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/simple-api-auth/request.rb', line 5 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/simple-api-auth/request.rb', line 5 def headers @headers end |
#http_verb ⇒ Object
Returns the value of attribute http_verb.
5 6 7 |
# File 'lib/simple-api-auth/request.rb', line 5 def http_verb @http_verb end |
#query_string ⇒ Object
Returns the value of attribute query_string.
5 6 7 |
# File 'lib/simple-api-auth/request.rb', line 5 def query_string @query_string end |
#uri ⇒ Object
Returns the value of attribute uri.
5 6 7 |
# File 'lib/simple-api-auth/request.rb', line 5 def uri @uri end |
Class Method Details
.create(request) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/simple-api-auth/request.rb', line 22 def self.create(request) if request.is_a?(Request) request else = {} SimpleApiAuth.config.request_fields.each do |k, v| [k] = request.send(v) end Request.new() end end |
Instance Method Details
#time ⇒ Object
15 16 17 18 19 20 |
# File 'lib/simple-api-auth/request.rb', line 15 def time header_key = SimpleApiAuth.config.header_keys[:time] Time.parse(headers[header_key]) rescue ArgumentError nil end |