Class: Paid::Agent
- Inherits:
-
Object
- Object
- Paid::Agent
- Defined in:
- lib/paid_ruby/types/agent.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
- #active ⇒ Boolean readonly
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #agent_attributes ⇒ Array<Paid::AgentAttribute> readonly
- #agent_code ⇒ String readonly
- #description ⇒ String readonly
- #external_id ⇒ String readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
- #organization_id ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id:, external_id: OMIT, organization_id:, name:, description: OMIT, active:, agent_code: OMIT, agent_attributes: OMIT, additional_properties: nil) ⇒ Paid::Agent constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, external_id: OMIT, organization_id:, name:, description: OMIT, active:, agent_code: OMIT, agent_attributes: OMIT, additional_properties: nil) ⇒ Paid::Agent
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/paid_ruby/types/agent.rb', line 42 def initialize(id:, external_id: OMIT, organization_id:, name:, description: OMIT, active:, agent_code: OMIT, agent_attributes: OMIT, additional_properties: nil) @id = id @external_id = external_id if external_id != OMIT @organization_id = organization_id @name = name @description = description if description != OMIT @active = active @agent_code = agent_code if agent_code != OMIT @agent_attributes = agent_attributes if agent_attributes != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "externalId": external_id, "organizationId": organization_id, "name": name, "description": description, "active": active, "agentCode": agent_code, "agentAttributes": agent_attributes }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#active ⇒ Boolean (readonly)
19 20 21 |
# File 'lib/paid_ruby/types/agent.rb', line 19 def active @active end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
25 26 27 |
# File 'lib/paid_ruby/types/agent.rb', line 25 def additional_properties @additional_properties end |
#agent_attributes ⇒ Array<Paid::AgentAttribute> (readonly)
23 24 25 |
# File 'lib/paid_ruby/types/agent.rb', line 23 def agent_attributes @agent_attributes end |
#agent_code ⇒ String (readonly)
21 22 23 |
# File 'lib/paid_ruby/types/agent.rb', line 21 def agent_code @agent_code end |
#description ⇒ String (readonly)
17 18 19 |
# File 'lib/paid_ruby/types/agent.rb', line 17 def description @description end |
#external_id ⇒ String (readonly)
11 12 13 |
# File 'lib/paid_ruby/types/agent.rb', line 11 def external_id @external_id end |
#id ⇒ String (readonly)
9 10 11 |
# File 'lib/paid_ruby/types/agent.rb', line 9 def id @id end |
#name ⇒ String (readonly)
15 16 17 |
# File 'lib/paid_ruby/types/agent.rb', line 15 def name @name end |
#organization_id ⇒ String (readonly)
13 14 15 |
# File 'lib/paid_ruby/types/agent.rb', line 13 def organization_id @organization_id end |
Class Method Details
.from_json(json_object:) ⇒ Paid::Agent
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/paid_ruby/types/agent.rb', line 60 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] external_id = parsed_json["externalId"] organization_id = parsed_json["organizationId"] name = parsed_json["name"] description = parsed_json["description"] 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( id: id, external_id: external_id, organization_id: organization_id, name: name, description: description, active: active, agent_code: agent_code, agent_attributes: agent_attributes, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/paid_ruby/types/agent.rb', line 98 def self.validate_raw(obj:) obj.id.is_a?(String) != false || raise("Passed value for field obj.id 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.organization_id.is_a?(String) != false || raise("Passed value for field obj.organization_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.") 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_json ⇒ String
89 90 91 |
# File 'lib/paid_ruby/types/agent.rb', line 89 def to_json @_field_set&.to_json end |