Class: ApiClient

Inherits:
Object
  • Object
show all
Defined in:
lib/ApiClient.rb

Instance Method Summary collapse

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_requestObject

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_imagesObject

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_videosObject

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_tokenObject

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

#imagesObject

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_imagesObject

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_creativeObject

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_editorialObject

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_videosObject

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_creativeObject

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_editorialObject

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

#videosObject

Get metadata for videos



68
69
70
# File 'lib/ApiClient.rb', line 68

def videos()
	return Videos.new(@credentials.client_key, @credentials.get_access_token)
end