Sha256: 25a1767bab5c9bd0a66ad05d4de507bf177438d2b88094ef942b554d3d0c6463
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
# Connect SDK by Getty Images. # Provides an interface to Getty Images connect api. # # The goal of the SDK is to simplify credential management and provide a reusable library # for developers. require_relative "Credentials" require_relative "SearchRequest" require_relative "ImagesRequest" require_relative "DownloadRequest" # ConnectSDK # Provides a code api for interacting with getty rest services. # {https://connect.gettyimages.com/swagger/ui/index.html Connect Getty Images API} class ConnectSdk # Initialize the Credentials to be used by the SDK def initialize(api_key, api_secret, user_name = nil, password = nil) @credentials = Credentials.new( :credential_type => (user_name.nil?) || (password.nil?) ? OAuthGrantType::CLIENT_CREDENTIALS : OAuthGrantType::PASSWORD, :client_key => api_key, :client_secret => api_secret, :user_name => user_name, :password => password) end # Get access token to be used by the SDK def get_access_token return @credentials.get_access_token end # Create a search configuration that support image searching # SearchRequest configured for a image search def search() return SearchRequest.new(@credentials.client_key, @credentials.get_access_token) end # Create a image details configuration that support image details # == Returns: # ImagesRequest configured for a image details def images() return ImagesRequest.new(@credentials.client_key, @credentials.get_access_token) end def download return DownloadRequest.new(@credentials.client_key, @credentials.get_access_token) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ConnectSDK-1.0.2.Beta | lib/ConnectSDK.rb |
ConnectSDK-1.0.1.Beta | lib/ConnectSDK.rb |