Class: Umengo::Res

Inherits:
Object
  • Object
show all
Defined in:
lib/umengo/res.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, uri) ⇒ Res

Returns a new instance of Res.



5
6
7
8
9
# File 'lib/umengo/res.rb', line 5

def initialize(response, uri)
  @type = uri
  @status = response.status
  @body = response.body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/umengo/res.rb', line 3

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



3
4
5
# File 'lib/umengo/res.rb', line 3

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/umengo/res.rb', line 3

def type
  @type
end

Instance Method Details

#json_bodyObject



15
16
17
# File 'lib/umengo/res.rb', line 15

def json_body
  Oj.load(@body)
end

#ok?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/umengo/res.rb', line 11

def ok?
  status == 200
end