Class: NewStoreApi::Rules
- Defined in:
- lib/new_store_api/models/rules.rb
Overview
Rules Model.
Instance Attribute Summary collapse
-
#app_version ⇒ String
A regex pattern to match one or multiple app versions.
-
#associate_id ⇒ String
A regex pattern to match one or multiple associateIds.
-
#store_id ⇒ String
A regex pattern to match one or multiple storeIds.
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(app_version = nil, associate_id = SKIP, store_id = SKIP) ⇒ Rules
constructor
A new instance of Rules.
-
#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(app_version = nil, associate_id = SKIP, store_id = SKIP) ⇒ Rules
Returns a new instance of Rules.
46 47 48 49 50 |
# File 'lib/new_store_api/models/rules.rb', line 46 def initialize(app_version = nil, associate_id = SKIP, store_id = SKIP) @app_version = app_version @associate_id = associate_id unless associate_id == SKIP @store_id = store_id unless store_id == SKIP end |
Instance Attribute Details
#app_version ⇒ String
A regex pattern to match one or multiple app versions.
14 15 16 |
# File 'lib/new_store_api/models/rules.rb', line 14 def app_version @app_version end |
#associate_id ⇒ String
A regex pattern to match one or multiple associateIds.
18 19 20 |
# File 'lib/new_store_api/models/rules.rb', line 18 def associate_id @associate_id end |
#store_id ⇒ String
A regex pattern to match one or multiple storeIds.
22 23 24 |
# File 'lib/new_store_api/models/rules.rb', line 22 def store_id @store_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/new_store_api/models/rules.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. app_version = hash.key?('appVersion') ? hash['appVersion'] : nil associate_id = hash.key?('associateId') ? hash['associateId'] : SKIP store_id = hash.key?('storeId') ? hash['storeId'] : SKIP # Create object from extracted values. Rules.new(app_version, associate_id, store_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/new_store_api/models/rules.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['app_version'] = 'appVersion' @_hash['associate_id'] = 'associateId' @_hash['store_id'] = 'storeId' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/new_store_api/models/rules.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 |
# File 'lib/new_store_api/models/rules.rb', line 34 def self.optionals %w[ associate_id store_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
75 76 77 78 79 |
# File 'lib/new_store_api/models/rules.rb', line 75 def inspect class_name = self.class.name.split('::').last "<#{class_name} app_version: #{@app_version.inspect}, associate_id:"\ " #{@associate_id.inspect}, store_id: #{@store_id.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
68 69 70 71 72 |
# File 'lib/new_store_api/models/rules.rb', line 68 def to_s class_name = self.class.name.split('::').last "<#{class_name} app_version: #{@app_version}, associate_id: #{@associate_id}, store_id:"\ " #{@store_id}>" end |