Class: Paid::OrderLineCreate

Inherits:
Object
  • Object
show all
Defined in:
lib/paid_ruby/types/order_line_create.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent_id: OMIT, agent_external_id: OMIT, name: OMIT, description: OMIT, additional_properties: nil) ⇒ Paid::OrderLineCreate

Parameters:

  • agent_id (String) (defaults to: OMIT)
  • agent_external_id (String) (defaults to: OMIT)
  • name (String) (defaults to: OMIT)
  • description (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



29
30
31
32
33
34
35
36
37
38
# File 'lib/paid_ruby/types/order_line_create.rb', line 29

def initialize(agent_id: OMIT, agent_external_id: OMIT, name: OMIT, description: OMIT, additional_properties: nil)
  @agent_id = agent_id if agent_id != OMIT
  @agent_external_id = agent_external_id if agent_external_id != OMIT
  @name = name if name != OMIT
  @description = description if description != OMIT
  @additional_properties = additional_properties
  @_field_set = { "agentId": agent_id, "agentExternalId": agent_external_id, "name": name, "description": description }.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/paid_ruby/types/order_line_create.rb', line 16

def additional_properties
  @additional_properties
end

#agent_external_idString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/paid_ruby/types/order_line_create.rb', line 10

def agent_external_id
  @agent_external_id
end

#agent_idString (readonly)

Returns:

  • (String)


8
9
10
# File 'lib/paid_ruby/types/order_line_create.rb', line 8

def agent_id
  @agent_id
end

#descriptionString (readonly)

Returns:

  • (String)


14
15
16
# File 'lib/paid_ruby/types/order_line_create.rb', line 14

def description
  @description
end

#nameString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/paid_ruby/types/order_line_create.rb', line 12

def name
  @name
end

Class Method Details

.from_json(json_object:) ⇒ Paid::OrderLineCreate

Parameters:

  • json_object (String)

Returns:



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/paid_ruby/types/order_line_create.rb', line 43

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  agent_id = parsed_json["agentId"]
  agent_external_id = parsed_json["agentExternalId"]
  name = parsed_json["name"]
  description = parsed_json["description"]
  new(
    agent_id: agent_id,
    agent_external_id: agent_external_id,
    name: name,
    description: description,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


70
71
72
73
74
75
# File 'lib/paid_ruby/types/order_line_create.rb', line 70

def self.validate_raw(obj:)
  obj.agent_id&.is_a?(String) != false || raise("Passed value for field obj.agent_id is not the expected type, validation failed.")
  obj.agent_external_id&.is_a?(String) != false || raise("Passed value for field obj.agent_external_id 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.description&.is_a?(String) != false || raise("Passed value for field obj.description is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


61
62
63
# File 'lib/paid_ruby/types/order_line_create.rb', line 61

def to_json
  @_field_set&.to_json
end