Sha256: e00b032edc0fd4c61504354d21c201d4e897d40e65c01c63550622bb786255e7

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require 'httmultiparty'

require_relative 'boxview/document'
require_relative 'boxview/session'
require_relative 'boxview/errors'

module BoxView
  include HTTMultiParty

  BASE_URI = 'https://view-api.box.com'

  MULTIPART_URI = 'https://upload.view-api.box.com'

  BASE_PATH = '/1'

  base_uri BASE_URI

  class << self

    attr_accessor :api_key, :document_id, :session_id

    # Description:
    # =>
    # No Params!
    def headers
      {
        'Authorization' => "Token #{api_key}",
        'Content-type' => 'application/json'
      }
    end

    # Description:
    # =>
    # No Params!
    def api_key
      raise BoxView::Errors::ApiKeyNotFound if @api_key.nil?
      @api_key
    end

    # Description:
    # =>
    # No Params!
    def document_id
      raise BoxView::Errors::DocumentIdNotFound if @document_id.nil?
      @document_id
    end

    # Description:
    # =>
    # No Params!
    def session_id
      raise BoxView::Errors::SessionIdNotFound if @session_id.nil?
      @session_id
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
boxview.rb-0.1.3 lib/boxview.rb
boxview.rb-0.1.2 lib/boxview.rb
boxview.rb-0.1.1 lib/boxview.rb
boxview.rb-0.0.9 lib/boxview.rb