Class: Hook0::Generated::ApplicationPost

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

Overview

The ApplicationPost the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, organization_id:) ⇒ ApplicationPost

Returns a new instance of ApplicationPost.

Parameters:

  • name (String)

    carries name: Name of the application. Length: 2-50 characters.

  • organization_id (String)

    carries organization_id: UUID of the organization this application belongs to.



559
560
561
562
563
# File 'lib/hook0/generated/models.rb', line 559

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



554
555
556
# File 'lib/hook0/generated/models.rb', line 554

def name
  @name
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



554
555
556
# File 'lib/hook0/generated/models.rb', line 554

def organization_id
  @organization_id
end

Class Method Details

.from_json(value) ⇒ ApplicationPost

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



569
570
571
572
573
574
575
# File 'lib/hook0/generated/models.rb', line 569

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


591
592
593
# File 'lib/hook0/generated/models.rb', line 591

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

#hashInteger

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

Returns:

  • (Integer)


599
600
601
# File 'lib/hook0/generated/models.rb', line 599

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


580
581
582
583
584
585
# File 'lib/hook0/generated/models.rb', line 580

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