Sha256: 7934828856ef2ddfb92ceb1ea327333a1b994066a59350026a1361301cfa34ee

Contents?: true

Size: 794 Bytes

Versions: 3

Compression:

Stored size: 794 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.recursive_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

3 entries across 3 versions & 1 rubygems

Version Path
chargify2-0.2.8 lib/chargify2/client.rb
chargify2-0.2.7 lib/chargify2/client.rb
chargify2-0.2.6 lib/chargify2/client.rb