Class: Merge::Hris::PaginatedLocationList
- Inherits:
-
Object
- Object
- Merge::Hris::PaginatedLocationList
- Defined in:
- lib/merge_ruby_client/hris/types/paginated_location_list.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #next_ ⇒ String readonly
- #previous ⇒ String readonly
- #results ⇒ Array<Merge::Hris::Location> readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Hris::PaginatedLocationList
Deserialize a JSON object to an instance of PaginatedLocationList.
-
.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(next_: OMIT, previous: OMIT, results: OMIT, additional_properties: nil) ⇒ Merge::Hris::PaginatedLocationList constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of PaginatedLocationList to a JSON object.
Constructor Details
#initialize(next_: OMIT, previous: OMIT, results: OMIT, additional_properties: nil) ⇒ Merge::Hris::PaginatedLocationList
29 30 31 32 33 34 35 36 37 |
# File 'lib/merge_ruby_client/hris/types/paginated_location_list.rb', line 29 def initialize(next_: OMIT, previous: OMIT, results: OMIT, additional_properties: nil) @next_ = next_ if next_ != OMIT @previous = previous if previous != OMIT @results = results if results != OMIT @additional_properties = additional_properties @_field_set = { "next": next_, "previous": previous, "results": results }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/merge_ruby_client/hris/types/paginated_location_list.rb', line 17 def additional_properties @additional_properties end |
#next_ ⇒ String (readonly)
11 12 13 |
# File 'lib/merge_ruby_client/hris/types/paginated_location_list.rb', line 11 def next_ @next_ end |
#previous ⇒ String (readonly)
13 14 15 |
# File 'lib/merge_ruby_client/hris/types/paginated_location_list.rb', line 13 def previous @previous end |
#results ⇒ Array<Merge::Hris::Location> (readonly)
15 16 17 |
# File 'lib/merge_ruby_client/hris/types/paginated_location_list.rb', line 15 def results @results end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Hris::PaginatedLocationList
Deserialize a JSON object to an instance of PaginatedLocationList
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/merge_ruby_client/hris/types/paginated_location_list.rb', line 43 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) next_ = parsed_json["next"] previous = parsed_json["previous"] results = parsed_json["results"]&.map do |item| item = item.to_json Merge::Hris::Location.from_json(json_object: item) end new( next_: next_, previous: previous, results: results, 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.
73 74 75 76 77 |
# File 'lib/merge_ruby_client/hris/types/paginated_location_list.rb', line 73 def self.validate_raw(obj:) obj.next_&.is_a?(String) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.") obj.previous&.is_a?(String) != false || raise("Passed value for field obj.previous is not the expected type, validation failed.") obj.results&.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of PaginatedLocationList to a JSON object
63 64 65 |
# File 'lib/merge_ruby_client/hris/types/paginated_location_list.rb', line 63 def to_json(*_args) @_field_set&.to_json end |