Class: MoesifApi::EventRequestModel
- Defined in:
- lib/moesif_api/models/event_request_model.rb
Instance Attribute Summary collapse
-
#api_version ⇒ String
Optionally tag the call with your API or App version.
-
#body ⇒ Object
Request body.
-
#headers ⇒ Object
Key/Value map of request headers.
-
#ip_address ⇒ String
IP Address of the client if known.
-
#time ⇒ DateTime
Time when request was made.
-
#transfer_encoding ⇒ String
Transfer Encoding of body if other than JSON.
-
#uri ⇒ String
full uri of request such as www.example.com/my_path?param=1.
-
#verb ⇒ String
verb of the API request such as GET or POST.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(time = nil, uri = nil, verb = nil, headers = nil, api_version = nil, ip_address = nil, body = nil, transfer_encoding = nil) ⇒ EventRequestModel
constructor
A new instance of EventRequestModel.
Methods inherited from BaseModel
Constructor Details
#initialize(time = nil, uri = nil, verb = nil, headers = nil, api_version = nil, ip_address = nil, body = nil, transfer_encoding = nil) ⇒ EventRequestModel
Returns a new instance of EventRequestModel.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/moesif_api/models/event_request_model.rb', line 54 def initialize(time = nil, uri = nil, verb = nil, headers = nil, api_version = nil, ip_address = nil, body = nil, transfer_encoding = nil) @time = time @uri = uri @verb = verb @headers = headers @api_version = api_version @ip_address = ip_address @body = body @transfer_encoding = transfer_encoding end |
Instance Attribute Details
#api_version ⇒ String
Optionally tag the call with your API or App version
24 25 26 |
# File 'lib/moesif_api/models/event_request_model.rb', line 24 def api_version @api_version end |
#body ⇒ Object
Request body
32 33 34 |
# File 'lib/moesif_api/models/event_request_model.rb', line 32 def body @body end |
#headers ⇒ Object
Key/Value map of request headers
20 21 22 |
# File 'lib/moesif_api/models/event_request_model.rb', line 20 def headers @headers end |
#ip_address ⇒ String
IP Address of the client if known.
28 29 30 |
# File 'lib/moesif_api/models/event_request_model.rb', line 28 def ip_address @ip_address end |
#time ⇒ DateTime
Time when request was made
8 9 10 |
# File 'lib/moesif_api/models/event_request_model.rb', line 8 def time @time end |
#transfer_encoding ⇒ String
Transfer Encoding of body if other than JSON
36 37 38 |
# File 'lib/moesif_api/models/event_request_model.rb', line 36 def transfer_encoding @transfer_encoding end |
#uri ⇒ String
full uri of request such as www.example.com/my_path?param=1
12 13 14 |
# File 'lib/moesif_api/models/event_request_model.rb', line 12 def uri @uri end |
#verb ⇒ String
verb of the API request such as GET or POST
16 17 18 |
# File 'lib/moesif_api/models/event_request_model.rb', line 16 def verb @verb end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/moesif_api/models/event_request_model.rb', line 73 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash time = DateTime.iso8601(hash["time"]) if hash["time"] uri = hash["uri"] verb = hash["verb"] headers = hash["headers"] api_version = hash["api_version"] ip_address = hash["ip_address"] body = hash["body"] transfer_encoding = hash["transfer_encoding"] # Create object from extracted values EventRequestModel.new(time, uri, verb, headers, api_version, ip_address, body, transfer_encoding) end end |
.names ⇒ Object
A mapping from model property names to API property names
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/moesif_api/models/event_request_model.rb', line 39 def self.names if @hash.nil? @hash = {} @hash["time"] = "time" @hash["uri"] = "uri" @hash["verb"] = "verb" @hash["headers"] = "headers" @hash["api_version"] = "api_version" @hash["ip_address"] = "ip_address" @hash["body"] = "body" @hash["transfer_encoding"] = "transfer_encoding" end @hash end |