Sha256: 7cc6ad418cccfe651c63f23e5ea800d90fb3625d86cb2f2f1ad49be86b78d21d

Contents?: true

Size: 672 Bytes

Versions: 36

Compression:

Stored size: 672 Bytes

Contents

module Skylight
  class Api
    include Util::Logging

    attr_reader :config, :http

    def initialize(config, service = :accounts)
      @config = config
      @http   = Util::HTTP.new(config, service)
    end

    def authentication
      @http.authentication
    end

    def authentication=(token)
      @http.authentication = token
    end

    def login(email, password)
      res = http.get('/me', 'X-Email' => email, 'X-Password' => password)

      if res && res.success?
        res.get('me.authentication_token')
      end
    end

    def create_app(name)
      res = @http.post('/apps', { app: { name: name }})
      res if res.success?
    end

  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
skylight-0.3.0 lib/skylight/api.rb
skylight-0.2.7 lib/skylight/api.rb
skylight-0.2.6 lib/skylight/api.rb
skylight-0.3.0.rc.6 lib/skylight/api.rb
skylight-0.2.5 lib/skylight/api.rb
skylight-0.2.4 lib/skylight/api.rb
skylight-0.3.0.rc.5 lib/skylight/api.rb
skylight-0.3.0.rc.4 lib/skylight/api.rb
skylight-0.3.0.rc.3 lib/skylight/api.rb
skylight-0.2.3 lib/skylight/api.rb
skylight-0.2.2 lib/skylight/api.rb
skylight-0.2.1 lib/skylight/api.rb
skylight-0.2.0 lib/skylight/api.rb
skylight-0.2.0.beta.4 lib/skylight/api.rb
skylight-0.2.0.beta.3 lib/skylight/api.rb
skylight-0.2.0.beta.2 lib/skylight/api.rb
skylight-0.2.0.beta.1 lib/skylight/api.rb
skylight-0.1.8 lib/skylight/api.rb
skylight-0.1.7 lib/skylight/api.rb
skylight-0.1.7.alpha1 lib/skylight/api.rb