Sha256: 94165f2e1117e4776b7ae3d62c0e178077a57d6a091a67becef7bad82123d2a5

Contents?: true

Size: 697 Bytes

Versions: 7

Compression:

Stored size: 697 Bytes

Contents

module T2Airtime
  class Base
    attr_reader :user,
                :password,
                :url,
                :params

    def initialize(user, password, url)
      @user = user
      @password = password
      @url = url
      @params = {}
    end

    def self.api
      @api ||= new(
        ENV['T2_SHOP_USER'],
        ENV['T2_AIRTIME_KEY'],
        "https://#{T2Airtime::AIRTIME_DN}.#{T2Airtime::DOMAIN}/#{T2Airtime::ENDPOINT}"
      )
    end

    def run_action(name, method = :get)
      request = T2Airtime::Request.new(@user, @password, @url, name, @params)
      request.run(method).on_complete do |reply|
        return T2Airtime::Reply.new(reply)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
t2_airtime-0.6.0 lib/t2_airtime/base.rb
t2_airtime-0.5.2 lib/t2_airtime/base.rb
t2_airtime-0.5.1 lib/t2_airtime/base.rb
t2_airtime-0.5.0 lib/t2_airtime/base.rb
t2_airtime-0.4.1 lib/t2_airtime/base.rb
t2_airtime-0.4.0 lib/t2_airtime/base.rb
t2_airtime-0.3.1 lib/t2_airtime/base.rb