Sha256: b493e6b4649a6a4353348ab6cc374621841dfe4555358e96092913ef1d51ac5d

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

module Chargify2
  class Call < Hashie::Dash
    property :id
    property :api_id
    property :timestamp
    property :nonce
    property :success
    property :request
    property :response
    
    def request
      Request[self[:request] || {}]
    end
    
    def response
      Response[self[:response] || {}]
    end
    
    def successful?
      response.result.status_code.to_s == '200'
    end
    
    def errors
      (response.result.errors || []).map {|e| Hashery::OpenCascade[e.symbolize_keys]}
    end
    
    class Request < Hashery::OpenCascade; end
    class Response < Hashery::OpenCascade; end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chargify2-0.2.5 lib/chargify2/representations/call.rb
chargify2-0.2.4 lib/chargify2/representations/call.rb