Class: Io::Flow::V0::Models::MerchantGiftCardError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ MerchantGiftCardError

Returns a new instance of MerchantGiftCardError.



37970
37971
37972
37973
37974
37975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37970

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



37968
37969
37970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37968

def code
  @code
end

#messagesObject (readonly)

Returns the value of attribute messages.



37968
37969
37970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37968

def messages
  @messages
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



37981
37982
37983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37981

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

#to_hashObject



37985
37986
37987
37988
37989
37990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37985

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

#to_jsonObject



37977
37978
37979
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 37977

def to_json
  JSON.dump(to_hash)
end