Exception: Io::Flow::V0::HttpClient::ServerError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, details, incoming = {}) ⇒ ServerError

Returns a new instance of ServerError.



17282
17283
17284
17285
17286
17287
17288
17289
17290
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17282

def initialize(code, details, incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @code = HttpClient::Preconditions.assert_class('code', code, Integer)
  @details = HttpClient::Preconditions.assert_class('details', details, String)
  @body = HttpClient::Preconditions.assert_class_or_nil('body', opts.delete(:body), String)
  @uri = HttpClient::Preconditions.assert_class_or_nil('uri', opts.delete(:uri), String)
  HttpClient::Preconditions.assert_empty_opts(opts)
  super(self.message)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



17280
17281
17282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17280

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



17280
17281
17282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17280

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



17280
17281
17282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17280

def details
  @details
end

#uriObject (readonly)

Returns the value of attribute uri.



17280
17281
17282
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17280

def uri
  @uri
end

Instance Method Details

#body_jsonObject



17300
17301
17302
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17300

def body_json
  JSON.parse(@body)
end

#messageObject



17292
17293
17294
17295
17296
17297
17298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17292

def message
  m = "%s %s" % [@code, @details]
  if @body
    m << ": %s" % @body
  end
  m
end