Sha256: 91ffcfbe18c3a70851c4a857dd51cf291a5a8937aa67fa99bded956b47e3dc2f

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# Dependencies
require "her"

# Modules
require "tumbz/version"
require "tumbz/model"
require "tumbz/config"
require "tumbz/middleware/parse"
require "tumbz/middleware/api_key"
require "tumbz/middleware/auth"

module Tumbz
  def self.api
    @api
  end

  def self.access_token=(token)
    @access_token = token
  end

  def self.access_token
    @access_token
  end

  def self.configure(&blk)
    options = OpenStruct.new
    yield(options)

    @api = Her::API.new
    @api.setup :url => "http://api.tum.bz/v1/" do |connection|
      # Request middleware
      connection.use Tumbz::Middleware::ApiKey, :api_key => options.api_key
      connection.use Tumbz::Middleware::Auth
      connection.use Faraday::Request::UrlEncoded

      # Response middleware
      connection.use Tumbz::Middleware::Parse
      connection.use Faraday::Adapter::NetHttp
    end

    require "tumbz/comment"
    require "tumbz/like"
    require "tumbz/review"
    require "tumbz/partner_lookup"
    require "tumbz/product"
    require "tumbz/user"
    require "tumbz/user_suggestion"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tumbz-0.0.5 lib/tumbz.rb
tumbz-0.0.4 lib/tumbz.rb
tumbz-0.0.3 lib/tumbz.rb
tumbz-0.0.2 lib/tumbz.rb