Skip to content

mrzen/assetzen-ruby

Repository files navigation

AssetZen Ruby

Build Status Coverage Status

Official library for AssetZen.

Installation

Using Bundler (recommended)

  gem 'assetzen'

Using gem

  gem install assetzen

Usage

You will need to create an application in order to use the API. You will also need to get and store a user access grant in order to make API calls. This is not handled by the library as it is specific to the application, as you will need to provide a callback in your application to redirect the user once they approve authorization, and a secure storage mechanism for the granted tokens.

Searching Images

require 'assetzen'

@client = AssetZen::API::Client.new do |config|
  config.credentials = some_method_to_get_credentials
end

images = @client.images(q: 'food')

Linking an image

  @client = some_method_to_get_client # see previous example
  image = @client.images(q: 'food').sample # Sample random match
  url = image.signed_link(width: 800, height: 600)

  image_tag href: url

Updating an Image

  @client = some_method_to_get_client # see first example
  image = @client.image('example') # get image with ID 'example'

  image.title = "My new image title"
  image.save

About

Official AssetZen Library for Ruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages