Class: UnivapayClientSdk::StoreListItem

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/store_list_item.rb

Overview

Store row returned by store list queries.

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(id: SKIP, name: SKIP, merchant_name: SKIP, created_on: SKIP, additional_properties: nil) ⇒ StoreListItem

Returns a new instance of StoreListItem.



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 54

def initialize(id: SKIP, name: SKIP, merchant_name: SKIP, created_on: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @name = name unless name == SKIP
  @merchant_name = merchant_name unless merchant_name == SKIP
  @created_on = created_on unless created_on == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#created_onDateTime

Timestamp when the store was created.

Returns:

  • (DateTime)


27
28
29
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 27

def created_on
  @created_on
end

#idUUID | String

Store identifier.

Returns:

  • (UUID | String)


15
16
17
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 15

def id
  @id
end

#merchant_nameString

Merchant display name associated with the store row.

Returns:

  • (String)


23
24
25
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 23

def merchant_name
  @merchant_name
end

#nameString

Store display name.

Returns:

  • (String)


19
20
21
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 19

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  merchant_name = hash.key?('merchant_name') ? hash['merchant_name'] : SKIP
  created_on = if hash.key?('created_on')
                 (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on'])
               else
                 SKIP
               end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  StoreListItem.new(id: id,
                    name: name,
                    merchant_name: merchant_name,
                    created_on: created_on,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['merchant_name'] = 'merchant_name'
  @_hash['created_on'] = 'created_on'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 40

def self.optionals
  %w[
    id
    name
    merchant_name
    created_on
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



107
108
109
110
111
112
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 107

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, merchant_name:"\
  " #{@merchant_name.inspect}, created_on: #{@created_on.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_created_onObject



95
96
97
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 95

def to_custom_created_on
  DateTimeHelper.to_rfc3339(created_on)
end

#to_sObject

Provides a human-readable string representation of the object.



100
101
102
103
104
# File 'lib/univapay_client_sdk/models/store_list_item.rb', line 100

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, name: #{@name}, merchant_name: #{@merchant_name}, created_on:"\
  " #{@created_on}, additional_properties: #{@additional_properties}>"
end