Class: ApolloDeploySignalSdkRails::CreateContactBody

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

Overview

Schema type: CreateContactBody

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email:, phone: nil, first_name: nil, last_name: nil, unsubscribed: nil, properties: nil, segments: nil, topics: nil) ⇒ CreateContactBody

Returns a new instance of CreateContactBody.

Parameters:

  • email (String)

    , phone [String, nil], first_name [String, nil], last_name [String, nil], unsubscribed [Boolean], properties [Hash=> String], segments [Array], topics [Array]



2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2767

def initialize(email: , phone: nil, first_name: nil, last_name: nil, unsubscribed: nil, properties: nil, segments: nil, topics: nil)
  @email = email
  @phone = phone
  @first_name = first_name
  @last_name = last_name
  @unsubscribed = unsubscribed
  @properties = properties
  @segments = segments
  @topics = topics
end

Instance Attribute Details

#emailString

Returns:

  • (String)


2750
2751
2752
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2750

def email
  @email
end

#first_nameString?

Returns:

  • (String, nil)


2754
2755
2756
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2754

def first_name
  @first_name
end

#last_nameString?

Returns:

  • (String, nil)


2756
2757
2758
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2756

def last_name
  @last_name
end

#phoneString?

Returns:

  • (String, nil)


2752
2753
2754
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2752

def phone
  @phone
end

#propertiesHash{String => String}

Returns:

  • (Hash{String => String})


2760
2761
2762
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2760

def properties
  @properties
end

#segmentsArray<SegmentRef>

Returns:



2762
2763
2764
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2762

def segments
  @segments
end

#topicsArray<TopicSubscriptionBody>

Returns:



2764
2765
2766
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2764

def topics
  @topics
end

#unsubscribedBoolean

Returns:

  • (Boolean)


2758
2759
2760
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2758

def unsubscribed
  @unsubscribed
end

Class Method Details

.from_json(attributes) ⇒ CreateContactBody

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2795

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

  new(
    email: attributes.key?("email") ? attributes["email"] : attributes[:email],
    phone: attributes.key?("phone") ? attributes["phone"] : attributes[:phone],
    first_name: attributes.key?("firstName") ? attributes["firstName"] : attributes[:first_name],
    last_name: attributes.key?("lastName") ? attributes["lastName"] : attributes[:last_name],
    unsubscribed: attributes.key?("unsubscribed") ? attributes["unsubscribed"] : attributes[:unsubscribed],
    properties: attributes.key?("properties") ? attributes["properties"] : attributes[:properties],
    segments: attributes.key?("segments") ? attributes["segments"] : attributes[:segments],
    topics: attributes.key?("topics") ? attributes["topics"] : attributes[:topics],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
# File 'lib/apollo_deploy_signal_sdk_rails/types.rb', line 2779

def to_h
  {
    email: @email,
    phone: @phone,
    first_name: @first_name,
    last_name: @last_name,
    unsubscribed: @unsubscribed,
    properties: @properties,
    segments: @segments,
    topics: @topics,
  }.compact
end