Sha256: f9bf4dfb371752391fd04a1a1e3198823733041b5b7d4333874d992c9b5d1be5

Contents?: true

Size: 564 Bytes

Versions: 4

Compression:

Stored size: 564 Bytes

Contents

module CTM
  class Auth
    include HTTParty
    base_uri "https://#{(ENV["CTM_URL"] || "api.calltrackingmetrics.com")}"

    def self.token=(token)
      @token = token
    end

    def self.token
      @token
    end

    def self.authenticate(token, secret)
      res = self.post("/api/v1/authentication", :body => {:token => token, :secret => secret})
      if res.parsed_response && res.parsed_response['success']
        CTM::Token.new(res.parsed_response)
      else
        raise CTM::Error::Auth.new("Failed to authenticate")
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ctm-0.5.4 lib/ctm/auth.rb
ctm-0.5.3 lib/ctm/auth.rb
ctm-0.5.1 lib/ctm/auth.rb
ctm-0.5.0 lib/ctm/auth.rb