Class: Io::Flow::V0::Models::InvitationError

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

Overview

Returns information as to why a particular invitation could not be accepted.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ InvitationError

Returns a new instance of InvitationError.



35808
35809
35810
35811
35812
35813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35808

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:code, :messages], 'InvitationError')
  @code = (x = opts.delete(:code); x.is_a?(::Io::Flow::V0::Models::InvitationErrorCode) ? x : ::Io::Flow::V0::Models::InvitationErrorCode.apply(x))
  @messages = HttpClient::Preconditions.assert_class('messages', opts.delete(:messages), Array).map { |v| HttpClient::Preconditions.assert_class('messages', v, String) }
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



35806
35807
35808
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35806

def code
  @code
end

#messagesObject (readonly)

Returns the value of attribute messages.



35806
35807
35808
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35806

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



35819
35820
35821
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35819

def copy(incoming={})
  InvitationError.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



35823
35824
35825
35826
35827
35828
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35823

def to_hash
  {
    :code => code.value,
    :messages => messages
  }
end

#to_jsonObject



35815
35816
35817
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35815

def to_json
  JSON.dump(to_hash)
end