Class: ApiClient
- Inherits:
-
Object
- Object
- ApiClient
- Defined in:
- lib/ApiClient.rb
Instance Method Summary collapse
-
#custom_request ⇒ Object
Build a custom API request.
-
#download_images ⇒ Object
Download an image.
-
#download_videos ⇒ Object
Download a video.
-
#get_access_token ⇒ Object
Get access token to be used by the SDK.
-
#images ⇒ Object
Get metadata for images.
-
#initialize(api_key, api_secret, user_name = nil, password = nil) ⇒ ApiClient
constructor
Initialize the Credentials to be used by the SDK.
-
#search_images ⇒ Object
Search for both creative and editorial images.
-
#search_images_creative ⇒ Object
Search for creative images.
-
#search_images_editorial ⇒ Object
Search for editorial images.
-
#search_videos ⇒ Object
Search for both creative and editorial videos.
-
#search_videos_creative ⇒ Object
Search for creative videos.
-
#search_videos_editorial ⇒ Object
Search for editorial videos.
-
#videos ⇒ Object
Get metadata for videos.
Constructor Details
#initialize(api_key, api_secret, user_name = nil, password = nil) ⇒ ApiClient
Initialize the Credentials to be used by the SDK
17 18 19 20 21 22 23 24 25 |
# File 'lib/ApiClient.rb', line 17 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 |
Instance Method Details
#custom_request ⇒ Object
Build a custom API request
83 84 85 |
# File 'lib/ApiClient.rb', line 83 def custom_request() return CustomRequest.new(@credentials.client_key, @credentials.get_access_token) end |
#download_images ⇒ Object
Download an image
73 74 75 |
# File 'lib/ApiClient.rb', line 73 def download_images() return DownloadImages.new(@credentials.client_key, @credentials.get_access_token) end |
#download_videos ⇒ Object
Download a video
78 79 80 |
# File 'lib/ApiClient.rb', line 78 def download_videos() return DownloadVideos.new(@credentials.client_key, @credentials.get_access_token) end |
#get_access_token ⇒ Object
Get access token to be used by the SDK
28 29 30 |
# File 'lib/ApiClient.rb', line 28 def get_access_token return @credentials.get_access_token end |
#images ⇒ Object
Get metadata for images
63 64 65 |
# File 'lib/ApiClient.rb', line 63 def images() return Images.new(@credentials.client_key, @credentials.get_access_token) end |
#search_images ⇒ Object
Search for both creative and editorial images
33 34 35 |
# File 'lib/ApiClient.rb', line 33 def search_images() return SearchImages.new(@credentials.client_key, @credentials.get_access_token) end |
#search_images_creative ⇒ Object
Search for creative images
38 39 40 |
# File 'lib/ApiClient.rb', line 38 def search_images_creative() return SearchImagesCreative.new(@credentials.client_key, @credentials.get_access_token) end |
#search_images_editorial ⇒ Object
Search for editorial images
43 44 45 |
# File 'lib/ApiClient.rb', line 43 def search_images_editorial() return SearchImagesEditorial.new(@credentials.client_key, @credentials.get_access_token) end |
#search_videos ⇒ Object
Search for both creative and editorial videos
48 49 50 |
# File 'lib/ApiClient.rb', line 48 def search_videos() return SearchVideos.new(@credentials.client_key, @credentials.get_access_token) end |
#search_videos_creative ⇒ Object
Search for creative videos
53 54 55 |
# File 'lib/ApiClient.rb', line 53 def search_videos_creative() return SearchVideosCreative.new(@credentials.client_key, @credentials.get_access_token) end |
#search_videos_editorial ⇒ Object
Search for editorial videos
58 59 60 |
# File 'lib/ApiClient.rb', line 58 def search_videos_editorial() return SearchVideosEditorial.new(@credentials.client_key, @credentials.get_access_token) end |