Class: ApolloDeploySignalSdk::SegmentContactResponse

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

Overview

Schema type: SegmentContactResponse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contact_id:, email:, first_name:, last_name:, segments:) ⇒ SegmentContactResponse

Returns a new instance of SegmentContactResponse.

Parameters:

  • contact_id (String)

    , email [String], first_name [String, nil], last_name [String, nil], segments [Array]



2018
2019
2020
2021
2022
2023
2024
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2018

def initialize(contact_id: , email: , first_name: , last_name: , segments: )
  @contact_id = contact_id
  @email = email
  @first_name = first_name
  @last_name = last_name
  @segments = segments
end

Instance Attribute Details

#contact_idString

Returns:

  • (String)


2007
2008
2009
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2007

def contact_id
  @contact_id
end

#emailString

Returns:

  • (String)


2009
2010
2011
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2009

def email
  @email
end

#first_nameString?

Returns:

  • (String, nil)


2011
2012
2013
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2011

def first_name
  @first_name
end

#last_nameString?

Returns:

  • (String, nil)


2013
2014
2015
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2013

def last_name
  @last_name
end

#segmentsArray<String>

Returns:

  • (Array<String>)


2015
2016
2017
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2015

def segments
  @segments
end

Class Method Details

.from_json(attributes) ⇒ SegmentContactResponse

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2040

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

  new(
    contact_id: attributes.key?("contactId") ? attributes["contactId"] : attributes[:contact_id],
    email: attributes.key?("email") ? attributes["email"] : attributes[:email],
    first_name: attributes.key?("firstName") ? attributes["firstName"] : attributes[:first_name],
    last_name: attributes.key?("lastName") ? attributes["lastName"] : attributes[:last_name],
    segments: attributes.key?("segments") ? attributes["segments"] : attributes[:segments],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



2027
2028
2029
2030
2031
2032
2033
2034
2035
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2027

def to_h
  {
    contact_id: @contact_id,
    email: @email,
    first_name: @first_name,
    last_name: @last_name,
    segments: @segments,
  }.compact
end