class AvataxClient::Request::Address
Handles modeling of Address
when performing requests (create / update)
Public Class Methods
collection_to_body(addresses = [])
click to toggle source
Transform a colleciton of {Address} into a format compatible with Avatax. @param [Array<Address>] @return [Hash]
# File lib/avatax_client/request/address.rb, line 22 def collection_to_body(addresses = []) addresses.reduce({}) { |a, e| a.merge!(e.to_body) } end
Public Instance Methods
to_body()
click to toggle source
Transform Hash into a version compatible with Avatax. Removes ‘label` attribute from hash, as it is used as the parent key in `addresses: {}`. @return [Hash]
Calls superclass method
AvataxClient::ReverseCoercion#to_body
# File lib/avatax_client/request/address.rb, line 32 def to_body hash = super label = hash[:label] hash.delete(:label) hash = { label => hash } hash end
Private Instance Methods
not_geocoded?()
click to toggle source
# File lib/avatax_client/request/address.rb, line 44 def not_geocoded? return true if latitude.nil? || longitude.nil? false end