Class: ApolloDeploySignalSdkRails::StreamEventResponse

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

Overview

Schema type: StreamEventResponse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, email_id:, occurred_at:, data: nil) ⇒ StreamEventResponse

Returns a new instance of StreamEventResponse.

Parameters:

  • type (String)

    , email_id [String], occurred_at [String], data [Hash=> String]



639
640
641
642
643
644
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 639

def initialize(type: , email_id: , occurred_at: , data: nil)
  @type = type
  @email_id = email_id
  @occurred_at = occurred_at
  @data = data
end

Instance Attribute Details

#dataHash{String => String}

Returns:

  • (Hash{String => String})


636
637
638
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 636

def data
  @data
end

#email_idString

Returns:

  • (String)


632
633
634
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 632

def email_id
  @email_id
end

#occurred_atString

Returns:

  • (String)


634
635
636
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 634

def occurred_at
  @occurred_at
end

#typeString

Returns:

  • (String)


630
631
632
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 630

def type
  @type
end

Class Method Details

.from_json(attributes) ⇒ StreamEventResponse

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



659
660
661
662
663
664
665
666
667
668
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 659

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

  new(
    type: attributes.key?("type") ? attributes["type"] : attributes[:type],
    email_id: attributes.key?("emailId") ? attributes["emailId"] : attributes[:email_id],
    occurred_at: attributes.key?("occurredAt") ? attributes["occurredAt"] : attributes[:occurred_at],
    data: attributes.key?("data") ? attributes["data"] : attributes[:data],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



647
648
649
650
651
652
653
654
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 647

def to_h
  {
    type: @type,
    email_id: @email_id,
    occurred_at: @occurred_at,
    data: @data,
  }.compact
end