Sha256: 282672bf63bbfbd98ca7cc65791c5ccdb9e4c179e2eb386c6a471a4246492902

Contents?: true

Size: 716 Bytes

Versions: 3

Compression:

Stored size: 716 Bytes

Contents

module Chargify2
  class Call < Hashie::Dash
    property :id
    property :api_id
    property :timestamp
    property :nonce
    property :success
    property :request
    property :response

    Request  = Class.new(Hashery::OpenCascade)
    Response = Class.new(Hashery::OpenCascade)
    
    def request
      h = self[:request] || {}
      Request[h.recursive_symbolize_keys]
    end
    
    def response
      h = self[:response] || {}
      Response[h.recursive_symbolize_keys]
    end
    
    def successful?
      response.result.status_code.to_s == '200'
    end
    
    def errors
      (response.result.errors || []).map {|e| Hashery::OpenCascade[e.recursive_symbolize_keys]}
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chargify2-0.2.8 lib/chargify2/representations/call.rb
chargify2-0.2.7 lib/chargify2/representations/call.rb
chargify2-0.2.6 lib/chargify2/representations/call.rb