Class: Paid::Address
- Inherits:
-
Object
- Object
- Paid::Address
- Defined in:
- lib/paid_ruby/types/address.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #city ⇒ String readonly
- #country ⇒ String readonly
- #line_1 ⇒ String readonly
- #line_2 ⇒ String readonly
- #state ⇒ String readonly
- #zip_code ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(line_1:, line_2: OMIT, city:, state:, zip_code:, country:, additional_properties: nil) ⇒ Paid::Address constructor
- #to_json ⇒ String
Constructor Details
#initialize(line_1:, line_2: OMIT, city:, state:, zip_code:, country:, additional_properties: nil) ⇒ Paid::Address
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/paid_ruby/types/address.rb', line 35 def initialize(line_1:, line_2: OMIT, city:, state:, zip_code:, country:, additional_properties: nil) @line_1 = line_1 @line_2 = line_2 if line_2 != OMIT @city = city @state = state @zip_code = zip_code @country = country @additional_properties = additional_properties @_field_set = { "line1": line_1, "line2": line_2, "city": city, "state": state, "zipCode": zip_code, "country": country }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
20 21 22 |
# File 'lib/paid_ruby/types/address.rb', line 20 def additional_properties @additional_properties end |
#city ⇒ String (readonly)
12 13 14 |
# File 'lib/paid_ruby/types/address.rb', line 12 def city @city end |
#country ⇒ String (readonly)
18 19 20 |
# File 'lib/paid_ruby/types/address.rb', line 18 def country @country end |
#line_1 ⇒ String (readonly)
8 9 10 |
# File 'lib/paid_ruby/types/address.rb', line 8 def line_1 @line_1 end |
#line_2 ⇒ String (readonly)
10 11 12 |
# File 'lib/paid_ruby/types/address.rb', line 10 def line_2 @line_2 end |
#state ⇒ String (readonly)
14 15 16 |
# File 'lib/paid_ruby/types/address.rb', line 14 def state @state end |
#zip_code ⇒ String (readonly)
16 17 18 |
# File 'lib/paid_ruby/types/address.rb', line 16 def zip_code @zip_code end |
Class Method Details
.from_json(json_object:) ⇒ Paid::Address
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/paid_ruby/types/address.rb', line 51 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) line_1 = parsed_json["line1"] line_2 = parsed_json["line2"] city = parsed_json["city"] state = parsed_json["state"] zip_code = parsed_json["zipCode"] country = parsed_json["country"] new( line_1: line_1, line_2: line_2, city: city, state: state, zip_code: zip_code, country: country, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
82 83 84 85 86 87 88 89 |
# File 'lib/paid_ruby/types/address.rb', line 82 def self.validate_raw(obj:) obj.line_1.is_a?(String) != false || raise("Passed value for field obj.line_1 is not the expected type, validation failed.") obj.line_2&.is_a?(String) != false || raise("Passed value for field obj.line_2 is not the expected type, validation failed.") obj.city.is_a?(String) != false || raise("Passed value for field obj.city is not the expected type, validation failed.") obj.state.is_a?(String) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") obj.zip_code.is_a?(String) != false || raise("Passed value for field obj.zip_code is not the expected type, validation failed.") obj.country.is_a?(String) != false || raise("Passed value for field obj.country is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
73 74 75 |
# File 'lib/paid_ruby/types/address.rb', line 73 def to_json @_field_set&.to_json end |