Class: Merge::Accounting::Address
- Inherits:
-
Object
- Object
- Merge::Accounting::Address
- Defined in:
- lib/merge_ruby_client/accounting/types/address.rb
Overview
The Address Object
Description
The Address object is used to represent a contact's or company's address.
Usage Example
Fetch from the GET CompanyInfo endpoint and view the company's addresses.
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
The address's city.
-
#country ⇒ Merge::Accounting::CountryEnum
readonly
The address's country.
-
#country_subdivision ⇒ String
readonly
The address's state or region.
-
#created_at ⇒ DateTime
readonly
The datetime that this object was created by Merge.
-
#modified_at ⇒ DateTime
readonly
The datetime that this object was modified by Merge.
- #state ⇒ Object readonly
-
#street_1 ⇒ String
readonly
Line 1 of the address's street.
-
#street_2 ⇒ String
readonly
Line 2 of the address's street.
-
#type ⇒ Merge::Accounting::AddressTypeEnum
readonly
The address type.
-
#zip_code ⇒ String
readonly
The address's zip code.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::Address
Deserialize a JSON object to an instance of Address.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
Instance Method Summary collapse
- #initialize(created_at: OMIT, modified_at: OMIT, type: OMIT, street_1: OMIT, street_2: OMIT, city: OMIT, state: OMIT, country_subdivision: OMIT, country: OMIT, zip_code: OMIT, additional_properties: nil) ⇒ Merge::Accounting::Address constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Address to a JSON object.
Constructor Details
#initialize(created_at: OMIT, modified_at: OMIT, type: OMIT, street_1: OMIT, street_2: OMIT, city: OMIT, state: OMIT, country_subdivision: OMIT, country: OMIT, zip_code: OMIT, additional_properties: nil) ⇒ Merge::Accounting::Address
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 559 def initialize(created_at: OMIT, modified_at: OMIT, type: OMIT, street_1: OMIT, street_2: OMIT, city: OMIT, state: OMIT, country_subdivision: OMIT, country: OMIT, zip_code: OMIT, additional_properties: nil) @created_at = created_at if created_at != OMIT @modified_at = modified_at if modified_at != OMIT @type = type if type != OMIT @street_1 = street_1 if street_1 != OMIT @street_2 = street_2 if street_2 != OMIT @city = city if city != OMIT @state = state if state != OMIT @country_subdivision = country_subdivision if country_subdivision != OMIT @country = country if country != OMIT @zip_code = zip_code if zip_code != OMIT @additional_properties = additional_properties @_field_set = { "created_at": created_at, "modified_at": modified_at, "type": type, "street_1": street_1, "street_2": street_2, "city": city, "state": state, "country_subdivision": country_subdivision, "country": country, "zip_code": zip_code }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
289 290 291 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 289 def additional_properties @additional_properties end |
#city ⇒ String (readonly)
Returns The address's city.
30 31 32 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 30 def city @city end |
#country ⇒ Merge::Accounting::CountryEnum (readonly)
Returns The address's country.
AF- AfghanistanAX- Åland IslandsAL- AlbaniaDZ- AlgeriaAS- American SamoaAD- AndorraAO- AngolaAI- AnguillaAQ- AntarcticaAG- Antigua and BarbudaAR- ArgentinaAM- ArmeniaAW- ArubaAU- AustraliaAT- AustriaAZ- AzerbaijanBS- BahamasBH- BahrainBD- BangladeshBB- BarbadosBY- BelarusBE- BelgiumBZ- BelizeBJ- BeninBM- BermudaBT- BhutanBO- BoliviaBQ- Bonaire, Sint Eustatius and SabaBA- Bosnia and HerzegovinaBW- BotswanaBV- Bouvet IslandBR- BrazilIO- British Indian Ocean TerritoryBN- BruneiBG- BulgariaBF- Burkina FasoBI- BurundiCV- Cabo VerdeKH- CambodiaCM- CameroonCA- CanadaKY- Cayman IslandsCF- Central African RepublicTD- ChadCL- ChileCN- ChinaCX- Christmas IslandCC- Cocos (Keeling) IslandsCO- ColombiaKM- ComorosCG- CongoCD- Congo (the Democratic Republic of the)CK- Cook IslandsCR- Costa RicaCI- Côte d'IvoireHR- CroatiaCU- CubaCW- CuraçaoCY- CyprusCZ- CzechiaDK- DenmarkDJ- DjiboutiDM- DominicaDO- Dominican RepublicEC- EcuadorEG- EgyptSV- El SalvadorGQ- Equatorial GuineaER- EritreaEE- EstoniaSZ- EswatiniET- EthiopiaFK- Falkland Islands (Malvinas)FO- Faroe IslandsFJ- FijiFI- FinlandFR- FranceGF- French GuianaPF- French PolynesiaTF- French Southern TerritoriesGA- GabonGM- GambiaGE- GeorgiaDE- GermanyGH- GhanaGI- GibraltarGR- GreeceGL- GreenlandGD- GrenadaGP- GuadeloupeGU- GuamGT- GuatemalaGG- GuernseyGN- GuineaGW- Guinea-BissauGY- GuyanaHT- HaitiHM- Heard Island and McDonald IslandsVA- Holy SeeHN- HondurasHK- Hong KongHU- HungaryIS- IcelandIN- IndiaID- IndonesiaIR- IranIQ- IraqIE- IrelandIM- Isle of ManIL- IsraelIT- ItalyJM- JamaicaJP- JapanJE- JerseyJO- JordanKZ- KazakhstanKE- KenyaKI- KiribatiKW- KuwaitKG- KyrgyzstanLA- LaosLV- LatviaLB- LebanonLS- LesothoLR- LiberiaLY- LibyaLI- LiechtensteinLT- LithuaniaLU- LuxembourgMO- MacaoMG- MadagascarMW- MalawiMY- MalaysiaMV- MaldivesML- MaliMT- MaltaMH- Marshall IslandsMQ- MartiniqueMR- MauritaniaMU- MauritiusYT- MayotteMX- MexicoFM- Micronesia (Federated States of)MD- MoldovaMC- MonacoMN- MongoliaME- MontenegroMS- MontserratMA- MoroccoMZ- MozambiqueMM- MyanmarNA- NamibiaNR- NauruNP- NepalNL- NetherlandsNC- New CaledoniaNZ- New ZealandNI- NicaraguaNE- NigerNG- NigeriaNU- NiueNF- Norfolk IslandKP- North KoreaMK- North MacedoniaMP- Northern Mariana IslandsNO- NorwayOM- OmanPK- PakistanPW- PalauPS- Palestine, State ofPA- PanamaPG- Papua New GuineaPY- ParaguayPE- PeruPH- PhilippinesPN- PitcairnPL- PolandPT- PortugalPR- Puerto RicoQA- QatarRE- RéunionRO- RomaniaRU- RussiaRW- RwandaBL- Saint BarthélemySH- Saint Helena, Ascension and Tristan da CunhaKN- Saint Kitts and NevisLC- Saint LuciaMF- Saint Martin (French part)PM- Saint Pierre and MiquelonVC- Saint Vincent and the GrenadinesWS- SamoaSM- San MarinoST- Sao Tome and PrincipeSA- Saudi ArabiaSN- SenegalRS- SerbiaSC- SeychellesSL- Sierra LeoneSG- SingaporeSX- Sint Maarten (Dutch part)SK- SlovakiaSI- SloveniaSB- Solomon IslandsSO- SomaliaZA- South AfricaGS- South Georgia and the South Sandwich IslandsKR- South KoreaSS- South SudanES- SpainLK- Sri LankaSD- SudanSR- SurinameSJ- Svalbard and Jan MayenSE- SwedenCH- SwitzerlandSY- SyriaTW- TaiwanTJ- TajikistanTZ- TanzaniaTH- ThailandTL- Timor-LesteTG- TogoTK- TokelauTO- TongaTT- Trinidad and TobagoTN- TunisiaTR- TurkeyTM- TurkmenistanTC- Turks and Caicos IslandsTV- TuvaluUG- UgandaUA- UkraineAE- United Arab EmiratesGB- United KingdomUM- United States Minor Outlying IslandsUS- United States of AmericaUY- UruguayUZ- UzbekistanVU- VanuatuVE- VenezuelaVN- VietnamVG- Virgin Islands (British)VI- Virgin Islands (U.S.)WF- Wallis and FutunaEH- Western SaharaYE- YemenZM- ZambiaZW- Zimbabwe.
285 286 287 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 285 def country @country end |
#country_subdivision ⇒ String (readonly)
Returns The address's state or region.
34 35 36 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 34 def country_subdivision @country_subdivision end |
#created_at ⇒ DateTime (readonly)
Returns The datetime that this object was created by Merge.
18 19 20 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 18 def created_at @created_at end |
#modified_at ⇒ DateTime (readonly)
Returns The datetime that this object was modified by Merge.
20 21 22 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 20 def modified_at @modified_at end |
#state ⇒ Object (readonly)
32 33 34 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 32 def state @state end |
#street_1 ⇒ String (readonly)
Returns Line 1 of the address's street.
26 27 28 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 26 def street_1 @street_1 end |
#street_2 ⇒ String (readonly)
Returns Line 2 of the address's street.
28 29 30 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 28 def street_2 @street_2 end |
#type ⇒ Merge::Accounting::AddressTypeEnum (readonly)
Returns The address type.
BILLING- BILLINGSHIPPING- SHIPPING.
24 25 26 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 24 def type @type end |
#zip_code ⇒ String (readonly)
Returns The address's zip code.
287 288 289 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 287 def zip_code @zip_code end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::Address
Deserialize a JSON object to an instance of Address
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 592 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) created_at = (DateTime.parse(parsed_json["created_at"]) unless parsed_json["created_at"].nil?) modified_at = (DateTime.parse(parsed_json["modified_at"]) unless parsed_json["modified_at"].nil?) type = parsed_json["type"] street_1 = parsed_json["street_1"] street_2 = parsed_json["street_2"] city = parsed_json["city"] state = parsed_json["state"] country_subdivision = parsed_json["country_subdivision"] country = parsed_json["country"] zip_code = parsed_json["zip_code"] new( created_at: created_at, modified_at: modified_at, type: type, street_1: street_1, street_2: street_2, city: city, state: state, country_subdivision: country_subdivision, country: country, zip_code: zip_code, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
633 634 635 636 637 638 639 640 641 642 643 644 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 633 def self.validate_raw(obj:) obj.created_at&.is_a?(DateTime) != false || raise("Passed value for field obj.created_at is not the expected type, validation failed.") obj.modified_at&.is_a?(DateTime) != false || raise("Passed value for field obj.modified_at is not the expected type, validation failed.") obj.type&.is_a?(Merge::Accounting::AddressTypeEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.street_1&.is_a?(String) != false || raise("Passed value for field obj.street_1 is not the expected type, validation failed.") obj.street_2&.is_a?(String) != false || raise("Passed value for field obj.street_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?(Object) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") obj.country_subdivision&.is_a?(String) != false || raise("Passed value for field obj.country_subdivision is not the expected type, validation failed.") obj.country&.is_a?(Merge::Accounting::CountryEnum) != false || raise("Passed value for field obj.country 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.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Address to a JSON object
623 624 625 |
# File 'lib/merge_ruby_client/accounting/types/address.rb', line 623 def to_json(*_args) @_field_set&.to_json end |