Find file
Fetching contributors…
Cannot retrieve contributors at this time
137 lines (96 sloc) 3.28 KB

Designer News Ruby API Client

Travis CI

This is the Ruby client library that wraps the Designer News API. It assumes you have used another oAuth 2 library to obtain and manage a valid access token. It is based on the Ruby gem for the LayerVault API.


Put this in your Gemfile and smoke it:

gem 'dn'

Or install it:

$ gem install dn

Supported oAuth flows

Currently only Resource Owner Credentials and Client Credentials are supported.

Requesting an Access Token

  1. Please send an email to to request your API credentials. Please include your callback URL. One day, this might be automated.
  2. Receive a friendly note back from the LayerVault staff with your application credentials.
  3. Note your client_id and client_secret.
  4. Try the example Access Token request below.
curl -i \
  -F grant_type="password" \
  -F username="<username_goes_here>" \
  -F password="<password_goes_here>" \
  -F client_id="<client_id_goes_here>" \
  -F client_secret="<client_secret_goes_here>"
  1. You now have an access token. You can make API requests by calling via CURL like so:
curl -H 'Authorization: Bearer <your access token>' \

Initializing the Client

You can initialize the client via Environment Variables or by passing configurations options into the client when you create it, like this:

@client ={
  access_token: 'your_access_token',
  api_endpoint: 'your_api_endpoint'

Or you can also say:

DesignerNews.client.access_token = 'access_token'
DesignerNews.client.api_endpoint = 'api_endpoint'

Environment Variables

# You Designer News API access token

# The API Endpoint you wish to target calls against (defaults to

# Defaults to Designer News Ruby Gem #{DesignerNews::VERSION}

The User Agent

You should set the User agent to include your email address so that in the event your client does something wrong we can contact you.

Making API calls

You should instantiate a DesignerNews::Client object and then make calls from that:

client ={
  access_token: 'your_access_token',
  api_endpoint: 'your_api_endpoint'


And so on.

Local Development

Coming soon.

Client Methods Summary

User Info



#reply_to_story(story_id, comment)


#reply_to_comment(comment_id, comment)