Project

getty

0.0
No commit activity in last 3 years
No release in over 3 years
Gives access to all endpoints in version 1 of Getty's API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 1.5
~> 1.4
< 2.0.0, >= 0.0.5

Runtime

~> 0.8
< 3.0.0, >= 1.0
 Project Readme

Getty API DRY mode

Example usage:

  # SETUP GETTY API
  Getty.configure do |config|
    config.system_id = 'id'
    config.system_pwd = 'pass'
    config.user_name = "username"
    config.user_pwd = "password"
  end

  # CREATE SESSION
  @client = Getty::Client.new
  session = @client.create_session
  token =  session.SecureToken

  # SEARCH RESULTS
  search_results = @client.search(token, :query => "soccer", :limit => 1)

  image_ids = []
  search_results.Images.each do |sr|
    puts "#{sr.ImageId} #{sr.Artist} #{sr.Caption}"
    image_ids << sr.ImageId
  end

  # AUTHORIZE DOWNLOADS
  authorizations = @client.largest_image_authorizations(token, :image_ids => image_ids)

  download_tokens = []
  authorizations.Images.each do |image| 
    image.Authorizations.each do |auth|
      download_tokens << auth.DownloadToken
    end
  end

  # PRINT DOWNLOAD STRING
  download = @client.download_image(token, :download_tokens => download_tokens)
  download.DownloadUrls.each do |url|
    system "open \"#{url.UrlAttachment}\""
  end