Class: Hook0::Generated::SubscriptionTarget

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

Overview

The SubscriptionTarget the API declares.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers:, method_:, type:, url:) ⇒ SubscriptionTarget

Returns a new instance of SubscriptionTarget.

Parameters:

  • headers (Object)

    carries headers.

  • method_ (String)

    carries method.

  • type (String)

    carries type.

  • url (String)

    carries url.



3042
3043
3044
3045
3046
3047
3048
# File 'lib/hook0/generated/models.rb', line 3042

def initialize(headers:, method_:, type:, url:)
  @headers = headers
  @method_ = method_
  @type = type
  @url = url
  freeze
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



3033
3034
3035
# File 'lib/hook0/generated/models.rb', line 3033

def headers
  @headers
end

#method_Object (readonly)

Returns the value of attribute method_.



3033
3034
3035
# File 'lib/hook0/generated/models.rb', line 3033

def method_
  @method_
end

#typeObject (readonly)

Returns the value of attribute type.



3033
3034
3035
# File 'lib/hook0/generated/models.rb', line 3033

def type
  @type
end

#urlObject (readonly)

Returns the value of attribute url.



3033
3034
3035
# File 'lib/hook0/generated/models.rb', line 3033

def url
  @url
end

Class Method Details

.from_json(value) ⇒ SubscriptionTarget

Read one out of what the API answered.

Parameters:

  • value (Object)

    the JSON document the API answered

Returns:



3054
3055
3056
3057
3058
3059
3060
3061
3062
# File 'lib/hook0/generated/models.rb', line 3054

def self.from_json(value)
  fields = Runtime.as_fields(value, "SubscriptionTarget")
  new(
    headers: Runtime.read(fields, "headers", Runtime::JSON_VALUE),
    method_: Runtime.read(fields, "method", Runtime::TEXT),
    type: Runtime.read(fields, "type", Runtime::TEXT),
    url: Runtime.read(fields, "url", 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)


3080
3081
3082
# File 'lib/hook0/generated/models.rb', line 3080

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

#hashInteger

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

Returns:

  • (Integer)


3088
3089
3090
# File 'lib/hook0/generated/models.rb', line 3088

def hash
  to_h.hash
end

#to_hHash{String => Object}

Write one back the way the API reads it.

Returns:

  • (Hash{String => Object})


3067
3068
3069
3070
3071
3072
3073
3074
# File 'lib/hook0/generated/models.rb', line 3067

def to_h
  out = {}
  out["headers"] = @headers
  out["method"] = @method_
  out["type"] = @type
  out["url"] = @url
  out
end