Sha256: 56f1be7934aeb7b2f15def1bd81f30f3c92a947bc1d1edf7221984428e3f54e5

Contents?: true

Size: 645 Bytes

Versions: 7

Compression:

Stored size: 645 Bytes

Contents

module Skylight
  class Api
    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

7 entries across 7 versions & 1 rubygems

Version Path
skylight-0.3.10 lib/skylight/api.rb
skylight-0.3.8 lib/skylight/api.rb
skylight-0.3.7 lib/skylight/api.rb
skylight-0.3.6 lib/skylight/api.rb
skylight-0.3.3 lib/skylight/api.rb
skylight-0.3.2 lib/skylight/api.rb
skylight-0.3.1 lib/skylight/api.rb