Sha256: d496089c1f17b9f11fd3a03b6ca1e74ea02ed8646b8406929c6978b419610631

Contents?: true

Size: 801 Bytes

Versions: 5

Compression:

Stored size: 801 Bytes

Contents

# chargify = Chargify::Client.new(:api_id => '123', :api_password => 'passwerd')
#
# call = chargify.calls.read(100)
# call.id
# # => 100
#
# calls = chargify.calls.list
# calls.metadata
#
# chargify.direct
module Chargify2
  class Client
    BASE_URI = "https://api.chargify.com/api/v2"

    attr_reader :api_id
    attr_reader :api_password
    attr_reader :api_secret
    attr_reader :base_uri
    
    def initialize(args = {})
      options = args.symbolize_keys
      
      @api_id       = options[:api_id]
      @api_password = options[:api_password]
      @api_secret   = options[:api_secret]
      @base_uri     = options[:base_uri] || BASE_URI
    end
    
    def direct
      Chargify2::Direct.new(self)
    end
    
    def calls
      Chargify2::CallResource.new(self)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chargify2-0.2.4 lib/chargify2/client.rb
chargify2-0.2.2 lib/chargify2/client.rb
chargify2-0.2.1 lib/chargify2/client.rb
chargify2-0.2.0 lib/chargify2/client.rb
chargify2-0.1.0 lib/chargify2/client.rb