Class: LingotekClient::Resource::Workflow
- Defined in:
- lib/lingotek-client/resource/workflow.rb
Constant Summary
Constants inherited from Base
Base::ERRORS, Base::FAIL, Base::RESULTS
Instance Attribute Summary collapse
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#id ⇒ Object
Returns the value of attribute id.
-
#mod ⇒ Object
Returns the value of attribute mod.
-
#name ⇒ Object
Returns the value of attribute name.
-
#steps ⇒ Object
Returns the value of attribute steps.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Workflow
constructor
A new instance of Workflow.
Methods inherited from Base
Constructor Details
#initialize(attrs) ⇒ Workflow
Returns a new instance of Workflow.
6 7 8 9 10 11 12 13 |
# File 'lib/lingotek-client/resource/workflow.rb', line 6 def initialize(attrs) super(attrs) @id = attrs['id'] @name = attrs['name'] @desc = attrs['desc'] @mod = attrs['mod'] @steps = attrs['steps'] end |
Instance Attribute Details
#desc ⇒ Object
Returns the value of attribute desc.
4 5 6 |
# File 'lib/lingotek-client/resource/workflow.rb', line 4 def desc @desc end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/lingotek-client/resource/workflow.rb', line 4 def id @id end |
#mod ⇒ Object
Returns the value of attribute mod.
4 5 6 |
# File 'lib/lingotek-client/resource/workflow.rb', line 4 def mod @mod end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/lingotek-client/resource/workflow.rb', line 4 def name @name end |
#steps ⇒ Object
Returns the value of attribute steps.
4 5 6 |
# File 'lib/lingotek-client/resource/workflow.rb', line 4 def steps @steps end |
Class Method Details
.find(id) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/lingotek-client/resource/workflow.rb', line 15 def self.find(id) action_name = key object = JSON.parse(Lingotek::API::api.send("get#{action_name}", "id" => id)) raise Exception.new "API call failed" if object[Lingotek::API::Base::RESULTS] == Lingotek::API::Base::FAIL object = self.new object[action_name.downcase] raise Exception.new "#{Key} not found" if object.id == nil object end |