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



43560
43561
43562
43563
43564
43565
43566
43567
43568
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43560

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.



43558
43559
43560
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43558

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



43558
43559
43560
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43558

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



43558
43559
43560
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43558

def details
  @details
end

#uriObject (readonly)

Returns the value of attribute uri.



43558
43559
43560
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43558

def uri
  @uri
end

Instance Method Details

#body_jsonObject



43578
43579
43580
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43578

def body_json
  @body ? JSON.parse(@body) : nil
end

#messageObject



43570
43571
43572
43573
43574
43575
43576
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43570

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