Class: FacebookAds::APIResponse
- Inherits:
-
Object
- Object
- FacebookAds::APIResponse
- Defined in:
- lib/facebook_ads/api_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #fb_trace_id ⇒ Object
-
#initialize(status_code, headers, body) ⇒ APIResponse
constructor
A new instance of APIResponse.
- #raw_body ⇒ Object
- #result ⇒ Object
Constructor Details
#initialize(status_code, headers, body) ⇒ APIResponse
Returns a new instance of APIResponse.
11 12 13 14 15 |
# File 'lib/facebook_ads/api_response.rb', line 11 def initialize(status_code, headers, body) @status_code = status_code @headers = headers @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/facebook_ads/api_response.rb', line 9 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
9 10 11 |
# File 'lib/facebook_ads/api_response.rb', line 9 def headers @headers end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
9 10 11 |
# File 'lib/facebook_ads/api_response.rb', line 9 def status_code @status_code end |
Instance Method Details
#fb_trace_id ⇒ Object
21 22 23 |
# File 'lib/facebook_ads/api_response.rb', line 21 def fb_trace_id @headers[:x_fb_trace_id] end |
#raw_body ⇒ Object
25 26 27 |
# File 'lib/facebook_ads/api_response.rb', line 25 def raw_body @body end |
#result ⇒ Object
17 18 19 |
# File 'lib/facebook_ads/api_response.rb', line 17 def result is_json_response? ? JSON.parse(body) : body end |