Class: Filespot::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/filespot/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



7
8
9
10
11
12
13
14
15
16
# File 'lib/filespot/response.rb', line 7

def initialize(response)
  if response.status == 200
    json_data = JSON.parse(response.body)
    @code = json_data.delete('code').to_i
    @status = json_data.delete('status')
    @data = json_data
  else
    return_error
  end
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/filespot/response.rb', line 5

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/filespot/response.rb', line 5

def data
  @data
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/filespot/response.rb', line 5

def status
  @status
end