Ricoh Media Storage API Client.
You need
Ricoh API Client Credentials (client_id & client_secret)
Ricoh ID (user_id & password)
If you don't have them, please register yourself and your client from THETA Developers Website.
Add this line to your application's Gemfile:
gem 'ricohapi-mstorage'
And then execute:
$ bundle
Or execute the following line to install the gem without bundler.
$ gem install ricohapi-mstorage
You can find a working rails sample app using Ricoh Media Storage API.
Add require 'ricohapi/mstorage'
to use the APIs below.
client = RicohAPI::Auth::Client.new '<your-client-id>', '<your-client-secret>'
client.resource_owner_credentials = '<your-user-id>', '<your-password>'
api_session = client.api_token_for! RicohAPI::MStorage::SCOPE
access_token = api_session.access_token
mstorage = RicohAPI::MStorage::Client.new client
or
mstorage = RicohAPI::MStorage::Client.new access_token
mstorage.upload content: file
mstorage.download '<media-id>'
- Without options You'll get a default list if you do not set any parameters.
mstorage.list
- With options
You can also use listing options. The available options are limit
, after
and before
.
mstorage.list limit: 25
mstorage.list after: '<cursor-id>'
- Search
Also, you can get a list searched by user metadata.
filter = {'meta.user.<key1>' => '<value1>', 'meta.user.<key2>' => '<value2>'}
mstorage.list limit: 25, after: '<cursor-id>', filter: filter
mstorage.delete '<media-id>'
mstorage.info '<media-id>'
You can define your original metadata as a 'user metadata'. Existing metadata value for the same key will be overwritten. Up to 10 user metadata can be attached to a media data.
mstorage.add_meta '<media-id>', {'user.<key1>' => '<value1>', 'user.<key2>' => '<value2>'}
- All
mstorage.meta '<media-id>'
- Exif
mstorage.meta '<media-id>', 'exif'
- Google Photo Sphere XMP
mstorage.meta '<media-id>', 'gpano'
- User metadata (all)
mstorage.meta '<media-id>', 'user'
- User metadata (with a key)
mstorage.meta '<media-id>', 'user.<key>'
- User metadata (all)
mstorage.remove_meta '<media-id>', 'user'
- User metadata (with a key)
mstorage.remove_meta '<media-id>', 'user.<key>'