Sha256: f283cdd17f986423d17650762600a1e48682f1738ae2f31e9b159e0bc2da8b73

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 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.new(self[:request] || {})
    end
    
    def response
      Response.new(self[:response] || {})
    end
    
    def successful?
      response.result.status_code.to_s == '200'
    end
    
    def errors
      (response.result.errors || []).map {|e| OpenCascade.new(e.symbolize_keys)}
    end
    
    class Request < OpenCascade; end
    class Response < OpenCascade; end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chargify2-0.2.2 lib/chargify2/representations/call.rb
chargify2-0.2.1 lib/chargify2/representations/call.rb
chargify2-0.2.0 lib/chargify2/representations/call.rb
chargify2-0.1.0 lib/chargify2/representations/call.rb