Class: ApolloDeploySignalSdk::SegmentResponse

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

Overview

Schema type: SegmentResponse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object: nil, id:, name:, project_id:, created_at:, contact_count: nil, unsubscribed_count: nil) ⇒ SegmentResponse

Returns a new instance of SegmentResponse.

Parameters:

  • object (String) (defaults to: nil)

    , id [String], name [String], project_id [String], created_at [String], contact_count [Integer], unsubscribed_count [Integer]



1929
1930
1931
1932
1933
1934
1935
1936
1937
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1929

def initialize(object: nil, id: , name: , project_id: , created_at: , contact_count: nil, unsubscribed_count: nil)
  @object = object
  @id = id
  @name = name
  @project_id = project_id
  @created_at = created_at
  @contact_count = contact_count
  @unsubscribed_count = unsubscribed_count
end

Instance Attribute Details

#contact_countInteger

Returns:

  • (Integer)


1924
1925
1926
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1924

def contact_count
  @contact_count
end

#created_atString

Returns:

  • (String)


1922
1923
1924
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1922

def created_at
  @created_at
end

#idString

Returns:

  • (String)


1916
1917
1918
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1916

def id
  @id
end

#nameString

Returns:

  • (String)


1918
1919
1920
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1918

def name
  @name
end

#objectString

Returns:

  • (String)


1914
1915
1916
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1914

def object
  @object
end

#project_idString

Returns:

  • (String)


1920
1921
1922
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1920

def project_id
  @project_id
end

#unsubscribed_countInteger

Returns:

  • (Integer)


1926
1927
1928
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1926

def unsubscribed_count
  @unsubscribed_count
end

Class Method Details

.from_json(attributes) ⇒ SegmentResponse

Create an instance from a parsed JSON hash.

Parameters:

  • attributes (Hash)

Returns:



1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1955

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

  new(
    object: attributes.key?("object") ? attributes["object"] : attributes[:object],
    id: attributes.key?("id") ? attributes["id"] : attributes[:id],
    name: attributes.key?("name") ? attributes["name"] : attributes[:name],
    project_id: attributes.key?("projectId") ? attributes["projectId"] : attributes[:project_id],
    created_at: attributes.key?("createdAt") ? attributes["createdAt"] : attributes[:created_at],
    contact_count: attributes.key?("contactCount") ? attributes["contactCount"] : attributes[:contact_count],
    unsubscribed_count: attributes.key?("unsubscribedCount") ? attributes["unsubscribedCount"] : attributes[:unsubscribed_count],
  )
end

Instance Method Details

#to_hHash

Returns a hash representation of this object.

Returns:

  • (Hash)

    a hash representation of this object



1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
# File 'lib/apollo_deploy_signal_sdk/types.rb', line 1940

def to_h
  {
    object: @object,
    id: @id,
    name: @name,
    project_id: @project_id,
    created_at: @created_at,
    contact_count: @contact_count,
    unsubscribed_count: @unsubscribed_count,
  }.compact
end