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.



27885
27886
27887
27888
27889
27890
27891
27892
27893
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27885

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.



27883
27884
27885
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27883

def body
  @body
end

#codeObject (readonly)

Returns the value of attribute code.



27883
27884
27885
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27883

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details.



27883
27884
27885
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27883

def details
  @details
end

#uriObject (readonly)

Returns the value of attribute uri.



27883
27884
27885
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27883

def uri
  @uri
end

Instance Method Details

#body_jsonObject



27903
27904
27905
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27903

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

#messageObject



27895
27896
27897
27898
27899
27900
27901
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 27895

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