A Ruby API wrapper for The Noun Project API's
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.codeclimate.yml
.gitignore
.hound.yml
.rubocop.yml
.semver
.travis.yml
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
circle.yml
noun-project-api.gemspec

README.md

The Noun Project Ruby API Wrapper

A Ruby API wrapper for The Noun Project API's

Gem VersionDependency Status Build Status Circle CI Code Climate Test Coverage

gem "noun-project-api", "~> 1.0.0"

Missing

Current version only wraps the Icon/Icons API's. Feel free to send a pull request with more API's wrapped!

Usage

You need a valid pair of token and secret to use the Gem, you can get these by signing up here

Raises ArgumentError on bad arguments

Configuration

You can use an initializer for example if you're on Rails.

# initializers/noun_project_api.rb
NounProjectApi.configure do |config|
  # Will only show public domain icons when running in dev/test envs
  config.public_domain = ['development', 'test'].include?(ENV['RAILS_ENV'])
end

Find single icon

Initialize

icon_finder = NounProjectApi::IconRetriever.new(token, secret)

Find an Icon by id source

result = icon_finder.find(1) # Returns a hash of the parsed JSON result.

Find an Icon by slug source

result = icon_finder.find_by_slug('globe') # Returns a hash of the parsed JSON result.

Search icons

Initialize

icons_finder = NounProjectApi::IconsRetriever.new(token, secret)

Optional arguments for both methods are limit, offset and page

Find Icons source

result = icons_finder.find('cat') # Returns an array of the parsed JSON results.

Get recent Icons source

result = icons_finder.recent_uploads # Returns an array of the parsed JSON results.

Find a collection of icons

Initialize

collection_finder = NounProjectApi::CollectionRetriever.new(token, secret)

Find a Collection by id source

result = collection_finder.find(1) # Returns a hash of the parsed JSON result.

Find a Collection by slug source

result = collection_finder_finder.find_by_slug('national-park-service') # Returns a hash of the parsed JSON result.

Resulting objects

The resulting object is either a NounObjectApi::Icon or an array of ones.

result.class # NounProjectApi::Icon
result.id # 1
result.public_domain? # true/false
result.svg_url # url/nil
result.preview_url # 200 size preview url
result.preview_url(42) # 42 size preview url

# You can always access the original Hash at
result.original_hash

Disclaimer

This is completely unofficial and is not related to The Noun Project in any way.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About Tailor Brands

Check us out!