Class: Hook0::Generated::OrganizationInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/hook0/generated/models.rb

Overview

The OrganizationInfo the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(consumption:, name:, onboarding_steps:, organization_id:, quotas:, users:, plan: nil) ⇒ OrganizationInfo

Returns a new instance of OrganizationInfo.

Parameters:



1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
# File 'lib/hook0/generated/models.rb', line 1537

def initialize(consumption:, name:, onboarding_steps:, organization_id:, quotas:, users:, plan: nil)
  @consumption = consumption
  @name = name
  @onboarding_steps = onboarding_steps
  @organization_id = organization_id
  @quotas = quotas
  @users = users
  @plan = plan
  freeze
end

Instance Attribute Details

#consumptionObject (readonly)

Returns the value of attribute consumption.



1522
1523
1524
# File 'lib/hook0/generated/models.rb', line 1522

def consumption
  @consumption
end

#nameObject (readonly)

Returns the value of attribute name.



1522
1523
1524
# File 'lib/hook0/generated/models.rb', line 1522

def name
  @name
end

#onboarding_stepsObject (readonly)

Returns the value of attribute onboarding_steps.



1522
1523
1524
# File 'lib/hook0/generated/models.rb', line 1522

def onboarding_steps
  @onboarding_steps
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



1522
1523
1524
# File 'lib/hook0/generated/models.rb', line 1522

def organization_id
  @organization_id
end

#planObject (readonly)

Returns the value of attribute plan.



1522
1523
1524
# File 'lib/hook0/generated/models.rb', line 1522

def plan
  @plan
end

#quotasObject (readonly)

Returns the value of attribute quotas.



1522
1523
1524
# File 'lib/hook0/generated/models.rb', line 1522

def quotas
  @quotas
end

#usersObject (readonly)

Returns the value of attribute users.



1522
1523
1524
# File 'lib/hook0/generated/models.rb', line 1522

def users
  @users
end

Class Method Details

.from_json(value) ⇒ OrganizationInfo

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
# File 'lib/hook0/generated/models.rb', line 1552

def self.from_json(value)
  fields = Runtime.as_fields(value, "OrganizationInfo")
  new(
    consumption: Runtime.read(fields, "consumption", OrganizationInfoConsumption.method(:from_json)),
    name: Runtime.read(fields, "name", Runtime::TEXT),
    onboarding_steps: Runtime.read(
      fields,
      "onboarding_steps",
      OrganizationInfoOnboardingSteps.method(:from_json)
    ),
    organization_id: Runtime.read(fields, "organization_id", Runtime::UUID),
    quotas: Runtime.read(fields, "quotas", OrganizationInfoQuotas.method(:from_json)),
    users: Runtime.read(fields, "users", Runtime.list(OrganizationInfoUsers.method(:from_json))),
    plan: Runtime.maybe(fields, "plan", OrganizationInfoPlan.method(:from_json))
  )
end

Instance Method Details

#==(other) ⇒ Boolean Also known as: eql?

Whether that value carries the same members as this one.

Parameters:

  • other (Object)

Returns:

  • (Boolean)


1588
1589
1590
# File 'lib/hook0/generated/models.rb', line 1588

def ==(other)
  other.is_a?(OrganizationInfo) && to_h == other.to_h
end

#hashInteger

A value two equal instances share, so that either may key a hash.

Returns:

  • (Integer)


1596
1597
1598
# File 'lib/hook0/generated/models.rb', line 1596

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
# File 'lib/hook0/generated/models.rb', line 1572

def to_h
  out = {}
  out["consumption"] = @consumption.to_h
  out["name"] = @name
  out["onboarding_steps"] = @onboarding_steps.to_h
  out["organization_id"] = @organization_id
  out["quotas"] = @quotas.to_h
  out["users"] = @users.map(&:to_h)
  out["plan"] = @plan.to_h unless @plan.nil?
  out
end