Class: ApolloDeploySignalSdkRails::WebhookTransformationSerializable

Inherits:
Object
  • Object
show all
Defined in:
lib/apollo_deploy_signal_sdk_rails/types.rb

Overview

Schema type: WebhookTransformationSerializable

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, from: nil, to: nil, field: nil, value: nil, template: nil) ⇒ WebhookTransformationSerializable

Returns a new instance of WebhookTransformationSerializable.

Parameters:

  • type (String)

    , from [String, nil], to [String, nil], field [String, nil], value [String, nil], template [String, nil]



3212
3213
3214
3215
3216
3217
3218
3219
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3212

def initialize(type: , from: nil, to: nil, field: nil, value: nil, template: nil)
  @type = type
  @from = from
  @to = to
  @field = field
  @value = value
  @template = template
end

Instance Attribute Details

#fieldString?

Returns:

  • (String, nil)


3205
3206
3207
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3205

def field
  @field
end

#fromString?

Returns:

  • (String, nil)


3201
3202
3203
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3201

def from
  @from
end

#templateString?

Returns:

  • (String, nil)


3209
3210
3211
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3209

def template
  @template
end

#toString?

Returns:

  • (String, nil)


3203
3204
3205
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3203

def to
  @to
end

#typeString

Returns:

  • (String)


3199
3200
3201
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3199

def type
  @type
end

#valueString?

Returns:

  • (String, nil)


3207
3208
3209
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3207

def value
  @value
end

Class Method Details

.from_json(attributes) ⇒ WebhookTransformationSerializable

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3236

def self.from_json(attributes)
  return nil unless attributes.is_a?(Hash)

  new(
    type: attributes.key?("type") ? attributes["type"] : attributes[:type],
    from: attributes.key?("from") ? attributes["from"] : attributes[:from],
    to: attributes.key?("to") ? attributes["to"] : attributes[:to],
    field: attributes.key?("field") ? attributes["field"] : attributes[:field],
    value: attributes.key?("value") ? attributes["value"] : attributes[:value],
    template: attributes.key?("template") ? attributes["template"] : attributes[:template],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 3222

def to_h
  {
    type: @type,
    from: @from,
    to: @to,
    field: @field,
    value: @value,
    template: @template,
  }.compact
end