Sha256: 8f07000704c0ea68588ebf33fe58beab2a7b91eb78dca9339668cc3df5128aee

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 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 }})
      puts "POST /apps: #{res.inspect}" if ENV['DEBUG']
      res if res.success?
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skylight-0.3.17 lib/skylight/api.rb
skylight-0.3.14 lib/skylight/api.rb
skylight-0.3.13 lib/skylight/api.rb