Class: MundiApi::CreateUsageRequest
- Defined in:
- lib/mundi_api/models/create_usage_request.rb
Overview
Request for creating a usage
Instance Attribute Summary collapse
-
#description ⇒ String
TODO: Write general description for this method.
-
#quantity ⇒ Integer
TODO: Write general description for this method.
-
#used_at ⇒ DateTime
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(quantity = nil, description = nil, used_at = nil) ⇒ CreateUsageRequest
constructor
A new instance of CreateUsageRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(quantity = nil, description = nil, used_at = nil) ⇒ CreateUsageRequest
Returns a new instance of CreateUsageRequest.
31 32 33 34 35 36 37 |
# File 'lib/mundi_api/models/create_usage_request.rb', line 31 def initialize(quantity = nil, description = nil, used_at = nil) @quantity = quantity @description = description @used_at = used_at end |
Instance Attribute Details
#description ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/mundi_api/models/create_usage_request.rb', line 14 def description @description end |
#quantity ⇒ Integer
TODO: Write general description for this method
10 11 12 |
# File 'lib/mundi_api/models/create_usage_request.rb', line 10 def quantity @quantity end |
#used_at ⇒ DateTime
TODO: Write general description for this method
18 19 20 |
# File 'lib/mundi_api/models/create_usage_request.rb', line 18 def used_at @used_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mundi_api/models/create_usage_request.rb', line 40 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. quantity = hash['quantity'] description = hash['description'] used_at = DateTime.rfc3339(hash['used_at']) if hash['used_at'] # Create object from extracted values. CreateUsageRequest.new(quantity, description, used_at) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 27 28 29 |
# File 'lib/mundi_api/models/create_usage_request.rb', line 21 def self.names if @_hash.nil? @_hash = {} @_hash['quantity'] = 'quantity' @_hash['description'] = 'description' @_hash['used_at'] = 'used_at' end @_hash end |