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

#to_hash, #to_json

Constructor Details

#initialize(day_time_restriction_action = SKIP, location_restriction_action = SKIP, usage_restrictions = SKIP, day_time_restrictions = SKIP, product_restrictions = SKIP, location_restrictions = SKIP) ⇒ BundleRestriction

Returns a new instance of BundleRestriction.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 104

def initialize(day_time_restriction_action = SKIP,
               location_restriction_action = SKIP,
               usage_restrictions = SKIP, day_time_restrictions = SKIP,
               product_restrictions = SKIP, location_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
  @usage_restrictions = usage_restrictions unless usage_restrictions == SKIP
  @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
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 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:



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 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:



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

def location_restrictions
  @location_restrictions
end

#product_restrictionsObject

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:

  • (Object)


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

def product_restrictions
  @product_restrictions
end

#usage_restrictionsObject

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:

  • (Object)


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

def usage_restrictions
  @usage_restrictions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 123

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
  usage_restrictions =
    hash.key?('UsageRestrictions') ? hash['UsageRestrictions'] : SKIP
  day_time_restrictions = DayTimeRestrictions.from_hash(hash['DayTimeRestrictions']) if
    hash['DayTimeRestrictions']
  product_restrictions =
    hash.key?('ProductRestrictions') ? hash['ProductRestrictions'] : SKIP
  location_restrictions = LocationRestriction.from_hash(hash['LocationRestrictions']) if
    hash['LocationRestrictions']

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

.namesObject

A mapping from model property names to API property names.



73
74
75
76
77
78
79
80
81
82
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 73

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

.nullablesObject

An array for nullable fields



97
98
99
100
101
102
# File 'lib/shell_card_management_ap_is/models/bundle_restriction.rb', line 97

def self.nullables
  %w[
    day_time_restriction_action
    location_restriction_action
  ]
end

.optionalsObject

An array for optional fields



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

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