Library for Cloudn API, http://www.ntt.com/cloudn/
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Initial commit Feb 27, 2015
spec Initial commit Feb 27, 2015
.gitignore Initial commit Feb 27, 2015
.rspec Initial commit Feb 27, 2015
CloudnAPI.gemspec Update year of license and modify homepage to this GitHub Feb 27, 2015
Gemfile Initial commit Feb 27, 2015
LICENSE Update LICENSE Feb 2, 2017
README.md Added japanese readme Feb 27, 2015
README_ja.md Added japanese readme Feb 27, 2015
Rakefile Initial commit Feb 27, 2015

README.md

CloudnAPI

日本語版のREADMEはコチラ.

CloudnAPI is a library for manipulating Cloudn API easily with Ruby.

This library is designed as external library so you can't use CloudAPI alone like ./cloudn-api. If you need an executable one, then check Cloudn CLI.

Installation

Add this line to your application's Gemfile:

gem 'cloudn-api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cloudn-api

Install path option such as '--path vendor/bundle' is recommended in order to limit scope.

Usage

2 steps are required:

STEP 1. Set up Cloudn configuration

You can choose one of methods to write down the configuration:

  • a) Create JSON file(*) wherever you like, then specify it when you create instance as STEP 2.
  • b) Create JSON file at ~/.cloudnapi/config, which is the default location Cloudn API gem will seek.
  • c) Set 3 Environmental Variables : 'CLOUDN_API_KEY', 'CLOUDN_SECRET_KEY', 'CLOUDN_URL'. The values of them is same as JSON file as follows.

*JSON file :

{
  "url" : "CLOUDN API ENDPOINT",
  "api_key" : "YOUR API KEY",
  "secret_key" : "YOUR SECRET KEY",
  "debug_level" : "info"
}

The string of debug_level is based on Ruby Logger.

STEP 2. Create instance of Cloudn API (Synopsis)

Write down some fancy codes with Cloudn API.

require 'cloudn-api'

# Create Cloudn API instance
client = CloudnAPI::Client.new

# Configuration file can be specified here explicitly.
## client = CloudnAPI::Client.new('hoge/foobar.json')

# Then use Cloudn API

## when an API doesn't need any options, call method with no argument like this:
client.listUsers

## when an API needs options, then call method with arguments like this:
client.listUsers({ keyword: 'YOUR KEY WORD' })

Methods available are checked at :

Misc

  • Async query is handled as synced query, which means CloudnAPI library waits for http response from Cloudn.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/CloudnAPI/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request