Class: MoesifApi::EventResponseModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/moesif_api/models/event_response_model.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#bodyObject

Response body

Returns:

  • (Object)


20
21
22
# File 'lib/moesif_api/models/event_response_model.rb', line 20

def body
  @body
end

#headersObject

Key/Value map of response headers

Returns:

  • (Object)


16
17
18
# File 'lib/moesif_api/models/event_response_model.rb', line 16

def headers
  @headers
end

#ip_addressString

IP Address from the response, such as the server IP Address

Returns:



24
25
26
# File 'lib/moesif_api/models/event_response_model.rb', line 24

def ip_address
  @ip_address
end

#statusInteger

HTTP Status code such as 200

Returns:

  • (Integer)


12
13
14
# File 'lib/moesif_api/models/event_response_model.rb', line 12

def status
  @status
end

#timeDateTime

Time when response received

Returns:

  • (DateTime)


8
9
10
# File 'lib/moesif_api/models/event_response_model.rb', line 8

def time
  @time
end

#transfer_encodingString

Transfer Encoding of body if other than JSON

Returns:



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

.namesObject

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