Class: Sink::Models::Address

Inherits:
BaseModel show all
Defined in:
lib/sink/models/address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#[], #deconstruct_keys, #inspect, #to_h, #to_s

Constructor Details

#initialize(data = {}) ⇒ Address

Create a new instance of Address from a Hash of raw data.

Parameters:

  • data (Hash{Symbol => Object}) (defaults to: {})

    . @option data [String] :address1 Valid deliverable address (no PO boxes). @option data [String] :city Name of city. @option data [String] :country Valid country code. Only USA is currently supported, entered in uppercase ISO

    3166-1 alpha-3 three-character format.
    

    @option data [String] :postal_code Valid postal code. Only USA ZIP codes are currently supported, entered as a

    five-digit ZIP or nine-digit ZIP+4.
    

    @option data [String] :state Valid state code. Only USA state codes are currently supported, entered in

    uppercase ISO 3166-2 two-character format.
    

    @option data [String, nil] :address2 Unit or apartment number (if applicable).



13
# File 'lib/sink/models/address.rb', line 13

def initialize(data = {}) = super

Instance Attribute Details

#address1String

Valid deliverable address (no PO boxes).

Returns:

  • (String)


9
# File 'lib/sink/models/address.rb', line 9

required :address1, String

#address2String

Unit or apartment number (if applicable).

Returns:

  • (String)


37
# File 'lib/sink/models/address.rb', line 37

optional :address2, String

#cityString

Name of city.

Returns:

  • (String)


14
# File 'lib/sink/models/address.rb', line 14

required :city, String

#countryString

Valid country code. Only USA is currently supported, entered in uppercase ISO 3166-1 alpha-3 three-character format.

Returns:

  • (String)


20
# File 'lib/sink/models/address.rb', line 20

required :country, String

#postal_codeString

Valid postal code. Only USA ZIP codes are currently supported, entered as a five-digit ZIP or nine-digit ZIP+4.

Returns:

  • (String)


26
# File 'lib/sink/models/address.rb', line 26

required :postal_code, String

#stateString

Valid state code. Only USA state codes are currently supported, entered in uppercase ISO 3166-2 two-character format.

Returns:

  • (String)


32
# File 'lib/sink/models/address.rb', line 32

required :state, String