Class: ShellDataReportingApIs::CartTypeAccount

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/cart_type_account.rb

Overview

CartTypeAccount Model.

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(account_id = SKIP, account_number = SKIP, is_default = SKIP, customer_card_type_id = SKIP, is_visible_to_customers = SKIP, emboss_account_name = SKIP, default_purchase_category_id = SKIP, usage_restrictions = SKIP, day_time_restrictions = SKIP) ⇒ CartTypeAccount

Returns a new instance of CartTypeAccount.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 87

def initialize( = SKIP,  = SKIP, is_default = SKIP,
               customer_card_type_id = SKIP, is_visible_to_customers = SKIP,
                = SKIP,
               default_purchase_category_id = SKIP,
               usage_restrictions = SKIP, day_time_restrictions = SKIP)
  @account_id =  unless  == SKIP
  @account_number =  unless  == SKIP
  @is_default = is_default unless is_default == SKIP
  @customer_card_type_id = customer_card_type_id unless customer_card_type_id == SKIP
  @is_visible_to_customers = is_visible_to_customers unless is_visible_to_customers == SKIP
  @emboss_account_name =  unless  == SKIP
  unless default_purchase_category_id == SKIP
    @default_purchase_category_id =
      default_purchase_category_id
  end
  @usage_restrictions = usage_restrictions unless usage_restrictions == SKIP
  @day_time_restrictions = day_time_restrictions unless day_time_restrictions == SKIP
end

Instance Attribute Details

#account_idInteger

Account Id of the customer.

Returns:

  • (Integer)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 14

def 
  @account_id
end

#account_numberString

Account Number of the customer.

Returns:

  • (String)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 18

def 
  @account_number
end

#customer_card_type_idInteger

Customer Card Type Id in Cards Platform.

Returns:

  • (Integer)


26
27
28
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 26

def customer_card_type_id
  @customer_card_type_id
end

#day_time_restrictionsCardDayTimeRestrictions

Default Purchase category of the card type.



48
49
50
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 48

def day_time_restrictions
  @day_time_restrictions
end

#default_purchase_category_idInteger

Default Purchase category of the card type.

Returns:

  • (Integer)


40
41
42
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 40

def default_purchase_category_id
  @default_purchase_category_id
end

#emboss_account_nameString

Default Name to be embossed on the card.

Returns:

  • (String)


36
37
38
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 36

def 
  @emboss_account_name
end

#is_defaultTrueClass | FalseClass

Whether card type is default or not.

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 22

def is_default
  @is_default
end

#is_visible_to_customersTrueClass | FalseClass

True/False – Whether the card type can be used for card ordering.
Note - IsVisibleToCustomers will be set as ‘false’ when the card type is not active or. configured in MS to be not visible.

Returns:

  • (TrueClass | FalseClass)


32
33
34
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 32

def is_visible_to_customers
  @is_visible_to_customers
end

#usage_restrictionsCardUsageRestrictions

Default Purchase category of the card type.



44
45
46
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 44

def usage_restrictions
  @usage_restrictions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 107

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('AccountId') ? hash['AccountId'] : SKIP
   = hash.key?('AccountNumber') ? hash['AccountNumber'] : SKIP
  is_default = hash.key?('IsDefault') ? hash['IsDefault'] : SKIP
  customer_card_type_id =
    hash.key?('CustomerCardTypeId') ? hash['CustomerCardTypeId'] : SKIP
  is_visible_to_customers =
    hash.key?('IsVisibleToCustomers') ? hash['IsVisibleToCustomers'] : SKIP
   =
    hash.key?('EmbossAccountName') ? hash['EmbossAccountName'] : SKIP
  default_purchase_category_id =
    hash.key?('DefaultPurchaseCategoryId') ? hash['DefaultPurchaseCategoryId'] : SKIP
  usage_restrictions = CardUsageRestrictions.from_hash(hash['UsageRestrictions']) if
    hash['UsageRestrictions']
  day_time_restrictions = CardDayTimeRestrictions.from_hash(hash['DayTimeRestrictions']) if
    hash['DayTimeRestrictions']

  # Create object from extracted values.
  CartTypeAccount.new(,
                      ,
                      is_default,
                      customer_card_type_id,
                      is_visible_to_customers,
                      ,
                      default_purchase_category_id,
                      usage_restrictions,
                      day_time_restrictions)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'AccountId'
  @_hash['account_number'] = 'AccountNumber'
  @_hash['is_default'] = 'IsDefault'
  @_hash['customer_card_type_id'] = 'CustomerCardTypeId'
  @_hash['is_visible_to_customers'] = 'IsVisibleToCustomers'
  @_hash['emboss_account_name'] = 'EmbossAccountName'
  @_hash['default_purchase_category_id'] = 'DefaultPurchaseCategoryId'
  @_hash['usage_restrictions'] = 'UsageRestrictions'
  @_hash['day_time_restrictions'] = 'DayTimeRestrictions'
  @_hash
end

.nullablesObject

An array for nullable fields



81
82
83
84
85
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 81

def self.nullables
  %w[
    account_id
  ]
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 66

def self.optionals
  %w[
    account_id
    account_number
    is_default
    customer_card_type_id
    is_visible_to_customers
    emboss_account_name
    default_purchase_category_id
    usage_restrictions
    day_time_restrictions
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



150
151
152
153
154
155
156
157
158
159
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 150

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id.inspect}, account_number:"\
  " #{@account_number.inspect}, is_default: #{@is_default.inspect}, customer_card_type_id:"\
  " #{@customer_card_type_id.inspect}, is_visible_to_customers:"\
  " #{@is_visible_to_customers.inspect}, emboss_account_name: #{@emboss_account_name.inspect},"\
  " default_purchase_category_id: #{@default_purchase_category_id.inspect},"\
  " usage_restrictions: #{@usage_restrictions.inspect}, day_time_restrictions:"\
  " #{@day_time_restrictions.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



140
141
142
143
144
145
146
147
# File 'lib/shell_data_reporting_ap_is/models/cart_type_account.rb', line 140

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_id: #{@account_id}, account_number: #{@account_number}, is_default:"\
  " #{@is_default}, customer_card_type_id: #{@customer_card_type_id}, is_visible_to_customers:"\
  " #{@is_visible_to_customers}, emboss_account_name: #{@emboss_account_name},"\
  " default_purchase_category_id: #{@default_purchase_category_id}, usage_restrictions:"\
  " #{@usage_restrictions}, day_time_restrictions: #{@day_time_restrictions}>"
end