Class: MoesifApi::ResponseModel
- Defined in:
- lib/moesif_api/models/event_response_model.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Response body.
-
#headers ⇒ Object
Key/Value map of response headers.
-
#ip_address ⇒ String
IP Address from the response, such as the server IP Address.
-
#status ⇒ Integer
HTTP Status code such as 200.
-
#time ⇒ DateTime
Time when response received.
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, status = nil, headers = nil, body = nil, ip_address = nil) ⇒ ResponseModel
constructor
A new instance of ResponseModel.
Methods inherited from BaseModel
Constructor Details
#initialize(time = nil, status = nil, headers = nil, body = nil, ip_address = nil) ⇒ ResponseModel
Returns a new instance of ResponseModel.
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/moesif_api/models/event_response_model.rb', line 39 def initialize(time = nil, status = nil, headers = nil, body = nil, ip_address = nil) @time = time @status = status @headers = headers @body = body @ip_address = ip_address end |
Instance Attribute Details
#body ⇒ Object
Response body
20 21 22 |
# File 'lib/moesif_api/models/event_response_model.rb', line 20 def body @body end |
#headers ⇒ Object
Key/Value map of response headers
16 17 18 |
# File 'lib/moesif_api/models/event_response_model.rb', line 16 def headers @headers end |
#ip_address ⇒ String
IP Address from the response, such as the server IP Address
24 25 26 |
# File 'lib/moesif_api/models/event_response_model.rb', line 24 def ip_address @ip_address end |
#status ⇒ Integer
HTTP Status code such as 200
12 13 14 |
# File 'lib/moesif_api/models/event_response_model.rb', line 12 def status @status end |
#time ⇒ DateTime
Time when response received
8 9 10 |
# File 'lib/moesif_api/models/event_response_model.rb', line 8 def time @time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/moesif_api/models/event_response_model.rb', line 52 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash time = DateTime.iso8601(hash["time"]) if hash["time"] status = hash["status"] headers = hash["headers"] body = hash["body"] ip_address = hash["ip_address"] # Create object from extracted values ResponseModel.new(time, status, headers, body, ip_address) end end |
.names ⇒ Object
A mapping from model property names to API property names
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/moesif_api/models/event_response_model.rb', line 27 def self.names if @hash.nil? @hash = {} @hash["time"] = "time" @hash["status"] = "status" @hash["headers"] = "headers" @hash["body"] = "body" @hash["ip_address"] = "ip_address" end @hash end |