opentok 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 455afd0fc38abc68b137c7bf8e5da6ccea11d7c1
4
- data.tar.gz: b39ad5d10c8716cd862919d1c093c960c5163839
3
+ metadata.gz: 3da4263a70740969567f3f290b37bcfdc32b47a4
4
+ data.tar.gz: 1ece7e923d07c65332e2e6de269f9ab185558dce
5
5
  SHA512:
6
- metadata.gz: 6419fea755f1cb4ec45c103a38ca00776b099a7aaa32bac5ea653ff4e64222bdea78bbafa89497f66247b9c6c065d2ef6e8951cfdb3b0e41e0abcf6162b19f67
7
- data.tar.gz: b7dbdc094d7bcf2d60f751182fac654e908fc7b1844de8bf0a18e63ca3353d9d4a5c24dda3b2421747e04c1069dbebd6be1677c9d8e49953ca73713e9f9cb56c
6
+ metadata.gz: 7bc776d61daa44560cb43dd9c861ebe7c2056c03ffe6699e1d922139d44f610349b0220014d9d2bd0084c77712ada4a336b2ac96663a140bb554f56c300f4419
7
+ data.tar.gz: 6bacbf9f661e13d092b708006b297e9b13dbe9447a6c1b1016a030d529fcf29c48e2fa87848a7dd47f335ac1dc827d5cbcf1ce81c6416a7453923a17590113e3
@@ -14,11 +14,11 @@ module OpenTok
14
14
  # TODO: expose a setting for http debugging for developers
15
15
  # debug_output $stdout
16
16
 
17
- def initialize(api_key, api_secret, api_url)
17
+ def initialize(api_key, api_secret, api_url, ua_addendum="")
18
18
  self.class.base_uri api_url
19
19
  self.class.headers({
20
20
  "X-TB-PARTNER-AUTH" => "#{api_key}:#{api_secret}",
21
- "User-Agent" => "OpenTok-Ruby-SDK/#{VERSION}"
21
+ "User-Agent" => "OpenTok-Ruby-SDK/#{VERSION}" + (ua_addendum ? " #{ua_addendum}" : "")
22
22
  })
23
23
  @api_key = api_key
24
24
  end
@@ -56,7 +56,7 @@ module OpenTok
56
56
  # @private
57
57
  # don't want these to be mutable, may cause bugs related to inconsistency since these values are
58
58
  # cached in objects that this can create
59
- attr_reader :api_key, :api_secret, :api_url
59
+ attr_reader :api_key, :api_secret, :api_url, :ua_addendum
60
60
 
61
61
  ##
62
62
  # Create a new OpenTok object.
@@ -64,13 +64,13 @@ module OpenTok
64
64
  # @param [String] api_key Your OpenTok API key. See the OpenTok dashboard
65
65
  # (https://dashboard.tokbox.com).
66
66
  # @param [String] api_secret Your OpenTok API key.
67
- # @param [String] api_url Do not set this parameter. It is for internal use by TokBox.
68
- def initialize(api_key, api_secret, api_url=::OpenTok::API_URL)
67
+ # @option opts [Symbol] :api_url Do not set this parameter. It is for internal use by TokBox.
68
+ # @option opts [Symbol] :ua_addendum Do not set this parameter. It is for internal use by TokBox.
69
+ def initialize(api_key, api_secret, opts={})
69
70
  @api_key = api_key.to_s()
70
71
  @api_secret = api_secret
71
- # TODO: do we really need a copy of this in the instance or should we overwrite the module
72
- # constant so that other objects can access the same copy?
73
- @api_url = api_url
72
+ @api_url = opts[:api_url] || API_URL
73
+ @ua_addendum = opts[:ua_addendum]
74
74
  end
75
75
 
76
76
  # Creates a new OpenTok session and returns the session ID, which uniquely identifies
@@ -175,7 +175,7 @@ module OpenTok
175
175
  protected
176
176
 
177
177
  def client
178
- @client ||= Client.new api_key, api_secret, api_url
178
+ @client ||= Client.new api_key, api_secret, api_url, ua_addendum
179
179
  end
180
180
 
181
181
  end
@@ -1,4 +1,4 @@
1
1
  module OpenTok
2
2
  # @private
3
- VERSION = '2.3.2'
3
+ VERSION = '2.3.3'
4
4
  end
@@ -0,0 +1,39 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.opentok.com/session/create
6
+ body:
7
+ encoding: UTF-8
8
+ string: p2p.preference=enabled
9
+ headers:
10
+ X-Tb-Partner-Auth:
11
+ - 123456:1234567890abcdef1234567890abcdef1234567890
12
+ User-Agent:
13
+ - OpenTok-Ruby-SDK/<%= version %> BOOYAH
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Server:
20
+ - nginx
21
+ Date:
22
+ - Mon, 17 Mar 2014 07:41:31 GMT
23
+ Content-Type:
24
+ - text/xml
25
+ Connection:
26
+ - keep-alive
27
+ Access-Control-Allow-Origin:
28
+ - '*'
29
+ X-Tb-Host:
30
+ - fms503-nyc.tokbox.com
31
+ Content-Length:
32
+ - '282'
33
+ body:
34
+ encoding: UTF-8
35
+ string: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><sessions><Session><session_id>1_MX4xMjM0NTZ-fk1vbiBNYXIgMTcgMDA6NDE6MzEgUERUIDIwMTR-MC42ODM3ODk1MzQ0OTQyODA4fg</session_id><partner_id>123456</partner_id><create_dt>Mon
36
+ Mar 17 00:41:31 PDT 2014</create_dt></Session></sessions>
37
+ http_version:
38
+ recorded_at: Thu, 06 Aug 2015 02:09:13 GMT
39
+ recorded_with: VCR 2.8.0
@@ -122,7 +122,7 @@ describe OpenTok::OpenTok do
122
122
 
123
123
  context "with an additional api_url" do
124
124
  let(:api_url) { "http://example.opentok.com" }
125
- let(:opentok) { OpenTok::OpenTok.new api_key, api_secret, api_url }
125
+ let(:opentok) { OpenTok::OpenTok.new api_key, api_secret, :api_url => api_url }
126
126
 
127
127
  it { should be_an_instance_of(OpenTok::OpenTok) }
128
128
 
@@ -133,6 +133,23 @@ describe OpenTok::OpenTok do
133
133
  # TODO: i don't need to run all the tests, just a set that checks for the URL's effect
134
134
  # include_examples "generates tokens"
135
135
  end
136
+
137
+ context "with an addendum to the user agent string" do
138
+ let(:opentok) { OpenTok::OpenTok.new api_key, api_secret, :ua_addendum => ua_addendum }
139
+ let(:ua_addendum) { "BOOYAH"}
140
+
141
+ it { should be_an_instance_of(OpenTok::OpenTok) }
142
+
143
+ it "should have a ua_addendum property" do
144
+ expect(opentok.ua_addendum).to eq ua_addendum
145
+ end
146
+
147
+ # NOTE: ua_addendum is hardcoded into cassette
148
+ it "should append the addendum to the user agent header", :vcr => { :erb => { :version => OpenTok::VERSION } } do
149
+ session = opentok.create_session
150
+ expect(session).to be_an_instance_of OpenTok::Session
151
+ end
152
+ end
136
153
  end
137
154
 
138
155
  context "http client errors" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentok
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stijn Mathysen
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2015-07-15 00:00:00.000000000 Z
15
+ date: 2015-08-06 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -247,6 +247,7 @@ files:
247
247
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions.yml
248
248
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions_with_a_location_hint.yml
249
249
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_sessions_with_a_location_hint.yml
250
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/with_an_addendum_to_the_user_agent_string/should_append_the_addendum_to_the_user_agent_header.yml
250
251
  - spec/matchers/token.rb
251
252
  - spec/opentok/archives_spec.rb
252
253
  - spec/opentok/opentok_spec.rb
@@ -301,6 +302,7 @@ test_files:
301
302
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions.yml
302
303
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_routed_media_sessions_with_a_location_hint.yml
303
304
  - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/_create_session/creates_sessions_with_a_location_hint.yml
305
+ - spec/cassettes/OpenTok_OpenTok/when_initialized_properly/with_an_addendum_to_the_user_agent_string/should_append_the_addendum_to_the_user_agent_header.yml
304
306
  - spec/matchers/token.rb
305
307
  - spec/opentok/archives_spec.rb
306
308
  - spec/opentok/opentok_spec.rb