Class: Hook0::Generated::Organization
- Inherits:
-
Object
- Object
- Hook0::Generated::Organization
- Defined in:
- lib/hook0/generated/models.rb
Overview
The Organization the API declares.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#organization_id ⇒ Object
readonly
Returns the value of attribute organization_id.
-
#plan ⇒ Object
readonly
Returns the value of attribute plan.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Class Method Summary collapse
-
.from_json(value) ⇒ Organization
Read one out of what the API answered.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Whether that value carries the same members as this one.
-
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
-
#initialize(name:, organization_id:, role:, plan: nil) ⇒ Organization
constructor
A new instance of Organization.
-
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
Constructor Details
#initialize(name:, organization_id:, role:, plan: nil) ⇒ Organization
Returns a new instance of Organization.
1469 1470 1471 1472 1473 1474 1475 |
# File 'lib/hook0/generated/models.rb', line 1469 def initialize(name:, organization_id:, role:, plan: nil) @name = name @organization_id = organization_id @role = role @plan = plan freeze end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
1460 1461 1462 |
# File 'lib/hook0/generated/models.rb', line 1460 def name @name end |
#organization_id ⇒ Object (readonly)
Returns the value of attribute organization_id.
1460 1461 1462 |
# File 'lib/hook0/generated/models.rb', line 1460 def organization_id @organization_id end |
#plan ⇒ Object (readonly)
Returns the value of attribute plan.
1460 1461 1462 |
# File 'lib/hook0/generated/models.rb', line 1460 def plan @plan end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
1460 1461 1462 |
# File 'lib/hook0/generated/models.rb', line 1460 def role @role end |
Class Method Details
.from_json(value) ⇒ Organization
Read one out of what the API answered.
1481 1482 1483 1484 1485 1486 1487 1488 1489 |
# File 'lib/hook0/generated/models.rb', line 1481 def self.from_json(value) fields = Runtime.as_fields(value, "Organization") new( name: Runtime.read(fields, "name", Runtime::TEXT), organization_id: Runtime.read(fields, "organization_id", Runtime::UUID), role: Runtime.read(fields, "role", Runtime::TEXT), plan: Runtime.maybe(fields, "plan", OrganizationPlan.method(:from_json)) ) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Whether that value carries the same members as this one.
1507 1508 1509 |
# File 'lib/hook0/generated/models.rb', line 1507 def ==(other) other.is_a?(Organization) && to_h == other.to_h end |
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
1515 1516 1517 |
# File 'lib/hook0/generated/models.rb', line 1515 def hash to_h.hash end |
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
1494 1495 1496 1497 1498 1499 1500 1501 |
# File 'lib/hook0/generated/models.rb', line 1494 def to_h out = {} out["name"] = @name out["organization_id"] = @organization_id out["role"] = @role out["plan"] = @plan.to_h unless @plan.nil? out end |