Class: Io::Flow::V0::Models::Avs

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

Overview

Represents the address verification results

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Avs

Returns a new instance of Avs.



23032
23033
23034
23035
23036
23037
23038
23039
23040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23032

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:code], 'Avs')
  @code = (x = opts.delete(:code); x.is_a?(::Io::Flow::V0::Models::AvsCode) ? x : ::Io::Flow::V0::Models::AvsCode.apply(x))
  @name = (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_boolean('name', x))
  @address = (x = opts.delete(:address); x.nil? ? nil : HttpClient::Preconditions.assert_boolean('address', x))
  @postal = (x = opts.delete(:postal); x.nil? ? nil : HttpClient::Preconditions.assert_boolean('postal', x))
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



23030
23031
23032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23030

def address
  @address
end

#codeObject (readonly)

Returns the value of attribute code.



23030
23031
23032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23030

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



23030
23031
23032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23030

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



23030
23031
23032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23030

def name
  @name
end

#postalObject (readonly)

Returns the value of attribute postal.



23030
23031
23032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23030

def postal
  @postal
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



23046
23047
23048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23046

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

#to_hashObject



23050
23051
23052
23053
23054
23055
23056
23057
23058
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23050

def to_hash
  {
    :code => code.value,
    :name => name,
    :address => address,
    :postal => postal,
    :description => description
  }
end

#to_jsonObject



23042
23043
23044
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 23042

def to_json
  JSON.dump(to_hash)
end