Class: Merge::Ticketing::LinkToken

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ticketing/types/link_token.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(link_token:, integration_name: OMIT, magic_link_url: OMIT, additional_properties: nil) ⇒ Merge::Ticketing::LinkToken

Parameters:

  • link_token (String)
  • integration_name (String) (defaults to: OMIT)
  • magic_link_url (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/merge_ruby_client/ticketing/types/link_token.rb', line 28

def initialize(link_token:, integration_name: OMIT, magic_link_url: OMIT, additional_properties: nil)
  @link_token = link_token
  @integration_name = integration_name if integration_name != OMIT
  @magic_link_url = magic_link_url if magic_link_url != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "link_token": link_token,
    "integration_name": integration_name,
    "magic_link_url": magic_link_url
  }.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



16
17
18
# File 'lib/merge_ruby_client/ticketing/types/link_token.rb', line 16

def additional_properties
  @additional_properties
end

#integration_nameString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/merge_ruby_client/ticketing/types/link_token.rb', line 12

def integration_name
  @integration_name
end

Returns:

  • (String)


10
11
12
# File 'lib/merge_ruby_client/ticketing/types/link_token.rb', line 10

def link_token
  @link_token
end

Returns:

  • (String)


14
15
16
# File 'lib/merge_ruby_client/ticketing/types/link_token.rb', line 14

def magic_link_url
  @magic_link_url
end

Class Method Details

.from_json(json_object:) ⇒ Merge::Ticketing::LinkToken

Deserialize a JSON object to an instance of LinkToken

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/merge_ruby_client/ticketing/types/link_token.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  link_token = parsed_json["link_token"]
  integration_name = parsed_json["integration_name"]
  magic_link_url = parsed_json["magic_link_url"]
  new(
    link_token: link_token,
    integration_name: integration_name,
    magic_link_url: magic_link_url,
    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)


73
74
75
76
77
# File 'lib/merge_ruby_client/ticketing/types/link_token.rb', line 73

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

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of LinkToken to a JSON object

Returns:

  • (String)


63
64
65
# File 'lib/merge_ruby_client/ticketing/types/link_token.rb', line 63

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