Class: ApolloDeploySignalSdk::UpdateContactBody

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

Overview

Schema type: UpdateContactBody

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(first_name: nil, last_name: nil, phone: nil, unsubscribed: nil, properties: nil) ⇒ UpdateContactBody

Returns a new instance of UpdateContactBody.

Parameters:

  • first_name (String, nil) (defaults to: nil)

    , last_name [String, nil], phone [String, nil], unsubscribed [Boolean, nil], properties [Hash=> String]



2825
2826
2827
2828
2829
2830
2831
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2825

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

Instance Attribute Details

#first_nameString?

Returns:

  • (String, nil)


2814
2815
2816
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2814

def first_name
  @first_name
end

#last_nameString?

Returns:

  • (String, nil)


2816
2817
2818
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2816

def last_name
  @last_name
end

#phoneString?

Returns:

  • (String, nil)


2818
2819
2820
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2818

def phone
  @phone
end

#propertiesHash{String => String}

Returns:

  • (Hash{String => String})


2822
2823
2824
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2822

def properties
  @properties
end

#unsubscribedBoolean?

Returns:

  • (Boolean, nil)


2820
2821
2822
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2820

def unsubscribed
  @unsubscribed
end

Class Method Details

.from_json(attributes) ⇒ UpdateContactBody

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2847

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

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

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



2834
2835
2836
2837
2838
2839
2840
2841
2842
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 2834

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