Class: Hook0::Generated::OrganizationInfoConsumption

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

Overview

The OrganizationInfoConsumption the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(applications: nil, events_per_day: nil, members: nil) ⇒ OrganizationInfoConsumption

Returns a new instance of OrganizationInfoConsumption.

Parameters:

  • applications (Integer, nil) (defaults to: nil)

    carries applications.

  • events_per_day (Integer, nil) (defaults to: nil)

    carries events_per_day.

  • members (Integer, nil) (defaults to: nil)

    carries members.



1610
1611
1612
1613
1614
1615
# File 'lib/hook0/generated/models.rb', line 1610

def initialize(applications: nil, events_per_day: nil, members: nil)
  @applications = applications
  @events_per_day = events_per_day
  @members = members
  freeze
end

Instance Attribute Details

#applicationsObject (readonly)

Returns the value of attribute applications.



1603
1604
1605
# File 'lib/hook0/generated/models.rb', line 1603

def applications
  @applications
end

#events_per_dayObject (readonly)

Returns the value of attribute events_per_day.



1603
1604
1605
# File 'lib/hook0/generated/models.rb', line 1603

def events_per_day
  @events_per_day
end

#membersObject (readonly)

Returns the value of attribute members.



1603
1604
1605
# File 'lib/hook0/generated/models.rb', line 1603

def members
  @members
end

Class Method Details

.from_json(value) ⇒ OrganizationInfoConsumption

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



1621
1622
1623
1624
1625
1626
1627
1628
# File 'lib/hook0/generated/models.rb', line 1621

def self.from_json(value)
  fields = Runtime.as_fields(value, "OrganizationInfoConsumption")
  new(
    applications: Runtime.maybe(fields, "applications", Runtime::INTEGER),
    events_per_day: Runtime.maybe(fields, "events_per_day", Runtime::INTEGER),
    members: Runtime.maybe(fields, "members", Runtime::INTEGER)
  )
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)


1645
1646
1647
# File 'lib/hook0/generated/models.rb', line 1645

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

#hashInteger

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

Returns:

  • (Integer)


1653
1654
1655
# File 'lib/hook0/generated/models.rb', line 1653

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


1633
1634
1635
1636
1637
1638
1639
# File 'lib/hook0/generated/models.rb', line 1633

def to_h
  out = {}
  out["applications"] = @applications unless @applications.nil?
  out["events_per_day"] = @events_per_day unless @events_per_day.nil?
  out["members"] = @members unless @members.nil?
  out
end