Class: Paid::AgentAttribute
- Inherits:
-
Object
- Object
- Paid::AgentAttribute
- Defined in:
- lib/paid_ruby/types/agent_attribute.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.
- #name ⇒ String readonly
- #pricing ⇒ Paid::Pricing readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(name:, active:, pricing:, additional_properties: nil) ⇒ Paid::AgentAttribute constructor
- #to_json ⇒ String
Constructor Details
#initialize(name:, active:, pricing:, additional_properties: nil) ⇒ Paid::AgentAttribute
27 28 29 30 31 32 33 |
# File 'lib/paid_ruby/types/agent_attribute.rb', line 27 def initialize(name:, active:, pricing:, additional_properties: nil) @name = name @active = active @pricing = pricing @additional_properties = additional_properties @_field_set = { "name": name, "active": active, "pricing": pricing } end |
Instance Attribute Details
#active ⇒ Boolean (readonly)
11 12 13 |
# File 'lib/paid_ruby/types/agent_attribute.rb', line 11 def active @active end |
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/paid_ruby/types/agent_attribute.rb', line 15 def additional_properties @additional_properties end |
#name ⇒ String (readonly)
9 10 11 |
# File 'lib/paid_ruby/types/agent_attribute.rb', line 9 def name @name end |
#pricing ⇒ Paid::Pricing (readonly)
13 14 15 |
# File 'lib/paid_ruby/types/agent_attribute.rb', line 13 def pricing @pricing end |
Class Method Details
.from_json(json_object:) ⇒ Paid::AgentAttribute
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/paid_ruby/types/agent_attribute.rb', line 38 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) name = parsed_json["name"] active = parsed_json["active"] unless parsed_json["pricing"].nil? pricing = parsed_json["pricing"].to_json pricing = Paid::Pricing.from_json(json_object: pricing) else pricing = nil end new( name: name, active: active, pricing: pricing, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
68 69 70 71 72 |
# File 'lib/paid_ruby/types/agent_attribute.rb', line 68 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.active.is_a?(Boolean) != false || raise("Passed value for field obj.active is not the expected type, validation failed.") Paid::Pricing.validate_raw(obj: obj.pricing) end |
Instance Method Details
#to_json ⇒ String
59 60 61 |
# File 'lib/paid_ruby/types/agent_attribute.rb', line 59 def to_json @_field_set&.to_json end |