ConnectSDK 1.0.1.Beta → 1.0.2.Beta

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjdlMjg4NDU1Nzg3Zjk5YjRjZWJlMzQ0ODI1ZjAwMTE0Zjc1ODIyYg==
4
+ YTUyYzA5NjVmNGE2YWVlMTkyMjVlZmFhNGVlMDljMGQxZGQxMTZlMw==
5
5
  data.tar.gz: !binary |-
6
- YWQ3ZTdkZWU5MTJlOWVlZDU1N2M4OWYyYzc5YTA0MWJjYmNkNTU4NQ==
6
+ YTE5ZjZiY2FhNmM5ZDc4NzQ1NDJkY2U4ZDg4MTA1NWU4OTVmYjI3Ng==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTRmNjA5ZThjYmIwOTQ0MWM4NDQzNjczZTI2NDkzNDM4OGU0Yzc0MDQ0ZmRi
10
- YTdjNjkxMTA0N2IzMDQ2ODYxYzU3MzFkOWY5NTEyYTUzM2NmYzNiMzdiNjFk
11
- NzA3NzY3MzRjZDllMjlmMjFhZTNmNDUyNzE3NTkwMWQzOGE3OGI=
9
+ YTRhZTVkZWRlYTE0OWQ5MTgwNWU2OGU3OTZkMDY4MjMyYzBhZTIyM2UwOTc2
10
+ NjBkOWM5MDI3NTUwODlmZDIwMjNlZjQwNjZhYTE1Mzg4OWM2M2EwM2Q4OTNl
11
+ MTE4ZDI0MDYyYzZjZjJkNDQ5NmJlMGExOTc1ZWU3OWI0NjU2YWY=
12
12
  data.tar.gz: !binary |-
13
- MjY3Mjk0NmYzYjNhMDVkYTMxODZkN2UyN2JjOWZkZGZmYzg3Y2U0M2Q4ZTAy
14
- N2IxZGJhNGQ4YzJlNDY2ZGMxMWZmOTc1ZmQ4MTA4Mjg3YTlmMzAyNDU0ZDBh
15
- MzkyOTFlYjExNDkxYWUzZTYzNjYxOTA5YjFjZTM4ZTc4MzI2NDI=
13
+ ZWMxZGE4Y2MzNjAyY2ZjZmMzYTY1ZWE0OTU5ZDY0MTNkMjdmZTI5OGNjOTM1
14
+ NmRiZmM5YmMyYmQ0ZGNiMWI5YTcxZDE1Mjc4Y2U0NmU5YTEyZjRkYTQ4ZTgx
15
+ MDZiYWY0YTY5NGJlOWJkODc3MmU4MDdjNDk4NTcwZmZhMTcyNGQ=
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["rod.santos@gettyimages.com"]
11
11
  spec.summary = "Connect SDK"
12
12
  spec.description = "Connect SDK"
13
- spec.homepage = "http://api.gettyimages.com/"
13
+ spec.homepage = "https://connect.gettyimages.com/swagger"
14
14
  spec.license = "MIT"
15
15
  spec.files = `git ls-files -z`.split("\x0")
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
@@ -1,3 +1,3 @@
1
1
  module ConnectSDK
2
- VERSION = '1.0.1.Beta'
2
+ VERSION = "1.0.2.Beta"
3
3
  end
@@ -1,8 +1,8 @@
1
1
  require "pp"
2
2
  require_relative "ConnectSDK"
3
3
 
4
- api_key = "3z7q8fyw8ach5kr3mg35dkqz"
5
- api_secret = "kYksrEH4Vyn6txeT5tFDJjxsdVYqS6usNDupa3aYWpwkr"
4
+ api_key = "api key"
5
+ api_secret = "api secret"
6
6
 
7
7
  # Example of Connect SDK
8
8
  connectSdk = ConnectSdk.new(api_key, api_secret)
@@ -1,10 +1,11 @@
1
- require "net/http"
2
- require "uri"
3
- require "json"
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'json'
4
+ require 'rbconfig'
5
+ require_relative 'ConnectSDK/version'
4
6
 
5
7
  class Connect_Api_Host
6
8
  API_HOST = "connect.gettyimages.com"
7
- # API_HOST = "gibson.candidate-gettyimages.com/Public"
8
9
  API_BASE_URL = "https://#{API_HOST}"
9
10
  end
10
11
 
@@ -15,12 +16,10 @@ class HttpHelper
15
16
  @access_token = access_token
16
17
  end
17
18
 
18
- public
19
19
  def get_uri(path)
20
20
  return URI.parse "#{Connect_Api_Host::API_BASE_URL}#{path}"
21
21
  end
22
22
 
23
- public
24
23
  def get(endpoint_path, query_params)
25
24
 
26
25
  uri = get_uri(endpoint_path)
@@ -34,7 +33,6 @@ class HttpHelper
34
33
 
35
34
  end
36
35
 
37
- public
38
36
  def post(endpoint_path)
39
37
 
40
38
  uri = get_uri endpoint_path
@@ -43,6 +41,25 @@ class HttpHelper
43
41
 
44
42
  end
45
43
 
44
+ private
45
+ def os
46
+ @os ||= (
47
+ host_os = RbConfig::CONFIG['host_os']
48
+ case host_os
49
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
50
+ :windows
51
+ when /darwin|mac os/
52
+ :macosx
53
+ when /linux/
54
+ :linux
55
+ when /solaris|bsd/
56
+ :unix
57
+ else
58
+ raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
59
+ end)
60
+ end
61
+
62
+ private
46
63
  def send(connect_uri, connect_request, api_key, bearer_token = "")
47
64
 
48
65
  # define HTTPS connection
@@ -51,14 +68,21 @@ class HttpHelper
51
68
  https.verify_mode = OpenSSL::SSL::VERIFY_NONE
52
69
 
53
70
  # define headers
71
+ connect_request["User-Agent"] = "ConnectSDK/#{ConnectSDK::VERSION} (#{os} ; Ruby #{RUBY_VERSION})"
54
72
  connect_request["Api-Key"] = api_key
55
73
  connect_request["Authorization"] = "Bearer #{bearer_token}" unless bearer_token.empty?
56
74
 
75
+
76
+ # connect_request.each_header do |header_name, header_value|
77
+ # puts "#{header_name} : #{header_value}"
78
+ # end
79
+ # https.set_debug_output $stderr
80
+
57
81
  # send request
58
82
  resp = https.request connect_request
59
83
  # puts "HTTP RESPONSE: #{resp}"
60
84
 
61
- if !resp.is_a?(Net::HTTPSuccess)
85
+ if !resp.is_a?(Net::HTTPSuccess)
62
86
  raise "HTTP RESPONSE: #{resp}"
63
87
  end
64
88
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ConnectSDK
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1.Beta
4
+ version: 1.0.2.Beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rod Santos, Lisa Guo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-02 00:00:00.000000000 Z
11
+ date: 2014-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -61,7 +61,7 @@ files:
61
61
  - lib/RequestBase.rb
62
62
  - lib/SearchImages.rb
63
63
  - lib/SearchRequest.rb
64
- homepage: http://api.gettyimages.com/
64
+ homepage: https://connect.gettyimages.com/swagger
65
65
  licenses:
66
66
  - MIT
67
67
  metadata: {}