Class: UnivapayClientSdk::Store

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

Overview

Store resource returned by the backend FullStore formatter. It combines core store identity with the resolved configuration snapshot used for runtime policy evaluation.

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, created_on: SKIP, configuration: SKIP, additional_properties: nil) ⇒ Store

Returns a new instance of Store.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/univapay_client_sdk/models/store.rb', line 58

def initialize(id: SKIP, name: SKIP, created_on: SKIP, configuration: 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
  @created_on = created_on unless created_on == SKIP
  @configuration = configuration unless configuration == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#configurationMerchantWebhookConfiguration

Store-scoped configuration snapshot serialized by gyron-payments-api. It uses the same flattened serializer as merchant configuration, but omits transfer_schedule.



31
32
33
# File 'lib/univapay_client_sdk/models/store.rb', line 31

def configuration
  @configuration
end

#created_onDateTime

Timestamp when the store was created.

Returns:

  • (DateTime)


25
26
27
# File 'lib/univapay_client_sdk/models/store.rb', line 25

def created_on
  @created_on
end

#idUUID | String

Store identifier.

Returns:

  • (UUID | String)


17
18
19
# File 'lib/univapay_client_sdk/models/store.rb', line 17

def id
  @id
end

#nameString

Store display name.

Returns:

  • (String)


21
22
23
# File 'lib/univapay_client_sdk/models/store.rb', line 21

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/univapay_client_sdk/models/store.rb', line 71

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
  created_on = if hash.key?('created_on')
                 (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on'])
               else
                 SKIP
               end
  configuration = MerchantWebhookConfiguration.from_hash(hash['configuration']) if
    hash['configuration']

  # 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.
  Store.new(id: id,
            name: name,
            created_on: created_on,
            configuration: configuration,
            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
# File 'lib/univapay_client_sdk/models/store.rb', line 34

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

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/univapay_client_sdk/models/store.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
# File 'lib/univapay_client_sdk/models/store.rb', line 44

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



112
113
114
115
116
117
# File 'lib/univapay_client_sdk/models/store.rb', line 112

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

#to_custom_created_onObject



100
101
102
# File 'lib/univapay_client_sdk/models/store.rb', line 100

def to_custom_created_on
  DateTimeHelper.to_rfc3339(created_on)
end

#to_sObject

Provides a human-readable string representation of the object.



105
106
107
108
109
# File 'lib/univapay_client_sdk/models/store.rb', line 105

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