Class: Pago::V2026_04::Models::Address

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

Returns a new instance of Address.

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)


39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/pago/v2026_04/models.rb', line 39

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)


31
32
33
# File 'lib/pago/v2026_04/models.rb', line 31

def city
  @city
end

#countryString (readonly)

Returns:

  • (String)


37
38
39
# File 'lib/pago/v2026_04/models.rb', line 37

def country
  @country
end

#line1String? (readonly)

Returns:

  • (String, nil)


22
23
24
# File 'lib/pago/v2026_04/models.rb', line 22

def line1
  @line1
end

#line2String? (readonly)

Returns:

  • (String, nil)


25
26
27
# File 'lib/pago/v2026_04/models.rb', line 25

def line2
  @line2
end

#postal_codeString? (readonly)

Returns:

  • (String, nil)


28
29
30
# File 'lib/pago/v2026_04/models.rb', line 28

def postal_code
  @postal_code
end

#stateString? (readonly)

Returns:

  • (String, nil)


34
35
36
# File 'lib/pago/v2026_04/models.rb', line 34

def state
  @state
end

Class Method Details

.from_json(data) ⇒ Address?

Parameters:

  • data (Hash, String, nil)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/pago/v2026_04/models.rb', line 58

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