Class: Hook0::Generated::RequestAttemptSubscription

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

Overview

The RequestAttemptSubscription the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subscription_id:, description: nil) ⇒ RequestAttemptSubscription

Returns a new instance of RequestAttemptSubscription.

Parameters:

  • subscription_id (String)

    carries subscription_id.

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

    carries description.



2500
2501
2502
2503
2504
# File 'lib/hook0/generated/models.rb', line 2500

def initialize(subscription_id:, description: nil)
  @subscription_id = subscription_id
  @description = description
  freeze
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



2495
2496
2497
# File 'lib/hook0/generated/models.rb', line 2495

def description
  @description
end

#subscription_idObject (readonly)

Returns the value of attribute subscription_id.



2495
2496
2497
# File 'lib/hook0/generated/models.rb', line 2495

def subscription_id
  @subscription_id
end

Class Method Details

.from_json(value) ⇒ RequestAttemptSubscription

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



2510
2511
2512
2513
2514
2515
2516
# File 'lib/hook0/generated/models.rb', line 2510

def self.from_json(value)
  fields = Runtime.as_fields(value, "RequestAttemptSubscription")
  new(
    subscription_id: Runtime.read(fields, "subscription_id", Runtime::UUID),
    description: Runtime.maybe(fields, "description", 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)


2532
2533
2534
# File 'lib/hook0/generated/models.rb', line 2532

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

#hashInteger

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

Returns:

  • (Integer)


2540
2541
2542
# File 'lib/hook0/generated/models.rb', line 2540

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


2521
2522
2523
2524
2525
2526
# File 'lib/hook0/generated/models.rb', line 2521

def to_h
  out = {}
  out["subscription_id"] = @subscription_id
  out["description"] = @description unless @description.nil?
  out
end