This repository has been archived by the owner. It is now read-only.
⛔️ DEPRECATED - A Ruby client for Bigstock's API
Branch: master
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/bigstock
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
bigstock-client.gemspec

README.md

DEPRECATED

This repo is no longer publicly supported.

bigstock-client-ruby

A Ruby client for Bigstock's API

Installation

Bigstock-Client-Ruby is available as a RubyGem:

$ gem install bigstock-client

Usage

Create an instance of the Bigstock API Client by passing in your API ID and API Secret as parameters. The client will then handle any authentication when required.

require 'bigstock/client'
client = Bigstock::Client::Client.new('API_ID', 'API_SECRET')

Then use the client to contact the Bigstock-API

Search

response = client.search('dog')
if response['message'] == 'success'
  pages = response['data']['pages']
  images = response['data']['images']
end

Additional options might be passed to the search. For a list of options see Bigstock's API documentatation

For example, to get only the first five images for 'dog' but with all image details:

response = client.search('dog', response_detail: 'all', limit: 5)

Image Detail

The image ID returned in a search response can be used to query for more information about a specific image.

response = client.image('IMAGE_ID')
if response['message'] == 'success'
  image = response['data']['image']
end

Purchase

Once you have funded your API account you will be able to download full resolution un-watermarked images.

response = client.purchase('IMAGE_ID', 'SIZE_CODE')
if response['message'] == 'success'
  download_url = client.get_download_url(response['data']['download_id'])
end

Lightboxes & Saved Images

To get the list of private lightbox content saved under your account:

response = client.lightboxes
if response['message'] == 'success'
  total_items = response['data']['total_items']
  lightboxes = response['data']['lightboxes']
end

To get the content of a lightbox

response = client.lightbox('LIGHTBOX_ID')
if response['message'] == 'success'
  pages = response['data']['pages']
  lightbox = response['data']['lightbox']
  images = response['data']['images']
end