Class: XJ::Spreadsheet

Inherits:
Object
  • Object
show all
Defined in:
lib/xj/spreadsheet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#responseObject

Returns the value of attribute response.



5
6
7
# File 'lib/xj/spreadsheet.rb', line 5

def response
  @response
end

Instance Method Details

#errorObject



11
12
13
# File 'lib/xj/spreadsheet.rb', line 11

def error
  status != 200 ? status : to_hash['error']
end

#statusObject



15
16
17
# File 'lib/xj/spreadsheet.rb', line 15

def status
  @response.code.to_i
end

#to_hashObject



23
24
25
# File 'lib/xj/spreadsheet.rb', line 23

def to_hash
  JSON.parse(to_json)
end

#to_jsonObject



19
20
21
# File 'lib/xj/spreadsheet.rb', line 19

def to_json
  @response.body
end