Class: ShellCardManagementApIs::BundleRestriction

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_card_management_ap_is/models/bundle_restriction.rb

Overview

BundleRestriction 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(day_time_restriction_action = SKIP, location_restriction_action = SKIP, product_restriction_action = SKIP, day_time_restrictions = SKIP, product_restrictions = SKIP, location_restrictions = SKIP, usage_restrictions = SKIP) ⇒ BundleRestriction

Returns a new instance of BundleRestriction.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 117

def initialize(day_time_restriction_action = SKIP,
               location_restriction_action = SKIP,
               product_restriction_action = SKIP,
               day_time_restrictions = SKIP, product_restrictions = SKIP,
               location_restrictions = SKIP, usage_restrictions = SKIP)
  unless day_time_restriction_action == SKIP
    @day_time_restriction_action =
      day_time_restriction_action
  end
  unless location_restriction_action == SKIP
    @location_restriction_action =
      location_restriction_action
  end
  unless product_restriction_action == SKIP
    @product_restriction_action =
      product_restriction_action
  end
  @day_time_restrictions = day_time_restrictions unless day_time_restrictions == SKIP
  @product_restrictions = product_restrictions unless product_restrictions == SKIP
  @location_restrictions = location_restrictions unless location_restrictions == SKIP
  @usage_restrictions = usage_restrictions unless usage_restrictions == SKIP
end

Instance Attribute Details

#day_time_restriction_actionString

The value indicates what actions to be performed with respect to day time restriction. Mandatory Allowed values –• Add: Apply the given restriction on the bundle. • Default: No Day/Time restriction will be applied on the bundle in Gateway.

Returns:

  • (String)


20
21
22
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 20

def day_time_restriction_action
  @day_time_restriction_action
end

#day_time_restrictionsDayTimeRestrictions

The value indicates what actions to be performed with respect to Product restriction. Mandatory Allowed values –• Add: Apply the given restriction on the bundle. • Default: No Product restriction will be applied on the bundle in Gateway.

Returns:



50
51
52
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 50

def day_time_restrictions
  @day_time_restrictions
end

#location_restriction_actionString

The value indicates what actions to be performed with respect to location restriction. Mandatory Allowed values –• Add: Apply the given restriction on the bundle. • Default: No location restriction will be applied on the bundle in Gateway.

Returns:

  • (String)


30
31
32
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 30

def location_restriction_action
  @location_restriction_action
end

#location_restrictionsLocationRestriction

The value indicates what actions to be performed with respect to Product restriction. Mandatory Allowed values –• Add: Apply the given restriction on the bundle. • Default: No Product restriction will be applied on the bundle in Gateway.

Returns:



70
71
72
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 70

def location_restrictions
  @location_restrictions
end

#product_restriction_actionString

The value indicates what actions to be performed with respect to Product restriction. Mandatory Allowed values –• Add: Apply the given restriction on the bundle. • Default: No Product restriction will be applied on the bundle in Gateway.

Returns:

  • (String)


40
41
42
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 40

def product_restriction_action
  @product_restriction_action
end

#product_restrictionsProductRestrictionCard

The value indicates what actions to be performed with respect to Product restriction. Mandatory Allowed values –• Add: Apply the given restriction on the bundle. • Default: No Product restriction will be applied on the bundle in Gateway.



60
61
62
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 60

def product_restrictions
  @product_restrictions
end

#usage_restrictionsUsageRestrictionsCard

The value indicates what actions to be performed with respect to Product restriction. Mandatory Allowed values –• Add: Apply the given restriction on the bundle. • Default: No Product restriction will be applied on the bundle in Gateway.



80
81
82
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 80

def usage_restrictions
  @usage_restrictions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 141

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  day_time_restriction_action =
    hash.key?('DayTimeRestrictionAction') ? hash['DayTimeRestrictionAction'] : SKIP
  location_restriction_action =
    hash.key?('LocationRestrictionAction') ? hash['LocationRestrictionAction'] : SKIP
  product_restriction_action =
    hash.key?('ProductRestrictionAction') ? hash['ProductRestrictionAction'] : SKIP
  day_time_restrictions = DayTimeRestrictions.from_hash(hash['DayTimeRestrictions']) if
    hash['DayTimeRestrictions']
  product_restrictions = ProductRestrictionCard.from_hash(hash['ProductRestrictions']) if
    hash['ProductRestrictions']
  location_restrictions = LocationRestriction.from_hash(hash['LocationRestrictions']) if
    hash['LocationRestrictions']
  usage_restrictions = UsageRestrictionsCard.from_hash(hash['UsageRestrictions']) if
    hash['UsageRestrictions']

  # Create object from extracted values.
  BundleRestriction.new(day_time_restriction_action,
                        location_restriction_action,
                        product_restriction_action,
                        day_time_restrictions,
                        product_restrictions,
                        location_restrictions,
                        usage_restrictions)
end

.namesObject

A mapping from model property names to API property names.



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 83

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['day_time_restriction_action'] = 'DayTimeRestrictionAction'
  @_hash['location_restriction_action'] = 'LocationRestrictionAction'
  @_hash['product_restriction_action'] = 'ProductRestrictionAction'
  @_hash['day_time_restrictions'] = 'DayTimeRestrictions'
  @_hash['product_restrictions'] = 'ProductRestrictions'
  @_hash['location_restrictions'] = 'LocationRestrictions'
  @_hash['usage_restrictions'] = 'UsageRestrictions'
  @_hash
end

.nullablesObject

An array for nullable fields



109
110
111
112
113
114
115
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 109

def self.nullables
  %w[
    day_time_restriction_action
    location_restriction_action
    product_restriction_action
  ]
end

.optionalsObject

An array for optional fields



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 96

def self.optionals
  %w[
    day_time_restriction_action
    location_restriction_action
    product_restriction_action
    day_time_restrictions
    product_restrictions
    location_restrictions
    usage_restrictions
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



181
182
183
184
185
186
187
188
189
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 181

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} day_time_restriction_action: #{@day_time_restriction_action.inspect},"\
  " location_restriction_action: #{@location_restriction_action.inspect},"\
  " product_restriction_action: #{@product_restriction_action.inspect}, day_time_restrictions:"\
  " #{@day_time_restrictions.inspect}, product_restrictions: #{@product_restrictions.inspect},"\
  " location_restrictions: #{@location_restrictions.inspect}, usage_restrictions:"\
  " #{@usage_restrictions.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



171
172
173
174
175
176
177
178
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 171

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} day_time_restriction_action: #{@day_time_restriction_action},"\
  " location_restriction_action: #{@location_restriction_action}, product_restriction_action:"\
  " #{@product_restriction_action}, day_time_restrictions: #{@day_time_restrictions},"\
  " product_restrictions: #{@product_restrictions}, location_restrictions:"\
  " #{@location_restrictions}, usage_restrictions: #{@usage_restrictions}>"
end