class Io::Flow::V0::Models::JsonpResponse
The jsonp_response defines the schema for all Flow
APIs calls made over JSONP, providing access to the specific response status, headers, and body from the underlying service. See docs.flow.io/#jsonp for details
Attributes
body[R]
headers[R]
status[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 47696 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:status, :headers, :body], 'JsonpResponse') @status = HttpClient::Preconditions.assert_class('status', opts.delete(:status), Integer) @headers = HttpClient::Preconditions.assert_class('headers', opts.delete(:headers), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('headers', d[1], Array).map { |v| HttpClient::Preconditions.assert_class('headers', v, String) }; h } @body = HttpClient::Preconditions.assert_class('body', HttpClient::Helper.to_object(opts.delete(:body)), Hash) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 47708 def copy(incoming={}) JsonpResponse.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 47712 def to_hash { :status => status, :headers => headers.inject({}) { |hash, o| hash[o[0]] = o[1].nil? ? nil : o[1]; hash }, :body => body } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 47704 def to_json JSON.dump(to_hash) end