Class: Hook0::Generated::OrganizationPlan

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

Overview

The OrganizationPlan the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label:, name:) ⇒ OrganizationPlan

Returns a new instance of OrganizationPlan.

Parameters:

  • label (String)

    carries label.

  • name (String)

    carries name.



1926
1927
1928
1929
1930
# File 'lib/hook0/generated/models.rb', line 1926

def initialize(label:, name:)
  @label = label
  @name = name
  freeze
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



1921
1922
1923
# File 'lib/hook0/generated/models.rb', line 1921

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



1921
1922
1923
# File 'lib/hook0/generated/models.rb', line 1921

def name
  @name
end

Class Method Details

.from_json(value) ⇒ OrganizationPlan

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



1936
1937
1938
1939
1940
1941
1942
# File 'lib/hook0/generated/models.rb', line 1936

def self.from_json(value)
  fields = Runtime.as_fields(value, "OrganizationPlan")
  new(
    label: Runtime.read(fields, "label", Runtime::TEXT),
    name: Runtime.read(fields, "name", Runtime::TEXT)
  )
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)


1958
1959
1960
# File 'lib/hook0/generated/models.rb', line 1958

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

#hashInteger

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

Returns:

  • (Integer)


1966
1967
1968
# File 'lib/hook0/generated/models.rb', line 1966

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


1947
1948
1949
1950
1951
1952
# File 'lib/hook0/generated/models.rb', line 1947

def to_h
  out = {}
  out["label"] = @label
  out["name"] = @name
  out
end