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.
23 24 25 26 27 |
# File 'lib/facebook_ads/api_response.rb', line 23 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.
21 22 23 |
# File 'lib/facebook_ads/api_response.rb', line 21 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
21 22 23 |
# File 'lib/facebook_ads/api_response.rb', line 21 def headers @headers end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
21 22 23 |
# File 'lib/facebook_ads/api_response.rb', line 21 def status_code @status_code end |
Instance Method Details
#fb_trace_id ⇒ Object
33 34 35 |
# File 'lib/facebook_ads/api_response.rb', line 33 def fb_trace_id @headers[:x_fb_trace_id] end |
#raw_body ⇒ Object
37 38 39 |
# File 'lib/facebook_ads/api_response.rb', line 37 def raw_body @body end |
#result ⇒ Object
29 30 31 |
# File 'lib/facebook_ads/api_response.rb', line 29 def result is_json_response? ? JSON.parse(body) : body end |