Class: Icasework::Case
- Inherits:
-
Object
- Object
- Icasework::Case
- Defined in:
- lib/icasework/case.rb
Overview
A Ruby representation of a case in iCasework
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
- #case_id ⇒ Object
- #classifications ⇒ Object
- #documents ⇒ Object
-
#initialize(hash) ⇒ Case
constructor
A new instance of Case.
- #to_h ⇒ Object
Constructor Details
Class Method Details
.create(params) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/icasework/case.rb', line 18 def create(params) data = Icasework::Resource.create_case(params).data[:createcaseresponse] return nil unless data new(case_details: { case_id: data[:caseid] }) end |
Instance Method Details
#[](key) ⇒ Object
62 63 64 |
# File 'lib/icasework/case.rb', line 62 def [](key) @hash[key] end |
#case_id ⇒ Object
58 59 60 |
# File 'lib/icasework/case.rb', line 58 def case_id self[:case_details][:case_id] end |
#classifications ⇒ Object
66 67 68 |
# File 'lib/icasework/case.rb', line 66 def classifications @hash[:classifications].map { |c| Classification.new(c) } end |
#documents ⇒ Object
70 71 72 |
# File 'lib/icasework/case.rb', line 70 def documents @hash[:documents].map { |d| Document.new(d) } end |
#to_h ⇒ Object
74 75 76 |
# File 'lib/icasework/case.rb', line 74 def to_h @hash.to_h end |