Class: Merge::Hris::Location
- Inherits:
-
Object
- Object
- Merge::Hris::Location
- Defined in:
- lib/merge_ruby_client/hris/types/location.rb
Overview
# The Location Object
### Description
The `Location` object is used to represent an address that can be associated
with an employee.
### Usage Example
Fetch from the `LIST Locations` endpoint and filter by `ID` to show all office
locations.
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 location’s city.
-
#country ⇒ Merge::Hris::CountryEnum
readonly
The location’s country.
-
#created_at ⇒ DateTime
readonly
The datetime that this object was created by Merge.
- #field_mappings ⇒ Hash{String => Object} readonly
- #id ⇒ String readonly
-
#location_type ⇒ Merge::Hris::LocationTypeEnum
readonly
The location’s type.
-
#modified_at ⇒ DateTime
readonly
The datetime that this object was modified by Merge.
-
#name ⇒ String
readonly
The location’s name.
-
#phone_number ⇒ String
readonly
The location’s phone number.
- #remote_data ⇒ Array<Merge::Hris::RemoteData> readonly
-
#remote_id ⇒ String
readonly
The third-party API ID of the matching object.
-
#remote_was_deleted ⇒ Boolean
readonly
Indicates whether or not this object has been deleted in the third party platform.
-
#state ⇒ String
readonly
The location’s state.
-
#street_1 ⇒ String
readonly
Line 1 of the location’s street address.
-
#street_2 ⇒ String
readonly
Line 2 of the location’s street address.
-
#zip_code ⇒ String
readonly
The location’s zip code or postal code.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Hris::Location
Deserialize a JSON object to an instance of Location.
-
.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(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, name: OMIT, phone_number: OMIT, street_1: OMIT, street_2: OMIT, city: OMIT, state: OMIT, zip_code: OMIT, country: OMIT, location_type: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Hris::Location constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of Location to a JSON object.
Constructor Details
#initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, name: OMIT, phone_number: OMIT, street_1: OMIT, street_2: OMIT, city: OMIT, state: OMIT, zip_code: OMIT, country: OMIT, location_type: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) ⇒ Merge::Hris::Location
582 583 584 585 586 587 588 589 590 591 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 619 620 621 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 582 def initialize(id: OMIT, remote_id: OMIT, created_at: OMIT, modified_at: OMIT, name: OMIT, phone_number: OMIT, street_1: OMIT, street_2: OMIT, city: OMIT, state: OMIT, zip_code: OMIT, country: OMIT, location_type: OMIT, remote_was_deleted: OMIT, field_mappings: OMIT, remote_data: OMIT, additional_properties: nil) @id = id if id != OMIT @remote_id = remote_id if remote_id != OMIT @created_at = created_at if created_at != OMIT @modified_at = modified_at if modified_at != OMIT @name = name if name != OMIT @phone_number = phone_number if phone_number != 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 @zip_code = zip_code if zip_code != OMIT @country = country if country != OMIT @location_type = location_type if location_type != OMIT @remote_was_deleted = remote_was_deleted if remote_was_deleted != OMIT @field_mappings = field_mappings if field_mappings != OMIT @remote_data = remote_data if remote_data != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "remote_id": remote_id, "created_at": created_at, "modified_at": modified_at, "name": name, "phone_number": phone_number, "street_1": street_1, "street_2": street_2, "city": city, "state": state, "zip_code": zip_code, "country": country, "location_type": location_type, "remote_was_deleted": remote_was_deleted, "field_mappings": field_mappings, "remote_data": remote_data }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
305 306 307 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 305 def additional_properties @additional_properties end |
#city ⇒ String (readonly)
Returns The location’s city.
37 38 39 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 37 def city @city end |
#country ⇒ Merge::Hris::CountryEnum (readonly)
Returns The location’s country.
-
‘AF` - Afghanistan
-
‘AX` - Åland Islands
-
‘AL` - Albania
-
‘DZ` - Algeria
-
‘AS` - American Samoa
-
‘AD` - Andorra
-
‘AO` - Angola
-
‘AI` - Anguilla
-
‘AQ` - Antarctica
-
‘AG` - Antigua and Barbuda
-
‘AR` - Argentina
-
‘AM` - Armenia
-
‘AW` - Aruba
-
‘AU` - Australia
-
‘AT` - Austria
-
‘AZ` - Azerbaijan
-
‘BS` - Bahamas
-
‘BH` - Bahrain
-
‘BD` - Bangladesh
-
‘BB` - Barbados
-
‘BY` - Belarus
-
‘BE` - Belgium
-
‘BZ` - Belize
-
‘BJ` - Benin
-
‘BM` - Bermuda
-
‘BT` - Bhutan
-
‘BO` - Bolivia
-
‘BQ` - Bonaire, Sint Eustatius and Saba
-
‘BA` - Bosnia and Herzegovina
-
‘BW` - Botswana
-
‘BV` - Bouvet Island
-
‘BR` - Brazil
-
‘IO` - British Indian Ocean Territory
-
‘BN` - Brunei
-
‘BG` - Bulgaria
-
‘BF` - Burkina Faso
-
‘BI` - Burundi
-
‘CV` - Cabo Verde
-
‘KH` - Cambodia
-
‘CM` - Cameroon
-
‘CA` - Canada
-
‘KY` - Cayman Islands
-
‘CF` - Central African Republic
-
‘TD` - Chad
-
‘CL` - Chile
-
‘CN` - China
-
‘CX` - Christmas Island
-
‘CC` - Cocos (Keeling) Islands
-
‘CO` - Colombia
-
‘KM` - Comoros
-
‘CG` - Congo
-
‘CD` - Congo (the Democratic Republic of the)
-
‘CK` - Cook Islands
-
‘CR` - Costa Rica
-
‘CI` - Côte d’Ivoire
-
‘HR` - Croatia
-
‘CU` - Cuba
-
‘CW` - Curaçao
-
‘CY` - Cyprus
-
‘CZ` - Czechia
-
‘DK` - Denmark
-
‘DJ` - Djibouti
-
‘DM` - Dominica
-
‘DO` - Dominican Republic
-
‘EC` - Ecuador
-
‘EG` - Egypt
-
‘SV` - El Salvador
-
‘GQ` - Equatorial Guinea
-
‘ER` - Eritrea
-
‘EE` - Estonia
-
‘SZ` - Eswatini
-
‘ET` - Ethiopia
-
‘FK` - Falkland Islands (Malvinas)
-
‘FO` - Faroe Islands
-
‘FJ` - Fiji
-
‘FI` - Finland
-
‘FR` - France
-
‘GF` - French Guiana
-
‘PF` - French Polynesia
-
‘TF` - French Southern Territories
-
‘GA` - Gabon
-
‘GM` - Gambia
-
‘GE` - Georgia
-
‘DE` - Germany
-
‘GH` - Ghana
-
‘GI` - Gibraltar
-
‘GR` - Greece
-
‘GL` - Greenland
-
‘GD` - Grenada
-
‘GP` - Guadeloupe
-
‘GU` - Guam
-
‘GT` - Guatemala
-
‘GG` - Guernsey
-
‘GN` - Guinea
-
‘GW` - Guinea-Bissau
-
‘GY` - Guyana
-
‘HT` - Haiti
-
‘HM` - Heard Island and McDonald Islands
-
‘VA` - Holy See
-
‘HN` - Honduras
-
‘HK` - Hong Kong
-
‘HU` - Hungary
-
‘IS` - Iceland
-
‘IN` - India
-
‘ID` - Indonesia
-
‘IR` - Iran
-
‘IQ` - Iraq
-
‘IE` - Ireland
-
‘IM` - Isle of Man
-
‘IL` - Israel
-
‘IT` - Italy
-
‘JM` - Jamaica
-
‘JP` - Japan
-
‘JE` - Jersey
-
‘JO` - Jordan
-
‘KZ` - Kazakhstan
-
‘KE` - Kenya
-
‘KI` - Kiribati
-
‘KW` - Kuwait
-
‘KG` - Kyrgyzstan
-
‘LA` - Laos
-
‘LV` - Latvia
-
‘LB` - Lebanon
-
‘LS` - Lesotho
-
‘LR` - Liberia
-
‘LY` - Libya
-
‘LI` - Liechtenstein
-
‘LT` - Lithuania
-
‘LU` - Luxembourg
-
‘MO` - Macao
-
‘MG` - Madagascar
-
‘MW` - Malawi
-
‘MY` - Malaysia
-
‘MV` - Maldives
-
‘ML` - Mali
-
‘MT` - Malta
-
‘MH` - Marshall Islands
-
‘MQ` - Martinique
-
‘MR` - Mauritania
-
‘MU` - Mauritius
-
‘YT` - Mayotte
-
‘MX` - Mexico
-
‘FM` - Micronesia (Federated States of)
-
‘MD` - Moldova
-
‘MC` - Monaco
-
‘MN` - Mongolia
-
‘ME` - Montenegro
-
‘MS` - Montserrat
-
‘MA` - Morocco
-
‘MZ` - Mozambique
-
‘MM` - Myanmar
-
‘NA` - Namibia
-
‘NR` - Nauru
-
‘NP` - Nepal
-
‘NL` - Netherlands
-
‘NC` - New Caledonia
-
‘NZ` - New Zealand
-
‘NI` - Nicaragua
-
‘NE` - Niger
-
‘NG` - Nigeria
-
‘NU` - Niue
-
‘NF` - Norfolk Island
-
‘KP` - North Korea
-
‘MK` - North Macedonia
-
‘MP` - Northern Mariana Islands
-
‘NO` - Norway
-
‘OM` - Oman
-
‘PK` - Pakistan
-
‘PW` - Palau
-
‘PS` - Palestine, State of
-
‘PA` - Panama
-
‘PG` - Papua New Guinea
-
‘PY` - Paraguay
-
‘PE` - Peru
-
‘PH` - Philippines
-
‘PN` - Pitcairn
-
‘PL` - Poland
-
‘PT` - Portugal
-
‘PR` - Puerto Rico
-
‘QA` - Qatar
-
‘RE` - Réunion
-
‘RO` - Romania
-
‘RU` - Russia
-
‘RW` - Rwanda
-
‘BL` - Saint Barthélemy
-
‘SH` - Saint Helena, Ascension and Tristan da Cunha
-
‘KN` - Saint Kitts and Nevis
-
‘LC` - Saint Lucia
-
‘MF` - Saint Martin (French part)
-
‘PM` - Saint Pierre and Miquelon
-
‘VC` - Saint Vincent and the Grenadines
-
‘WS` - Samoa
-
‘SM` - San Marino
-
‘ST` - Sao Tome and Principe
-
‘SA` - Saudi Arabia
-
‘SN` - Senegal
-
‘RS` - Serbia
-
‘SC` - Seychelles
-
‘SL` - Sierra Leone
-
‘SG` - Singapore
-
‘SX` - Sint Maarten (Dutch part)
-
‘SK` - Slovakia
-
‘SI` - Slovenia
-
‘SB` - Solomon Islands
-
‘SO` - Somalia
-
‘ZA` - South Africa
-
‘GS` - South Georgia and the South Sandwich Islands
-
‘KR` - South Korea
-
‘SS` - South Sudan
-
‘ES` - Spain
-
‘LK` - Sri Lanka
-
‘SD` - Sudan
-
‘SR` - Suriname
-
‘SJ` - Svalbard and Jan Mayen
-
‘SE` - Sweden
-
‘CH` - Switzerland
-
‘SY` - Syria
-
‘TW` - Taiwan
-
‘TJ` - Tajikistan
-
‘TZ` - Tanzania
-
‘TH` - Thailand
-
‘TL` - Timor-Leste
-
‘TG` - Togo
-
‘TK` - Tokelau
-
‘TO` - Tonga
-
‘TT` - Trinidad and Tobago
-
‘TN` - Tunisia
-
‘TR` - Turkey
-
‘TM` - Turkmenistan
-
‘TC` - Turks and Caicos Islands
-
‘TV` - Tuvalu
-
‘UG` - Uganda
-
‘UA` - Ukraine
-
‘AE` - United Arab Emirates
-
‘GB` - United Kingdom
-
‘UM` - United States Minor Outlying Islands
-
‘US` - United States of America
-
‘UY` - Uruguay
-
‘UZ` - Uzbekistan
-
‘VU` - Vanuatu
-
‘VE` - Venezuela
-
‘VN` - Vietnam
-
‘VG` - Virgin Islands (British)
-
‘VI` - Virgin Islands (U.S.)
-
‘WF` - Wallis and Futuna
-
‘EH` - Western Sahara
-
‘YE` - Yemen
-
‘ZM` - Zambia
-
‘ZW` - Zimbabwe.
292 293 294 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 292 def country @country end |
#created_at ⇒ DateTime (readonly)
Returns The datetime that this object was created by Merge.
25 26 27 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 25 def created_at @created_at end |
#field_mappings ⇒ Hash{String => Object} (readonly)
301 302 303 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 301 def field_mappings @field_mappings end |
#id ⇒ String (readonly)
21 22 23 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 21 def id @id end |
#location_type ⇒ Merge::Hris::LocationTypeEnum (readonly)
Returns The location’s type. Can be either WORK or HOME
-
‘HOME` - HOME
-
‘WORK` - WORK.
296 297 298 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 296 def location_type @location_type end |
#modified_at ⇒ DateTime (readonly)
Returns The datetime that this object was modified by Merge.
27 28 29 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 27 def modified_at @modified_at end |
#name ⇒ String (readonly)
Returns The location’s name.
29 30 31 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 29 def name @name end |
#phone_number ⇒ String (readonly)
Returns The location’s phone number.
31 32 33 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 31 def phone_number @phone_number end |
#remote_data ⇒ Array<Merge::Hris::RemoteData> (readonly)
303 304 305 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 303 def remote_data @remote_data end |
#remote_id ⇒ String (readonly)
Returns The third-party API ID of the matching object.
23 24 25 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 23 def remote_id @remote_id end |
#remote_was_deleted ⇒ Boolean (readonly)
Returns Indicates whether or not this object has been deleted in the third party platform.
299 300 301 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 299 def remote_was_deleted @remote_was_deleted end |
#state ⇒ String (readonly)
Returns The location’s state. Represents a region if outside of the US.
39 40 41 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 39 def state @state end |
#street_1 ⇒ String (readonly)
Returns Line 1 of the location’s street address.
33 34 35 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 33 def street_1 @street_1 end |
#street_2 ⇒ String (readonly)
Returns Line 2 of the location’s street address.
35 36 37 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 35 def street_2 @street_2 end |
#zip_code ⇒ String (readonly)
Returns The location’s zip code or postal code.
41 42 43 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 41 def zip_code @zip_code end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Hris::Location
Deserialize a JSON object to an instance of Location
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 627 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] remote_id = parsed_json["remote_id"] 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?) name = parsed_json["name"] phone_number = parsed_json["phone_number"] street_1 = parsed_json["street_1"] street_2 = parsed_json["street_2"] city = parsed_json["city"] state = parsed_json["state"] zip_code = parsed_json["zip_code"] country = parsed_json["country"] location_type = parsed_json["location_type"] remote_was_deleted = parsed_json["remote_was_deleted"] field_mappings = parsed_json["field_mappings"] remote_data = parsed_json["remote_data"]&.map do |item| item = item.to_json Merge::Hris::RemoteData.from_json(json_object: item) end new( id: id, remote_id: remote_id, created_at: created_at, modified_at: modified_at, name: name, phone_number: phone_number, street_1: street_1, street_2: street_2, city: city, state: state, zip_code: zip_code, country: country, location_type: location_type, remote_was_deleted: remote_was_deleted, field_mappings: field_mappings, remote_data: remote_data, 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.
683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 683 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.remote_id&.is_a?(String) != false || raise("Passed value for field obj.remote_id is not the expected type, validation failed.") 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.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.phone_number&.is_a?(String) != false || raise("Passed value for field obj.phone_number 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?(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?(Merge::Hris::CountryEnum) != false || raise("Passed value for field obj.country is not the expected type, validation failed.") obj.location_type&.is_a?(Merge::Hris::LocationTypeEnum) != false || raise("Passed value for field obj.location_type is not the expected type, validation failed.") obj.remote_was_deleted&.is_a?(Boolean) != false || raise("Passed value for field obj.remote_was_deleted is not the expected type, validation failed.") obj.field_mappings&.is_a?(Hash) != false || raise("Passed value for field obj.field_mappings is not the expected type, validation failed.") obj.remote_data&.is_a?(Array) != false || raise("Passed value for field obj.remote_data is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of Location to a JSON object
673 674 675 |
# File 'lib/merge_ruby_client/hris/types/location.rb', line 673 def to_json(*_args) @_field_set&.to_json end |