Sha256: 7528887187151f6c4ec9bf2b459542a88e27194ce6cf1b0f0b5dd745c9e0fde0

Contents?: true

Size: 336 Bytes

Versions: 2

Compression:

Stored size: 336 Bytes

Contents

require_relative 'json_serializer'

module Xendit
  class Response
    attr_reader :status, :body

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

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

    def created?
      @status == 201
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xendit-client-0.1.1 lib/xendit/response.rb
xendit-client-0.1.0 lib/xendit/response.rb