Class: Tester::Job
Overview
Job Model.
Instance Attribute Summary collapse
-
#company ⇒ String
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.
Instance Method Summary collapse
-
#initialize(company = nil, additional_properties = {}) ⇒ Job
constructor
A new instance of Job.
Methods inherited from BaseModel
#method_missing, #respond_to_missing?, #to_hash, #to_json
Constructor Details
#initialize(company = nil, additional_properties = {}) ⇒ Job
Returns a new instance of Job.
18 19 20 21 22 23 24 25 26 |
# File 'lib/tester/models/job.rb', line 18 def initialize(company = nil, additional_properties = {}) @company = company # Add additional model properties to the instance. additional_properties.each do |_name, value| instance_variable_set("@#{_name}", value) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Tester::BaseModel
Instance Attribute Details
#company ⇒ String
TODO: Write general description for this method
9 10 11 |
# File 'lib/tester/models/job.rb', line 9 def company @company end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/tester/models/job.rb', line 29 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. company = hash['company'] # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. Job.new(company, hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
12 13 14 15 16 |
# File 'lib/tester/models/job.rb', line 12 def self.names @_hash = {} if @_hash.nil? @_hash['company'] = 'company' @_hash end |