Class: ConnectClient::EventPushResponse
- Inherits:
-
Object
- Object
- ConnectClient::EventPushResponse
- Defined in:
- lib/connect_client/event_push_response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#http_status_code ⇒ Object
readonly
Returns the value of attribute http_status_code.
Instance Method Summary collapse
-
#initialize(code, content_type, response_body, events_pushed) ⇒ EventPushResponse
constructor
A new instance of EventPushResponse.
- #success? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(code, content_type, response_body, events_pushed) ⇒ EventPushResponse
Returns a new instance of EventPushResponse.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/connect_client/event_push_response.rb', line 8 def initialize(code, content_type, response_body, events_pushed) @http_status_code = code.to_s if content_type.include? 'application/json' body = response_body body = '{}' if response_body.to_s.empty? parse_body(body, events_pushed) else @data = response_body end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/connect_client/event_push_response.rb', line 5 def data @data end |
#http_status_code ⇒ Object (readonly)
Returns the value of attribute http_status_code.
6 7 8 |
# File 'lib/connect_client/event_push_response.rb', line 6 def http_status_code @http_status_code end |
Instance Method Details
#success? ⇒ Boolean
20 21 22 |
# File 'lib/connect_client/event_push_response.rb', line 20 def success? @http_status_code.start_with? '2' end |
#to_s ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/connect_client/event_push_response.rb', line 24 def to_s %{ Status: #{@http_status_code} Successful: #{success?} Data: #{data} } end |