Class: Pago::V2026_04::Models::AddressInput

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:) ⇒ AddressInput

Returns a new instance of AddressInput.

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)


173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/pago/v2026_04/models.rb', line 173

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, nil)


165
166
167
# File 'lib/pago/v2026_04/models.rb', line 165

def city
  @city
end

#countryString (readonly)

Returns:

  • (String)


171
172
173
# File 'lib/pago/v2026_04/models.rb', line 171

def country
  @country
end

#line1String? (readonly)

Returns:

  • (String, nil)


156
157
158
# File 'lib/pago/v2026_04/models.rb', line 156

def line1
  @line1
end

#line2String? (readonly)

Returns:

  • (String, nil)


159
160
161
# File 'lib/pago/v2026_04/models.rb', line 159

def line2
  @line2
end

#postal_codeString? (readonly)

Returns:

  • (String, nil)


162
163
164
# File 'lib/pago/v2026_04/models.rb', line 162

def postal_code
  @postal_code
end

#stateString? (readonly)

Returns:

  • (String, nil)


168
169
170
# File 'lib/pago/v2026_04/models.rb', line 168

def state
  @state
end

Class Method Details

.from_json(data) ⇒ AddressInput?

Parameters:

  • data (Hash, String, nil)

Returns:



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/pago/v2026_04/models.rb', line 192

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