Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dn

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dn

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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.

Installation

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 news@layervault.com 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 https://api-news.layervault.com/oauth/token \
  -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>' \
  'https://api-news.layervault.com/api/v1/me'

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 = DesignerNews::Client.new({
  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
ENV['DESIGNER_NEWS_ACCESS_TOKEN']

# The API Endpoint you wish to target calls against (defaults to https://api-news.layervault.com/api/v1/)
ENV['DESIGNER_NEWS_API_ENDPOINT']

# Defaults to Designer News Ruby Gem #{DesignerNews::VERSION}
ENV['DESIGNER_NEWS_USER_AGENT']

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 can use the DesignerNews.client.<api_operation> methods to call the API to perform actions. Alternatively, each API object has simple object model that allows you to say:

DesignerNews.client.access_token = 'access_token'
p = DesignerNews::Organization.for('layervault')
p.create_project('my new project')

And so on.

Simple Object Model

There's a very simple object model provided by classes that implement Hashie objects that wrap the JSON responses from the DesignerNews.client interface. The objects mostly all follow a .for pattern that accepts the appropriate number of arguments for the level of nesting the object represents.

Associations

When using the simple object model, associations will be hydrated into the correct child objects for the immediate child relationships only, allowing a simple level of traversal down the object model hierarchy. There is no lazy loding support that will automatically hydrated any deeper associations - you must perform new queries.

Local Development

Coming soon.

Client Methods Summary

General

  • DesignerNews.client.me

FAQs

Package last updated on 23 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc