Class: XJ::Spreadsheet
- Inherits:
-
Object
- Object
- XJ::Spreadsheet
- Defined in:
- lib/xj/spreadsheet.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #error ⇒ Object
-
#initialize(path) ⇒ Spreadsheet
constructor
A new instance of Spreadsheet.
- #status ⇒ Object
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(path) ⇒ Spreadsheet
Returns a new instance of Spreadsheet.
7 8 9 |
# File 'lib/xj/spreadsheet.rb', line 7 def initialize(path) @response = API.post(path) end |
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/xj/spreadsheet.rb', line 5 def response @response end |
Instance Method Details
#error ⇒ Object
11 12 13 |
# File 'lib/xj/spreadsheet.rb', line 11 def error status != 200 ? status : to_hash['error'] end |
#status ⇒ Object
15 16 17 |
# File 'lib/xj/spreadsheet.rb', line 15 def status @response.code.to_i end |
#to_hash ⇒ Object
23 24 25 |
# File 'lib/xj/spreadsheet.rb', line 23 def to_hash JSON.parse(to_json) end |
#to_json ⇒ Object
19 20 21 |
# File 'lib/xj/spreadsheet.rb', line 19 def to_json @response.body end |