Class: ApolloDeploySignalSdkRails::StreamTokenResponse

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

Overview

Schema type: StreamTokenResponse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token:, expires_at:) ⇒ StreamTokenResponse

Returns a new instance of StreamTokenResponse.

Parameters:

  • token (String)

    , expires_at [String]



601
602
603
604
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 601

def initialize(token: , expires_at: )
  @token = token
  @expires_at = expires_at
end

Instance Attribute Details

#expires_atString

Returns:

  • (String)


598
599
600
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 598

def expires_at
  @expires_at
end

#tokenString

Returns:

  • (String)


596
597
598
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 596

def token
  @token
end

Class Method Details

.from_json(attributes) ⇒ StreamTokenResponse

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



617
618
619
620
621
622
623
624
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 617

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

  new(
    token: attributes.key?("token") ? attributes["token"] : attributes[:token],
    expires_at: attributes.key?("expiresAt") ? attributes["expiresAt"] : attributes[:expires_at],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



607
608
609
610
611
612
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 607

def to_h
  {
    token: @token,
    expires_at: @expires_at,
  }.compact
end