class Io::Flow::V0::Models::AddressVerification

Address verification returns information on whether or not an address is valid and deliverable - meaning carriers will accept this address. Also returns suggestions for address correction, including data to highlight specific fields to correct.

Attributes

address[R]
suggestions[R]
valid[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 29798
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:address, :valid], 'AddressVerification')
  @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
  @valid = HttpClient::Preconditions.assert_boolean('valid', opts.delete(:valid))
  @suggestions = HttpClient::Preconditions.assert_class('suggestions', (x = opts.delete(:suggestions); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::AddressSuggestion) ? x : ::Io::Flow::V0::Models::AddressSuggestion.new(x)) }
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 29810
def copy(incoming={})
  AddressVerification.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 29814
def to_hash
  {
    :address => address.to_hash,
    :valid => valid,
    :suggestions => suggestions.map { |o| o.to_hash }
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 29806
def to_json
  JSON.dump(to_hash)
end