Class: Gonebusy::CreateResourceBody
- Defined in:
- lib/gonebusy/models/create_resource_body.rb
Instance Attribute Summary collapse
-
#capacity ⇒ Integer
Optional Capacity.
-
#description ⇒ String
Optional Description.
-
#gender ⇒ GenderEnum
Optional Gender.
-
#name ⇒ String
Resource Name.
-
#thing_type_id ⇒ Integer
When Resource is a Thing, the type Id.
-
#type ⇒ String
Type of Resource.
-
#user_id ⇒ Integer
Create a Resource for this User Id.
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(name = nil, type = nil, capacity = nil, description = nil, gender = nil, thing_type_id = nil, user_id = nil) ⇒ CreateResourceBody
constructor
A new instance of CreateResourceBody.
Methods inherited from BaseModel
Constructor Details
#initialize(name = nil, type = nil, capacity = nil, description = nil, gender = nil, thing_type_id = nil, user_id = nil) ⇒ CreateResourceBody
Returns a new instance of CreateResourceBody.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 48 def initialize(name = nil, type = nil, capacity = nil, description = nil, gender = nil, thing_type_id = nil, user_id = nil) @name = name @type = type @capacity = capacity @description = description @gender = gender @thing_type_id = thing_type_id @user_id = user_id end |
Instance Attribute Details
#capacity ⇒ Integer
Optional Capacity
15 16 17 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 15 def capacity @capacity end |
#description ⇒ String
Optional Description
19 20 21 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 19 def description @description end |
#gender ⇒ GenderEnum
Optional Gender
23 24 25 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 23 def gender @gender end |
#name ⇒ String
Resource Name
7 8 9 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 7 def name @name end |
#thing_type_id ⇒ Integer
When Resource is a Thing, the type Id
27 28 29 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 27 def thing_type_id @thing_type_id end |
#type ⇒ String
Type of Resource
11 12 13 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 11 def type @type end |
#user_id ⇒ Integer
Create a Resource for this User Id. You must be authorized to manage this User Id.
31 32 33 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 31 def user_id @user_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 65 def self.from_hash(hash) if hash == nil nil else # Extract variables from the hash name = hash["name"] type = hash["type"] capacity = hash["capacity"] description = hash["description"] gender = hash["gender"] thing_type_id = hash["thing_type_id"] user_id = hash["user_id"] # Create object from extracted values CreateResourceBody.new(name, type, capacity, description, gender, thing_type_id, user_id) end end |
.names ⇒ Object
A mapping from model property names to API property names
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/gonebusy/models/create_resource_body.rb', line 34 def self.names if @hash.nil? @hash = {} @hash["name"] = "name" @hash["type"] = "type" @hash["capacity"] = "capacity" @hash["description"] = "description" @hash["gender"] = "gender" @hash["thing_type_id"] = "thing_type_id" @hash["user_id"] = "user_id" end @hash end |