Class: Pago::V2026_04::Models::AddressDict

Inherits:
Model
  • Object
show all
Defined in:
lib/pago/v2026_04/models.rb,
sig/pago/v2026_04/generated.rbs

Constant Summary collapse

JSON_KEYS =

Returns:

  • (Hash[Symbol, String])
{
  line1: "line1",
  line2: "line2",
  postal_code: "postal_code",
  city: "city",
  state: "state",
  country: "country"
}.freeze
REQUIRED_KEYS =

Returns:

  • (Array[String])
["country"].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#==, #[], #field_set?, #hash, #inspect, json_keys, required_json_keys, #to_json, #to_json_hash, wrap_raw

Constructor Details

#initialize(line1: ::Pago::UNSET, line2: ::Pago::UNSET, postal_code: ::Pago::UNSET, city: ::Pago::UNSET, state: ::Pago::UNSET, country:) ⇒ AddressDict

Returns a new instance of AddressDict.

Parameters:

  • line1: (String, nil) (defaults to: ::Pago::UNSET)
  • line2: (String, nil) (defaults to: ::Pago::UNSET)
  • postal_code: (String, nil) (defaults to: ::Pago::UNSET)
  • city: (String, nil) (defaults to: ::Pago::UNSET)
  • state: (String, nil) (defaults to: ::Pago::UNSET)
  • country: (String)


106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/pago/v2026_04/models.rb', line 106

def initialize(
  line1: ::Pago::UNSET,
  line2: ::Pago::UNSET,
  postal_code: ::Pago::UNSET,
  city: ::Pago::UNSET,
  state: ::Pago::UNSET,
  country:
)
  super()
  assign(:line1, line1)
  assign(:line2, line2)
  assign(:postal_code, postal_code)
  assign(:city, city)
  assign(:state, state)
  assign(:country, country)
end

Instance Attribute Details

#cityString (readonly)

Returns:

  • (String)


98
99
100
# File 'lib/pago/v2026_04/models.rb', line 98

def city
  @city
end

#countryString (readonly)

Returns:

  • (String)


104
105
106
# File 'lib/pago/v2026_04/models.rb', line 104

def country
  @country
end

#line1String (readonly)

Returns:

  • (String)


89
90
91
# File 'lib/pago/v2026_04/models.rb', line 89

def line1
  @line1
end

#line2String (readonly)

Returns:

  • (String)


92
93
94
# File 'lib/pago/v2026_04/models.rb', line 92

def line2
  @line2
end

#postal_codeString (readonly)

Returns:

  • (String)


95
96
97
# File 'lib/pago/v2026_04/models.rb', line 95

def postal_code
  @postal_code
end

#stateString (readonly)

Returns:

  • (String)


101
102
103
# File 'lib/pago/v2026_04/models.rb', line 101

def state
  @state
end

Class Method Details

.from_json(data) ⇒ AddressDict?

Parameters:

  • data (Hash, String, nil)

Returns:



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/pago/v2026_04/models.rb', line 125

def self.from_json(data)
  data = ::JSON.parse(data) if data.is_a?(String)
  data = ::Pago::Serde.object(data)
  return nil if data.nil?

  wrap_raw(
    new(
      line1: (data.key?("line1") ? data["line1"] : ::Pago::UNSET),
      line2: (data.key?("line2") ? data["line2"] : ::Pago::UNSET),
      postal_code: (data.key?("postal_code") ? data["postal_code"] : ::Pago::UNSET),
      city: (data.key?("city") ? data["city"] : ::Pago::UNSET),
      state: (data.key?("state") ? data["state"] : ::Pago::UNSET),
      country: (data.key?("country") ? data["country"] : ::Pago::UNSET)
    ),
    data
  )
end