Dropmark Gem
Installation
The Dropmark gem is available for installation on Rubygems. To install run:
gem install dropmark # todo
Using this gem in your application
To use this gem in your application, add the following to your Gemfile:
gem 'dropmark', :git => 'git://github.com/dropmark/dropmark-gem.git'
Using the API
This gem allows you to interact with the Dropmark API.
require 'dropmark'
Dropmark.configure do |config|
config.api_key = 'API_KEY'
config.api_base = 'https://api.dropmark.com/v1'
config.user_id = 'USER_ID'
config.user_token = 'USER_TOKEN'
end
user = Dropmark::User.auth(email: 'EMAIL', password: 'PASSWORD')
user = Dropmark::User.find('me')
collections = Dropmark::Collection.all(page: 1, count: 20)
collection = Dropmark::Collection.find(133727)
collection = Dropmark::Collection.create(
name: 'New collection',
type: 'private',
sort_by: 'created_at',
sort_order: 'desc',
thumbnails: 'square',
labels: 'true',
)
collection.destroy
Dropmark::Collection.destroy_existing(133727)
collections = Dropmark::Collection.sort([101, 102, 103])
items = collection.items
items = Dropmark::Item.where(collection_id: 133727)
item = Dropmark::Item.find(2139403)
items = collection.sort_items([101, 102, 103])
items = Dropmark::Item.sort(collection_id, [101, 102, 103])
item = collection.items.create(content: 'http://dropmark.com')
item = Dropmark::Item.create(
collection_id: 133727,
name: 'Logo',
content: 'http://dropmark.com/assets/images/logo.png',
description: 'Dropmark logo',
link: 'http://dropmark.com',
thumbnail: 'http://dropmark.com/assets/images/logo.png',
shareable: 'true'
)
item = Dropmark::Item.create(
collection_id: 133727,
content: Dropmark::File.new('~/photo.jpg')
)
item.name = 'My Photo'
item.save
item = Dropmark::Item.save_existing(2316519, name: 'My Photo')
item.destroy
Dropmark::Item.destroy_existing(2139403)
comments = item.comments.all
comment = item.comments.create(body: 'My comment')
comment = Dropmark::Comment.create(item_id: 2316545, body: 'My comment')
comment.destroy
Dropmark::Comment.destroy_existing(2139403)
Contributing
Help us improve this gem:
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request