Sha256: 6eb919dd0fe32509b52378daf0fed15afb2a8bd23a481bf9fde951a4a91f1cc3

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

module Skylight
  # @api private
  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

2 entries across 2 versions & 1 rubygems

Version Path
skylight-0.3.12 lib/skylight/api.rb
skylight-0.3.11 lib/skylight/api.rb