Class: Callapi::Call::Parser

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/callapi/call/response.rb

Overview

Change it to Callapi::Call::Parser::Base

Direct Known Subclasses

Json, Plain

Defined Under Namespace

Classes: Json, Plain

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Parser

Returns a new instance of Parser.



11
12
13
# File 'lib/callapi/call/response.rb', line 11

def initialize(response)
  @response = response
end

Instance Method Details

#dataObject



15
16
17
18
19
20
21
22
# File 'lib/callapi/call/response.rb', line 15

def data
  return @data if @data

  raise_error unless ok?
  return nil if no_content?

  @data = parse
end

#statusObject



24
25
26
# File 'lib/callapi/call/response.rb', line 24

def status
  code.to_i
end