Sha256: 0db5170f45bdcadfedf44c702283013af5bb7f88737c63e31e99347e9ee996b1

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require_relative "RequestBase"

class SearchImages < RequestBase

	CONNECT_ROUTE = "/v3/search/images" # mashery endpoint	
	@@search_route = CONNECT_ROUTE
	QUERY_PARAMS_NAMES = ["phrase","editorial_segments","graphical_styles","license_models","orientations","exclude_nudity","embed_content_only","page","page_size"]

	QUERY_PARAMS_NAMES.each do |key|
    define_method :"with_#{key}" do |value = true| 
    		if value.is_a?(Array)
    			build_query_params(key, value.join(","))
    		else
    			build_query_params(key, value)
    		end
    		return self
    	end
  	end

	# {https://connect.gettyimages.com/swagger/ui/index.html#!/Search/Search_GetCreativeImagesByPhrase Creative Swagger}
	# with_graphical_styles
	# with_license_models
	def creative()
		@@search_route = "#{CONNECT_ROUTE}/creative"
		return self
	end	

	def editorial()
		@@search_route = "#{CONNECT_ROUTE}/editorial"
		return self
	end

	def execute
		return @http_helper.get(@@search_route, @query_params)			
	end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ConnectSDK-1.0.2.Beta lib/SearchImages.rb
ConnectSDK-1.0.1.Beta lib/SearchImages.rb