Class: CandidApiClient::Contracts::V2::Types::ContractsPage

Inherits:
Object
  • Object
show all
Defined in:
lib/candidhealth/contracts/v_2/types/contracts_page.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(items:, prev_page_token: OMIT, next_page_token: OMIT, additional_properties: nil) ⇒ CandidApiClient::Contracts::V2::Types::ContractsPage

Parameters:

  • items (Array<CandidApiClient::Contracts::V2::Types::Contract>)
  • prev_page_token (String) (defaults to: OMIT)
  • next_page_token (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/candidhealth/contracts/v_2/types/contracts_page.rb', line 31

def initialize(items:, prev_page_token: OMIT, next_page_token: OMIT, additional_properties: nil)
  @items = items
  @prev_page_token = prev_page_token if prev_page_token != OMIT
  @next_page_token = next_page_token if next_page_token != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "items": items,
    "prev_page_token": prev_page_token,
    "next_page_token": next_page_token
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



19
20
21
# File 'lib/candidhealth/contracts/v_2/types/contracts_page.rb', line 19

def additional_properties
  @additional_properties
end

#itemsArray<CandidApiClient::Contracts::V2::Types::Contract> (readonly)



13
14
15
# File 'lib/candidhealth/contracts/v_2/types/contracts_page.rb', line 13

def items
  @items
end

#next_page_tokenString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/candidhealth/contracts/v_2/types/contracts_page.rb', line 17

def next_page_token
  @next_page_token
end

#prev_page_tokenString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/candidhealth/contracts/v_2/types/contracts_page.rb', line 15

def prev_page_token
  @prev_page_token
end

Class Method Details

.from_json(json_object:) ⇒ CandidApiClient::Contracts::V2::Types::ContractsPage

Deserialize a JSON object to an instance of ContractsPage

Parameters:

  • json_object (String)

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/candidhealth/contracts/v_2/types/contracts_page.rb', line 49

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  items = parsed_json["items"]&.map do |item|
    item = item.to_json
    CandidApiClient::Contracts::V2::Types::Contract.from_json(json_object: item)
  end
  prev_page_token = struct["prev_page_token"]
  next_page_token = struct["next_page_token"]
  new(
    items: items,
    prev_page_token: prev_page_token,
    next_page_token: next_page_token,
    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.

Parameters:

  • obj (Object)

Returns:

  • (Void)


79
80
81
82
83
# File 'lib/candidhealth/contracts/v_2/types/contracts_page.rb', line 79

def self.validate_raw(obj:)
  obj.items.is_a?(Array) != false || raise("Passed value for field obj.items is not the expected type, validation failed.")
  obj.prev_page_token&.is_a?(String) != false || raise("Passed value for field obj.prev_page_token is not the expected type, validation failed.")
  obj.next_page_token&.is_a?(String) != false || raise("Passed value for field obj.next_page_token is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ContractsPage to a JSON object

Returns:

  • (String)


69
70
71
# File 'lib/candidhealth/contracts/v_2/types/contracts_page.rb', line 69

def to_json(*_args)
  @_field_set&.to_json
end