Class: Hook0::Generated::ApplicationSecret

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

Overview

The ApplicationSecret the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(created_at:, token:, deleted_at: nil, name: nil) ⇒ ApplicationSecret

Returns a new instance of ApplicationSecret.

Parameters:

  • created_at (Time)

    carries created_at.

  • token (String)

    carries token.

  • deleted_at (Time, nil) (defaults to: nil)

    carries deleted_at.

  • name (String, nil) (defaults to: nil)

    carries name.



615
616
617
618
619
620
621
# File 'lib/hook0/generated/models.rb', line 615

def initialize(created_at:, token:, deleted_at: nil, name: nil)
  @created_at = created_at
  @token = token
  @deleted_at = deleted_at
  @name = name
  freeze
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



606
607
608
# File 'lib/hook0/generated/models.rb', line 606

def created_at
  @created_at
end

#deleted_atObject (readonly)

Returns the value of attribute deleted_at.



606
607
608
# File 'lib/hook0/generated/models.rb', line 606

def deleted_at
  @deleted_at
end

#nameObject (readonly)

Returns the value of attribute name.



606
607
608
# File 'lib/hook0/generated/models.rb', line 606

def name
  @name
end

#tokenObject (readonly)

Returns the value of attribute token.



606
607
608
# File 'lib/hook0/generated/models.rb', line 606

def token
  @token
end

Class Method Details

.from_json(value) ⇒ ApplicationSecret

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



627
628
629
630
631
632
633
634
635
# File 'lib/hook0/generated/models.rb', line 627

def self.from_json(value)
  fields = Runtime.as_fields(value, "ApplicationSecret")
  new(
    created_at: Runtime.read(fields, "created_at", Runtime::DATE_TIME),
    token: Runtime.read(fields, "token", Runtime::UUID),
    deleted_at: Runtime.maybe(fields, "deleted_at", Runtime::DATE_TIME),
    name: Runtime.maybe(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)


653
654
655
# File 'lib/hook0/generated/models.rb', line 653

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

#hashInteger

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

Returns:

  • (Integer)


661
662
663
# File 'lib/hook0/generated/models.rb', line 661

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


640
641
642
643
644
645
646
647
# File 'lib/hook0/generated/models.rb', line 640

def to_h
  out = {}
  out["created_at"] = Runtime.moment(@created_at)
  out["token"] = @token
  out["deleted_at"] = Runtime.moment(@deleted_at) unless @deleted_at.nil?
  out["name"] = @name unless @name.nil?
  out
end