Class: NewStoreApi::ProfileDeleted

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/profile_deleted.rb

Overview

Event sent when a customer profile is deleted.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(customer_id = nil, deleted_at = SKIP) ⇒ ProfileDeleted

Returns a new instance of ProfileDeleted.



41
42
43
44
# File 'lib/new_store_api/models/profile_deleted.rb', line 41

def initialize(customer_id = nil, deleted_at = SKIP)
  @customer_id = customer_id
  @deleted_at = deleted_at unless deleted_at == SKIP
end

Instance Attribute Details

#customer_idUUID | String

The customer profile uuid.

Returns:

  • (UUID | String)


15
16
17
# File 'lib/new_store_api/models/profile_deleted.rb', line 15

def customer_id
  @customer_id
end

#deleted_atDateTime

Timestamp of the customer profile deletion.

Returns:

  • (DateTime)


19
20
21
# File 'lib/new_store_api/models/profile_deleted.rb', line 19

def deleted_at
  @deleted_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/new_store_api/models/profile_deleted.rb', line 47

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  customer_id = hash.key?('customer_id') ? hash['customer_id'] : nil
  deleted_at = if hash.key?('deleted_at')
                 (DateTimeHelper.from_rfc3339(hash['deleted_at']) if hash['deleted_at'])
               else
                 SKIP
               end

  # Create object from extracted values.
  ProfileDeleted.new(customer_id,
                     deleted_at)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/new_store_api/models/profile_deleted.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['customer_id'] = 'customer_id'
  @_hash['deleted_at'] = 'deleted_at'
  @_hash
end

.nullablesObject

An array for nullable fields



37
38
39
# File 'lib/new_store_api/models/profile_deleted.rb', line 37

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
33
34
# File 'lib/new_store_api/models/profile_deleted.rb', line 30

def self.optionals
  %w[
    deleted_at
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



74
75
76
77
# File 'lib/new_store_api/models/profile_deleted.rb', line 74

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} customer_id: #{@customer_id.inspect}, deleted_at: #{@deleted_at.inspect}>"
end

#to_custom_deleted_atObject



63
64
65
# File 'lib/new_store_api/models/profile_deleted.rb', line 63

def to_custom_deleted_at
  DateTimeHelper.to_rfc3339(deleted_at)
end

#to_sObject

Provides a human-readable string representation of the object.



68
69
70
71
# File 'lib/new_store_api/models/profile_deleted.rb', line 68

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} customer_id: #{@customer_id}, deleted_at: #{@deleted_at}>"
end