Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

moiesk/bigstock-ruby-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Ruby client for Bigstock's API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%