Sha256: e273a0d7f19059a8a0e27e85a3c5a99ae7951ea556ed151d0b479deb0b840600

Contents?: true

Size: 334 Bytes

Versions: 4

Compression:

Stored size: 334 Bytes

Contents

module Moip2

  class Response < SimpleDelegator

    def initialize(resp, json)
      super(RecursiveOpenStruct.new(json, :recurse_over_arrays => true))
      @resp = resp
    end

    def success?
      (200..299).include? @resp.code.to_i
    end

    def client_error?
      (400..499).include? @resp.code.to_i
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
moip2-0.1.4 lib/moip2/response.rb
moip2-0.1.3 lib/moip2/response.rb
moip2-0.1.1 lib/moip2/response.rb
moip2-0.1.0 lib/moip2/response.rb