Class: Beanie::WorkCentre
Constant Summary collapse
- STATE_UNKNOWN =
0- STATE_MAINTENANCE =
1- STATE_OFFLINE =
2- STATE_READY =
3- STATE_BUSY =
4- STATE_DONE =
5- STATE_NAMES =
[ ["Unknown State", STATE_UNKNOWN], ["Maintenance Mode", STATE_MAINTENANCE], ["Offline (Unavailable)", STATE_OFFLINE], ["Ready for Work", STATE_READY], ["Working (Busy)", STATE_BUSY], ["Work Complete", STATE_DONE] ].freeze
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#location ⇒ Object
Returns the value of attribute location.
-
#name ⇒ Object
Returns the value of attribute name.
-
#state ⇒ Object
Returns the value of attribute state.
-
#work_centre_group_id ⇒ Object
Returns the value of attribute work_centre_group_id.
Instance Method Summary collapse
-
#construct_path(opts = {}) ⇒ Object
Construct the path a little differently…
-
#initialize ⇒ WorkCentre
constructor
Initialize instance variables.
-
#private_data ⇒ Object
Get the private data.
-
#private_data=(data) ⇒ Object
Update/set the private data.
-
#state_name ⇒ Object
State name.
Methods inherited from Api
all, build_url, delete, #extract, #field_name, find, get, #object_name, #populate, post, put, #save!, set_headers
Constructor Details
#initialize ⇒ WorkCentre
Initialize instance variables
52 53 54 55 56 57 58 59 |
# File 'lib/beanie/work_centre.rb', line 52 def initialize @id = nil @name = nil @state = nil @location = nil @description = nil @work_centre_group_id = nil end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
32 33 34 |
# File 'lib/beanie/work_centre.rb', line 32 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
32 33 34 |
# File 'lib/beanie/work_centre.rb', line 32 def id @id end |
#location ⇒ Object
Returns the value of attribute location.
32 33 34 |
# File 'lib/beanie/work_centre.rb', line 32 def location @location end |
#name ⇒ Object
Returns the value of attribute name.
32 33 34 |
# File 'lib/beanie/work_centre.rb', line 32 def name @name end |
#state ⇒ Object
Returns the value of attribute state.
32 33 34 |
# File 'lib/beanie/work_centre.rb', line 32 def state @state end |
#work_centre_group_id ⇒ Object
Returns the value of attribute work_centre_group_id.
32 33 34 |
# File 'lib/beanie/work_centre.rb', line 32 def work_centre_group_id @work_centre_group_id end |
Instance Method Details
#construct_path(opts = {}) ⇒ Object
Construct the path a little differently…
83 84 85 86 87 88 89 90 91 |
# File 'lib/beanie/work_centre.rb', line 83 def construct_path(opts = {}) if opts[:work_centre_group_id] path = "/work_centre_groups/#{opts[:work_centre_group_id]}/work_centres" opts.delete(:work_centre_group_id) else path = "/work_centres" end path end |
#private_data ⇒ Object
Get the private data
69 70 71 72 |
# File 'lib/beanie/work_centre.rb', line 69 def private_data response = WorkCentre.get(:url => "/work_centres/#{@id}/private_data") response["data"] end |
#private_data=(data) ⇒ Object
Update/set the private data
76 77 78 79 |
# File 'lib/beanie/work_centre.rb', line 76 def private_data=(data) pdata = {:data => data} response = WorkCentre.post(pdata, :url => "/work_centres/#{@id}/private_data") end |
#state_name ⇒ Object
State name
63 64 65 |
# File 'lib/beanie/work_centre.rb', line 63 def state_name STATE_NAMES[@state][0] end |