Class: Hook0::Generated::ServiceToken
- Inherits:
-
Object
- Object
- Hook0::Generated::ServiceToken
- Defined in:
- lib/hook0/generated/models.rb
Overview
The ServiceToken the API declares.
Instance Attribute Summary collapse
-
#biscuit ⇒ Object
readonly
Returns the value of attribute biscuit.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#token_id ⇒ Object
readonly
Returns the value of attribute token_id.
Class Method Summary collapse
-
.from_json(value) ⇒ ServiceToken
Read one out of what the API answered.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
Whether that value carries the same members as this one.
-
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
-
#initialize(biscuit:, created_at:, name:, token_id:) ⇒ ServiceToken
constructor
A new instance of ServiceToken.
-
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
Constructor Details
#initialize(biscuit:, created_at:, name:, token_id:) ⇒ ServiceToken
Returns a new instance of ServiceToken.
2635 2636 2637 2638 2639 2640 2641 |
# File 'lib/hook0/generated/models.rb', line 2635 def initialize(biscuit:, created_at:, name:, token_id:) @biscuit = biscuit @created_at = created_at @name = name @token_id = token_id freeze end |
Instance Attribute Details
#biscuit ⇒ Object (readonly)
Returns the value of attribute biscuit.
2626 2627 2628 |
# File 'lib/hook0/generated/models.rb', line 2626 def biscuit @biscuit end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
2626 2627 2628 |
# File 'lib/hook0/generated/models.rb', line 2626 def created_at @created_at end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2626 2627 2628 |
# File 'lib/hook0/generated/models.rb', line 2626 def name @name end |
#token_id ⇒ Object (readonly)
Returns the value of attribute token_id.
2626 2627 2628 |
# File 'lib/hook0/generated/models.rb', line 2626 def token_id @token_id end |
Class Method Details
.from_json(value) ⇒ ServiceToken
Read one out of what the API answered.
2647 2648 2649 2650 2651 2652 2653 2654 2655 |
# File 'lib/hook0/generated/models.rb', line 2647 def self.from_json(value) fields = Runtime.as_fields(value, "ServiceToken") new( biscuit: Runtime.read(fields, "biscuit", Runtime::TEXT), created_at: Runtime.read(fields, "created_at", Runtime::DATE_TIME), name: Runtime.read(fields, "name", Runtime::TEXT), token_id: Runtime.read(fields, "token_id", Runtime::UUID) ) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
Whether that value carries the same members as this one.
2673 2674 2675 |
# File 'lib/hook0/generated/models.rb', line 2673 def ==(other) other.is_a?(ServiceToken) && to_h == other.to_h end |
#hash ⇒ Integer
A value two equal instances share, so that either may key a hash.
2681 2682 2683 |
# File 'lib/hook0/generated/models.rb', line 2681 def hash to_h.hash end |
#to_h ⇒ Hash{String => Object}
Write one back the way the API reads it.
2660 2661 2662 2663 2664 2665 2666 2667 |
# File 'lib/hook0/generated/models.rb', line 2660 def to_h out = {} out["biscuit"] = @biscuit out["created_at"] = Runtime.moment(@created_at) out["name"] = @name out["token_id"] = @token_id out end |