getty_connect 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,15 +49,20 @@ module GettyConnect
|
|
49
49
|
end
|
50
50
|
|
51
51
|
# Returns list of authorized downloads
|
52
|
-
get_largest_download_auth(asset_ids)
|
52
|
+
def get_largest_download_auth(asset_ids, options={})
|
53
|
+
asset_id_list = Array.new()
|
54
|
+
asset_ids.each do |aid|
|
55
|
+
asset_id_list << {:ImageId=>aid}
|
56
|
+
end
|
57
|
+
|
53
58
|
request = {
|
54
59
|
:RequestHeader => {
|
55
60
|
:Token => self.token,
|
56
61
|
:CoordinationId => options[:coordination_id] || ""
|
57
62
|
},
|
58
63
|
:GetLargestImageDownloadAuthorizationsRequestBody => {
|
59
|
-
:
|
60
|
-
}
|
64
|
+
:Images => asset_id_list
|
65
|
+
},
|
61
66
|
}
|
62
67
|
post(@download_largest_endpoint, request)
|
63
68
|
end
|
@@ -15,7 +15,7 @@ module GettyConnect
|
|
15
15
|
}
|
16
16
|
}.merge options
|
17
17
|
|
18
|
-
response = post(@create_session_endpoint, options)
|
18
|
+
response = post(@create_session_endpoint, options, use_ssl=true)
|
19
19
|
if response.ResponseHeader.Status == "success"
|
20
20
|
self.token = response.CreateSessionResult.Token
|
21
21
|
self.secure_token = response.CreateSessionResult.SecureToken
|
@@ -40,7 +40,7 @@ module GettyConnect
|
|
40
40
|
"Token must be first requested."
|
41
41
|
end
|
42
42
|
|
43
|
-
response = post(@renew_session_endpoint, options)
|
43
|
+
response = post(@renew_session_endpoint, options, use_ssl=true)
|
44
44
|
if response.ResponseHeader.Status == "success"
|
45
45
|
self.token_renewed_at = Time.now()
|
46
46
|
end
|
@@ -5,8 +5,11 @@ module GettyConnect
|
|
5
5
|
module Connection
|
6
6
|
private
|
7
7
|
|
8
|
-
def connection
|
9
|
-
url = "
|
8
|
+
def connection(use_ssl=false)
|
9
|
+
url = "http://connect.gettyimages.com"
|
10
|
+
if (use_ssl)
|
11
|
+
url = "https://connect.gettyimages.com"
|
12
|
+
end
|
10
13
|
|
11
14
|
options = {
|
12
15
|
:ssl => { :verify => false },
|
@@ -2,40 +2,40 @@ require 'multi_json'
|
|
2
2
|
|
3
3
|
module GettyConnect
|
4
4
|
module Request
|
5
|
-
def delete(path, options={})
|
6
|
-
request(:delete, path, options)
|
5
|
+
def delete(path, options={}, use_ssl=false)
|
6
|
+
request(:delete, path, options, use_ssl)
|
7
7
|
end
|
8
8
|
|
9
|
-
def get(path, options={})
|
10
|
-
request(:get, path, options)
|
9
|
+
def get(path, options={}, use_ssl=false)
|
10
|
+
request(:get, path, options, use_ssl)
|
11
11
|
end
|
12
12
|
|
13
|
-
def patch(path, options={})
|
14
|
-
request(:patch, path, options)
|
13
|
+
def patch(path, options={}, use_ssl=false)
|
14
|
+
request(:patch, path, options, use_ssl)
|
15
15
|
end
|
16
16
|
|
17
|
-
def post(path, options={})
|
18
|
-
request(:post, path, options)
|
17
|
+
def post(path, options={}, use_ssl=false)
|
18
|
+
request(:post, path, options, use_ssl)
|
19
19
|
end
|
20
20
|
|
21
|
-
def put(path, options={})
|
22
|
-
request(:put, path, options)
|
21
|
+
def put(path, options={}, use_ssl=false)
|
22
|
+
request(:put, path, options, use_ssl)
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
26
26
|
|
27
|
-
def request(method, path, options)
|
28
|
-
response = connection().send(method) do |request|
|
27
|
+
def request(method, path, options, use_ssl)
|
28
|
+
response = connection(use_ssl).send(method) do |request|
|
29
29
|
case method
|
30
30
|
when :delete, :get
|
31
31
|
request.url(path, options)
|
32
32
|
when :patch, :post, :put
|
33
33
|
request.path = path
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
34
|
+
request.body = MultiJson.dump(options) unless options.empty?
|
35
|
+
else
|
36
|
+
request.body = options unless options.empty?
|
38
37
|
end
|
38
|
+
end
|
39
39
|
response.body
|
40
40
|
end
|
41
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getty_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -212,7 +212,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
212
|
version: '0'
|
213
213
|
segments:
|
214
214
|
- 0
|
215
|
-
hash:
|
215
|
+
hash: 2796152013675773536
|
216
216
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
217
|
none: false
|
218
218
|
requirements:
|