Module: Tumbz

Defined in:
lib/tumbz.rb,
lib/tumbz/like.rb,
lib/tumbz/user.rb,
lib/tumbz/model.rb,
lib/tumbz/config.rb,
lib/tumbz/review.rb,
lib/tumbz/comment.rb,
lib/tumbz/product.rb,
lib/tumbz/version.rb,
lib/tumbz/partner_lookup.rb,
lib/tumbz/middleware/auth.rb,
lib/tumbz/user_suggestion.rb,
lib/tumbz/middleware/parse.rb,
lib/tumbz/middleware/api_key.rb

Defined Under Namespace

Modules: Middleware, Model Classes: Comment, Config, Like, PartnerLookup, Product, Review, User, UserSuggestion

Constant Summary collapse

VERSION =
"0.0.5"

Class Method Summary collapse

Class Method Details

.access_tokenObject



21
22
23
# File 'lib/tumbz.rb', line 21

def self.access_token
  @access_token
end

.access_token=(token) ⇒ Object



17
18
19
# File 'lib/tumbz.rb', line 17

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

.apiObject



13
14
15
# File 'lib/tumbz.rb', line 13

def self.api
  @api
end

.configure {|options| ... } ⇒ Object

Yields:

  • (options)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/tumbz.rb', line 25

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