14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/getty_up/api/search_for_images.rb', line 14
def search_for_images(phrase, start = 1, count = 25, options = {})
request = {
:RequestHeader => { :Token => @token},
:SearchForImages2RequestBody => {
:Query => { :SearchPhrase => phrase},
:ResultOptions => {
ItemStartNumber: start,
ItemCount: count
},
:Filter => { :ImageFamilies => ["creative"] }
}.merge(options)
}
response = post_json(request, ENDPOINT)
result = OpenStruct.new
result. = response["ResponseHeader"] result.images = response["SearchForImagesResult"]["Images"]
result
end
|