Class: MoesifApi::EventResponseModel
- 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.
-
#transfer_encoding ⇒ String
Transfer Encoding of body if other than JSON.
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, transfer_encoding = nil) ⇒ EventResponseModel
constructor
A new instance of EventResponseModel.
Methods inherited from BaseModel
#clean_str, #to_hash, #to_json
Constructor Details
#initialize(time = nil, status = nil, headers = nil, body = nil, ip_address = nil, transfer_encoding = nil) ⇒ EventResponseModel
Returns a new instance of EventResponseModel.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/moesif_api/models/event_response_model.rb', line 44 def initialize(time = nil, status = nil, headers = nil, body = nil, ip_address = nil, transfer_encoding = nil) @time = time @status = status @headers = headers @body = body @ip_address = ip_address @transfer_encoding = transfer_encoding 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 |
#transfer_encoding ⇒ String
Transfer Encoding of body if other than JSON
28 29 30 |
# File 'lib/moesif_api/models/event_response_model.rb', line 28 def transfer_encoding @transfer_encoding end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/moesif_api/models/event_response_model.rb', line 59 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"] transfer_encoding = hash["transfer_encoding"] # Create object from extracted values EventResponseModel.new(time, status, headers, body, ip_address, transfer_encoding) end end |
.names ⇒ Object
A mapping from model property names to API property names
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/moesif_api/models/event_response_model.rb', line 31 def self.names if @hash.nil? @hash = {} @hash["time"] = "time" @hash["status"] = "status" @hash["headers"] = "headers" @hash["body"] = "body" @hash["ip_address"] = "ip_address" @hash["transfer_encoding"] = "transfer_encoding" end @hash end |