Class: Batches::Action
- Defined in:
- lib/batches/models/action.rb
Overview
Action Model.
Instance Attribute Summary collapse
-
#app_id ⇒ String
The id of the app that was used to create the token.
-
#app_name ⇒ String
The name of the app the user gave to the application.
-
#id ⇒ String
A unique identifier generated by the platform to identify an action.
-
#result_code ⇒ ResultCodeBatchesActionResultCode
The result of the action executed.
-
#time_created ⇒ String
Time indicating when the object was created in ISO-8601 format.
-
#type ⇒ TypeBatchesActionType
Indicates the specific action taken.
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(id: SKIP, type: SKIP, time_created: SKIP, result_code: SKIP, app_id: SKIP, app_name: SKIP, additional_properties: nil) ⇒ Action
constructor
A new instance of Action.
-
#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(id: SKIP, type: SKIP, time_created: SKIP, result_code: SKIP, app_id: SKIP, app_name: SKIP, additional_properties: nil) ⇒ Action
Returns a new instance of Action.
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/batches/models/action.rb', line 65 def initialize(id: SKIP, type: SKIP, time_created: SKIP, result_code: SKIP, app_id: SKIP, app_name: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @type = type unless type == SKIP @time_created = time_created unless time_created == SKIP @result_code = result_code unless result_code == SKIP @app_id = app_id unless app_id == SKIP @app_name = app_name unless app_name == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#app_id ⇒ String
The id of the app that was used to create the token.
30 31 32 |
# File 'lib/batches/models/action.rb', line 30 def app_id @app_id end |
#app_name ⇒ String
The name of the app the user gave to the application.
34 35 36 |
# File 'lib/batches/models/action.rb', line 34 def app_name @app_name end |
#id ⇒ String
A unique identifier generated by the platform to identify an action.
14 15 16 |
# File 'lib/batches/models/action.rb', line 14 def id @id end |
#result_code ⇒ ResultCodeBatchesActionResultCode
The result of the action executed.
26 27 28 |
# File 'lib/batches/models/action.rb', line 26 def result_code @result_code end |
#time_created ⇒ String
Time indicating when the object was created in ISO-8601 format.
22 23 24 |
# File 'lib/batches/models/action.rb', line 22 def time_created @time_created end |
#type ⇒ TypeBatchesActionType
Indicates the specific action taken.
18 19 20 |
# File 'lib/batches/models/action.rb', line 18 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/batches/models/action.rb', line 80 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP type = hash.key?('type') ? hash['type'] : SKIP time_created = hash.key?('time_created') ? hash['time_created'] : SKIP result_code = hash.key?('result_code') ? hash['result_code'] : SKIP app_id = hash.key?('app_id') ? hash['app_id'] : SKIP app_name = hash.key?('app_name') ? hash['app_name'] : SKIP # 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. Action.new(id: id, type: type, time_created: time_created, result_code: result_code, app_id: app_id, app_name: app_name, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/batches/models/action.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['type'] = 'type' @_hash['time_created'] = 'time_created' @_hash['result_code'] = 'result_code' @_hash['app_id'] = 'app_id' @_hash['app_name'] = 'app_name' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/batches/models/action.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/batches/models/action.rb', line 49 def self.optionals %w[ id type time_created result_code app_id app_name ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
117 118 119 120 121 122 123 |
# File 'lib/batches/models/action.rb', line 117 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, type: #{@type.inspect}, time_created:"\ " #{@time_created.inspect}, result_code: #{@result_code.inspect}, app_id:"\ " #{@app_id.inspect}, app_name: #{@app_name.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
109 110 111 112 113 114 |
# File 'lib/batches/models/action.rb', line 109 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, type: #{@type}, time_created: #{@time_created}, result_code:"\ " #{@result_code}, app_id: #{@app_id}, app_name: #{@app_name}, additional_properties:"\ " #{@additional_properties}>" end |