Module: Dropmark

Defined in:
lib/dropmark.rb,
lib/dropmark/file.rb,
lib/dropmark/item.rb,
lib/dropmark/user.rb,
lib/dropmark/error.rb,
lib/dropmark/comment.rb,
lib/dropmark/version.rb,
lib/dropmark/collection.rb,
lib/dropmark/authentication.rb

Defined Under Namespace

Modules: Error Classes: Authentication, Collection, Comment, File, Item, User

Constant Summary collapse

VERSION =
"0.1.5"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_baseObject

Returns the value of attribute api_base.



15
16
17
# File 'lib/dropmark.rb', line 15

def api_base
  @api_base
end

.api_keyObject

Returns the value of attribute api_key.



15
16
17
# File 'lib/dropmark.rb', line 15

def api_key
  @api_key
end

.user_idObject

Returns the value of attribute user_id.



15
16
17
# File 'lib/dropmark.rb', line 15

def user_id
  @user_id
end

.user_tokenObject

Returns the value of attribute user_token.



15
16
17
# File 'lib/dropmark.rb', line 15

def user_token
  @user_token
end

Class Method Details

.apiObject



18
19
20
# File 'lib/dropmark.rb', line 18

def self.api
  @api
end

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

Yields:

  • (options)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/dropmark.rb', line 22

def self.configure(&blk)
  options = OpenStruct.new
  yield(options)
  
  @api_key = options.try(:api_key)
  @api_base = options.try(:api_base) || 'https://api.dropmark.com/v1'
  @user_id = options.try(:user_id)
  @user_token = options.try(:user_token)
  
  @api = Her::API.new
  @api.setup :url => @api_base do |c|
    c.use Faraday::Response::Logger
    c.use Dropmark::Authentication
    c.use Faraday::Request::Multipart
    c.use Faraday::Request::UrlEncoded
    c.use Her::Middleware::DefaultParseJSON
    c.use Faraday::Adapter::NetHttp
    c.use Dropmark::Error::RaiseError
  end
  require 'dropmark/collection'
  require 'dropmark/comment'
  require 'dropmark/item'
  require 'dropmark/user'
end