Class: Xendit::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/xendit/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
# File 'lib/xendit/response.rb', line 7

def initialize(response)
  @status = response.status
  @data = JSONSerializer.decode(response.body)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#created?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/xendit/response.rb', line 16

def created?
  @status == 201
end

#success?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/xendit/response.rb', line 12

def success?
  [200, 201].include?(@status)
end