Class: Paid::AgentUpdate

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: OMIT, description: OMIT, external_id: OMIT, active: OMIT, agent_code: OMIT, agent_attributes: OMIT, additional_properties: nil) ⇒ Paid::AgentUpdate

Parameters:

  • name (String) (defaults to: OMIT)
  • description (String) (defaults to: OMIT)
  • external_id (String) (defaults to: OMIT)
  • active (Boolean) (defaults to: OMIT)
  • agent_code (String) (defaults to: OMIT)
  • agent_attributes (Array<Paid::AgentAttribute>) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/paid_ruby/types/agent_update.rb', line 36

def initialize(name: OMIT, description: OMIT, external_id: OMIT, active: OMIT, agent_code: OMIT, agent_attributes: OMIT, additional_properties: nil)
  @name = name if name != OMIT
  @description = description if description != OMIT
  @external_id = external_id if external_id != OMIT
  @active = active if active != OMIT
  @agent_code = agent_code if agent_code != OMIT
  @agent_attributes = agent_attributes if agent_attributes != OMIT
  @additional_properties = additional_properties
  @_field_set = { "name": name, "description": description, "externalId": external_id, "active": active, "agentCode": agent_code, "agentAttributes": agent_attributes }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#activeBoolean (readonly)

Returns:

  • (Boolean)


15
16
17
# File 'lib/paid_ruby/types/agent_update.rb', line 15

def active
  @active
end

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



21
22
23
# File 'lib/paid_ruby/types/agent_update.rb', line 21

def additional_properties
  @additional_properties
end

#agent_attributesArray<Paid::AgentAttribute> (readonly)

Returns:



19
20
21
# File 'lib/paid_ruby/types/agent_update.rb', line 19

def agent_attributes
  @agent_attributes
end

#agent_codeString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/paid_ruby/types/agent_update.rb', line 17

def agent_code
  @agent_code
end

#descriptionString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/paid_ruby/types/agent_update.rb', line 11

def description
  @description
end

#external_idString (readonly)

Returns:

  • (String)


13
14
15
# File 'lib/paid_ruby/types/agent_update.rb', line 13

def external_id
  @external_id
end

#nameString (readonly)

Returns:

  • (String)


9
10
11
# File 'lib/paid_ruby/types/agent_update.rb', line 9

def name
  @name
end

Class Method Details

.from_json(json_object:) ⇒ Paid::AgentUpdate

Parameters:

  • json_object (String)

Returns:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/paid_ruby/types/agent_update.rb', line 52

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  description = parsed_json["description"]
  external_id = parsed_json["externalId"]
  active = parsed_json["active"]
  agent_code = parsed_json["agentCode"]
  agent_attributes = parsed_json["agentAttributes"]&.map do | item |
  item = item.to_json
  Paid::AgentAttribute.from_json(json_object: item)
end
  new(
    name: name,
    description: description,
    external_id: external_id,
    active: active,
    agent_code: agent_code,
    agent_attributes: agent_attributes,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


86
87
88
89
90
91
92
93
# File 'lib/paid_ruby/types/agent_update.rb', line 86

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

Instance Method Details

#to_jsonString

Returns:

  • (String)


77
78
79
# File 'lib/paid_ruby/types/agent_update.rb', line 77

def to_json
  @_field_set&.to_json
end