Class: StickyIoRestfulApiV2025731::CreateCouponProfileRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- StickyIoRestfulApiV2025731::CreateCouponProfileRequest
- Defined in:
- lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb
Overview
CreateCouponProfileRequest Model.
Instance Attribute Summary collapse
-
#description ⇒ String
TODO: Write general description for this method.
-
#discount ⇒ DiscountCreateCouponProfileRequest
TODO: Write general description for this method.
-
#expiration ⇒ Expiration
TODO: Write general description for this method.
-
#is_free_shipping ⇒ Integer
TODO: Write general description for this method.
-
#is_lifetime ⇒ Integer
TODO: Write general description for this method.
-
#limits ⇒ LimitsCreateCouponProfileRequest
TODO: Write general description for this method.
-
#minimum_purchase ⇒ Integer
TODO: Write general description for this method.
-
#name ⇒ String
TODO: Write general description for this method.
-
#promo_codes ⇒ Array[PromoCode]
TODO: Write general description for this method.
-
#type_id ⇒ Integer
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(name:, description:, type_id:, minimum_purchase:, is_lifetime:, is_free_shipping:, expiration:, limits:, promo_codes:, discount:, additional_properties: nil) ⇒ CreateCouponProfileRequest
constructor
A new instance of CreateCouponProfileRequest.
-
#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(name:, description:, type_id:, minimum_purchase:, is_lifetime:, is_free_shipping:, expiration:, limits:, promo_codes:, discount:, additional_properties: nil) ⇒ CreateCouponProfileRequest
Returns a new instance of CreateCouponProfileRequest.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 78 def initialize(name:, description:, type_id:, minimum_purchase:, is_lifetime:, is_free_shipping:, expiration:, limits:, promo_codes:, discount:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @name = name @description = description @type_id = type_id @minimum_purchase = minimum_purchase @is_lifetime = is_lifetime @is_free_shipping = is_free_shipping @expiration = expiration @limits = limits @promo_codes = promo_codes @discount = discount @additional_properties = additional_properties end |
Instance Attribute Details
#description ⇒ String
TODO: Write general description for this method
18 19 20 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 18 def description @description end |
#discount ⇒ DiscountCreateCouponProfileRequest
TODO: Write general description for this method
50 51 52 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 50 def discount @discount end |
#expiration ⇒ Expiration
TODO: Write general description for this method
38 39 40 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 38 def expiration @expiration end |
#is_free_shipping ⇒ Integer
TODO: Write general description for this method
34 35 36 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 34 def is_free_shipping @is_free_shipping end |
#is_lifetime ⇒ Integer
TODO: Write general description for this method
30 31 32 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 30 def is_lifetime @is_lifetime end |
#limits ⇒ LimitsCreateCouponProfileRequest
TODO: Write general description for this method
42 43 44 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 42 def limits @limits end |
#minimum_purchase ⇒ Integer
TODO: Write general description for this method
26 27 28 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 26 def minimum_purchase @minimum_purchase end |
#name ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 14 def name @name end |
#promo_codes ⇒ Array[PromoCode]
TODO: Write general description for this method
46 47 48 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 46 def promo_codes @promo_codes end |
#type_id ⇒ Integer
TODO: Write general description for this method
22 23 24 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 22 def type_id @type_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
98 99 100 101 102 103 104 105 106 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 138 139 140 141 142 143 144 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 98 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil description = hash.key?('description') ? hash['description'] : nil type_id = hash.key?('type_id') ? hash['type_id'] : nil minimum_purchase = hash.key?('minimum_purchase') ? hash['minimum_purchase'] : nil is_lifetime = hash.key?('is_lifetime') ? hash['is_lifetime'] : nil is_free_shipping = hash.key?('is_free_shipping') ? hash['is_free_shipping'] : nil expiration = Expiration.from_hash(hash['expiration']) if hash['expiration'] limits = LimitsCreateCouponProfileRequest.from_hash(hash['limits']) if hash['limits'] # Parameter is an array, so we need to iterate through it promo_codes = nil unless hash['promo_codes'].nil? promo_codes = [] hash['promo_codes'].each do |structure| promo_codes << (PromoCode.from_hash(structure) if structure) end end promo_codes = nil unless hash.key?('promo_codes') discount = DiscountCreateCouponProfileRequest.from_hash(hash['discount']) if hash['discount'] # 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. CreateCouponProfileRequest.new(name: name, description: description, type_id: type_id, minimum_purchase: minimum_purchase, is_lifetime: is_lifetime, is_free_shipping: is_free_shipping, expiration: expiration, limits: limits, promo_codes: promo_codes, discount: discount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 53 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['type_id'] = 'type_id' @_hash['minimum_purchase'] = 'minimum_purchase' @_hash['is_lifetime'] = 'is_lifetime' @_hash['is_free_shipping'] = 'is_free_shipping' @_hash['expiration'] = 'expiration' @_hash['limits'] = 'limits' @_hash['promo_codes'] = 'promo_codes' @_hash['discount'] = 'discount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
74 75 76 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 74 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
69 70 71 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 69 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
157 158 159 160 161 162 163 164 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 157 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, description: #{@description.inspect}, type_id:"\ " #{@type_id.inspect}, minimum_purchase: #{@minimum_purchase.inspect}, is_lifetime:"\ " #{@is_lifetime.inspect}, is_free_shipping: #{@is_free_shipping.inspect}, expiration:"\ " #{@expiration.inspect}, limits: #{@limits.inspect}, promo_codes: #{@promo_codes.inspect},"\ " discount: #{@discount.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
147 148 149 150 151 152 153 154 |
# File 'lib/sticky_io_restful_api_v2025731/models/create_coupon_profile_request.rb', line 147 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, description: #{@description}, type_id: #{@type_id},"\ " minimum_purchase: #{@minimum_purchase}, is_lifetime: #{@is_lifetime}, is_free_shipping:"\ " #{@is_free_shipping}, expiration: #{@expiration}, limits: #{@limits}, promo_codes:"\ " #{@promo_codes}, discount: #{@discount}, additional_properties:"\ " #{@additional_properties}>" end |