Class: ShellCardManagementApIs::Restriction
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ShellCardManagementApIs::Restriction
- Defined in:
- lib/shell_card_management_ap_is/models/restriction.rb
Overview
Restriction Model.
Instance Attribute Summary collapse
-
#day_time_restrictions ⇒ DayTimeRestrictions
TODO: Write general description for this method.
-
#location_restrictions ⇒ LocationRestriction
TODO: Write general description for this method.
-
#product_restrictions ⇒ SearchProductRestriction
TODO: Write general description for this method.
-
#usage_restrictions ⇒ UsageRestrictionsCard
TODO: Write general description for this method.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(usage_restrictions = SKIP, day_time_restrictions = SKIP, product_restrictions = SKIP, location_restrictions = SKIP) ⇒ Restriction
constructor
A new instance of Restriction.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(usage_restrictions = SKIP, day_time_restrictions = SKIP, product_restrictions = SKIP, location_restrictions = SKIP) ⇒ Restriction
Returns a new instance of Restriction.
53 54 55 56 57 58 59 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 53 def initialize(usage_restrictions = SKIP, day_time_restrictions = SKIP, product_restrictions = SKIP, location_restrictions = SKIP) @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_restrictions ⇒ DayTimeRestrictions
TODO: Write general description for this method
18 19 20 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 18 def day_time_restrictions @day_time_restrictions end |
#location_restrictions ⇒ LocationRestriction
TODO: Write general description for this method
26 27 28 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 26 def location_restrictions @location_restrictions end |
#product_restrictions ⇒ SearchProductRestriction
TODO: Write general description for this method
22 23 24 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 22 def product_restrictions @product_restrictions end |
#usage_restrictions ⇒ UsageRestrictionsCard
TODO: Write general description for this method
14 15 16 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 14 def usage_restrictions @usage_restrictions end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 62 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. usage_restrictions = UsageRestrictionsCard.from_hash(hash['UsageRestrictions']) if hash['UsageRestrictions'] day_time_restrictions = DayTimeRestrictions.from_hash(hash['DayTimeRestrictions']) if hash['DayTimeRestrictions'] product_restrictions = SearchProductRestriction.from_hash(hash['ProductRestrictions']) if hash['ProductRestrictions'] location_restrictions = LocationRestriction.from_hash(hash['LocationRestrictions']) if hash['LocationRestrictions'] # Create object from extracted values. Restriction.new(usage_restrictions, day_time_restrictions, product_restrictions, location_restrictions) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 36 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['usage_restrictions'] = 'UsageRestrictions' @_hash['day_time_restrictions'] = 'DayTimeRestrictions' @_hash['product_restrictions'] = 'ProductRestrictions' @_hash['location_restrictions'] = 'LocationRestrictions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 39 def self.optionals %w[ usage_restrictions day_time_restrictions product_restrictions location_restrictions ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
91 92 93 94 95 96 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 91 def inspect class_name = self.class.name.split('::').last "<#{class_name} usage_restrictions: #{@usage_restrictions.inspect}, day_time_restrictions:"\ " #{@day_time_restrictions.inspect}, product_restrictions: #{@product_restrictions.inspect},"\ " location_restrictions: #{@location_restrictions.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
83 84 85 86 87 88 |
# File 'lib/shell_card_management_ap_is/models/restriction.rb', line 83 def to_s class_name = self.class.name.split('::').last "<#{class_name} usage_restrictions: #{@usage_restrictions}, day_time_restrictions:"\ " #{@day_time_restrictions}, product_restrictions: #{@product_restrictions},"\ " location_restrictions: #{@location_restrictions}>" end |