wistia-api 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,20 @@
1
- require 'spec_helper'
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
2
 
3
- module Wistia
4
- module Projects
5
- describe Sharing do
6
- describe 'refresh_config!' do
7
- it 'overrides the site value to indicate nesting under projects' do
8
- api_url = Wistia::Config.config.api.url
9
- Wistia::Projects::Sharing.should_receive(:site=).with(api_url).ordered
10
-
11
- Wistia::Projects::Sharing.should_receive(:site=).with("#{api_url}projects/:project_id/").ordered
12
- Wistia::Projects::Sharing.refresh_config!
13
- end
14
- end
3
+ describe Wistia::Projects::Sharing do
4
+ describe '#find' do
5
+ it 'finds the sharing under the project' do
6
+ FakeWeb.register_uri :get, 'https://api:foo@api.wistia.com/v1/projects/3/sharings/7.json', body: {name: 'sharing name'}.to_json
7
+ Wistia.password = 'foo'
8
+ Wistia.format = :json
9
+ Wistia::Projects::Sharing.find(7, params:{project_id: 3}).name.should == 'sharing name'
10
+ end
11
+ end
12
+ describe '#to_json' do
13
+ it 'renders attributes in json format' do
14
+ b = Wistia::Projects::Sharing.new
15
+ b.key1 = 'val1'
16
+ b.key2 = 'val2'
17
+ JSON.parse(b.to_json).should == {'key1' => 'val1', 'key2' => 'val2'}
15
18
  end
16
19
  end
17
20
  end
@@ -0,0 +1,44 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe Wistia::Stats::Event do
4
+ it 'finds the event' do
5
+ FakeWeb.register_uri :get, 'https://api:foo@api.wistia.com/v1/stats/events/7.json', body: {name: 'object name'}.to_json
6
+ Wistia.password = 'foo'
7
+ Wistia.format = :json
8
+ Wistia::Stats::Event.find(7).name.should == 'object name'
9
+ end
10
+ end
11
+ describe Wistia::Stats::Media do
12
+ it 'finds the media' do
13
+ FakeWeb.register_uri :get, 'https://api:foo@api.wistia.com/v1/stats/medias/7.json', body: {name: 'object name'}.to_json
14
+ Wistia.password = 'foo'
15
+ Wistia.format = :json
16
+ Wistia::Stats::Media.find(7).name.should == 'object name'
17
+ end
18
+ end
19
+ describe Wistia::Stats::Project do
20
+ it 'finds the project' do
21
+ FakeWeb.register_uri :get, 'https://api:foo@api.wistia.com/v1/stats/projects/7.json', body: {name: 'object name'}.to_json
22
+ Wistia.password = 'foo'
23
+ Wistia.format = :json
24
+ Wistia::Stats::Project.find(7).name.should == 'object name'
25
+ end
26
+ end
27
+ describe Wistia::Stats::Visitor do
28
+ it 'finds the visitor' do
29
+ FakeWeb.register_uri :get, 'https://api:foo@api.wistia.com/v1/stats/visitors/7.json', body: {name: 'object name'}.to_json
30
+ Wistia.password = 'foo'
31
+ Wistia.format = :json
32
+ Wistia::Stats::Visitor.find(7).name.should == 'object name'
33
+ end
34
+ end
35
+ describe Wistia::Stats::Account do
36
+ describe '#find_singleton' do
37
+ it 'finds the account' do
38
+ FakeWeb.register_uri :get, 'https://api:foo@api.wistia.com/v1/stats/account.json', body: {name: 'account name'}.to_json
39
+ Wistia.password = 'foo'
40
+ Wistia.format = :json
41
+ Wistia::Stats::Account.find_singleton.name.should == 'account name'
42
+ end
43
+ end
44
+ end
data/wistia-api.gemspec CHANGED
@@ -5,16 +5,16 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "wistia-api"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Jim Bancroft", "Mark Bates"]
12
- s.date = "2012-12-12"
11
+ s.authors = ["Jeff Vincent", "Jim Bancroft", "Mark Bates", "Robby Grossman"]
12
+ s.date = "2013-02-27"
13
13
  s.description = "A ruby library for working with Wistia's data API."
14
14
  s.email = "support@wistia.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
17
- "README.rdoc"
17
+ "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
@@ -23,76 +23,58 @@ Gem::Specification.new do |s|
23
23
  "Gemfile",
24
24
  "Gemfile.lock",
25
25
  "LICENSE.txt",
26
- "README.rdoc",
26
+ "README.md",
27
27
  "Rakefile",
28
28
  "VERSION",
29
- "lib/config.rb",
30
29
  "lib/wistia.rb",
31
30
  "lib/wistia/base.rb",
32
31
  "lib/wistia/config.rb",
32
+ "lib/wistia/initialization.rb",
33
33
  "lib/wistia/media.rb",
34
34
  "lib/wistia/project.rb",
35
35
  "lib/wistia/projects/sharing.rb",
36
- "lib/wistia/stats/account.rb",
37
- "lib/wistia/stats/base.rb",
38
- "lib/wistia/stats/event.rb",
39
- "lib/wistia/stats/media.rb",
40
- "lib/wistia/stats/project.rb",
41
- "lib/wistia/stats/visitor.rb",
36
+ "lib/wistia/stats.rb",
42
37
  "spec/spec_helper.rb",
43
38
  "spec/support/config.test.yml",
44
- "spec/support/local_config.rb",
45
39
  "spec/wistia/base_spec.rb",
40
+ "spec/wistia/config_spec.rb",
41
+ "spec/wistia/media_spec.rb",
42
+ "spec/wistia/project_spec.rb",
46
43
  "spec/wistia/projects/sharing_spec.rb",
47
- "spec/wistia/stats/base_spec.rb",
48
- "spec/wistia_spec.rb",
44
+ "spec/wistia/stats_spec.rb",
49
45
  "wistia-api.gemspec"
50
46
  ]
51
47
  s.homepage = "http://github.com/wistia/wistia-api"
52
48
  s.licenses = ["MIT"]
53
49
  s.require_paths = ["lib"]
54
- s.rubygems_version = "1.8.24"
50
+ s.rubygems_version = "1.8.25"
55
51
  s.summary = "Ruby wrapper for Wistia's API"
56
- s.test_files = [
57
- "spec/spec_helper.rb",
58
- "spec/support/local_config.rb",
59
- "spec/wistia/base_spec.rb",
60
- "spec/wistia/projects/sharing_spec.rb",
61
- "spec/wistia/stats/base_spec.rb",
62
- "spec/wistia_spec.rb"
63
- ]
64
52
 
65
53
  if s.respond_to? :specification_version then
66
54
  s.specification_version = 3
67
55
 
68
56
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
57
  s.add_runtime_dependency(%q<activeresource>, [">= 2.3.8"])
70
- s.add_runtime_dependency(%q<configatron>, [">= 2.6.4"])
71
- s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
72
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
73
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
58
+ s.add_development_dependency(%q<bundler>, ["~> 1.2"])
59
+ s.add_development_dependency(%q<fakeweb>, ["~> 1.3"])
60
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
74
61
  s.add_development_dependency(%q<rcov>, [">= 0"])
75
- s.add_runtime_dependency(%q<activeresource>, [">= 2.3.8"])
76
- s.add_runtime_dependency(%q<configatron>, [">= 2.6.4"])
62
+ s.add_development_dependency(%q<rspec>, ["~> 2.12"])
77
63
  else
78
64
  s.add_dependency(%q<activeresource>, [">= 2.3.8"])
79
- s.add_dependency(%q<configatron>, [">= 2.6.4"])
80
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
81
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
82
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
65
+ s.add_dependency(%q<bundler>, ["~> 1.2"])
66
+ s.add_dependency(%q<fakeweb>, ["~> 1.3"])
67
+ s.add_dependency(%q<jeweler>, ["~> 1.8"])
83
68
  s.add_dependency(%q<rcov>, [">= 0"])
84
- s.add_dependency(%q<activeresource>, [">= 2.3.8"])
85
- s.add_dependency(%q<configatron>, [">= 2.6.4"])
69
+ s.add_dependency(%q<rspec>, ["~> 2.12"])
86
70
  end
87
71
  else
88
72
  s.add_dependency(%q<activeresource>, [">= 2.3.8"])
89
- s.add_dependency(%q<configatron>, [">= 2.6.4"])
90
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
91
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
92
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
73
+ s.add_dependency(%q<bundler>, ["~> 1.2"])
74
+ s.add_dependency(%q<fakeweb>, ["~> 1.3"])
75
+ s.add_dependency(%q<jeweler>, ["~> 1.8"])
93
76
  s.add_dependency(%q<rcov>, [">= 0"])
94
- s.add_dependency(%q<activeresource>, [">= 2.3.8"])
95
- s.add_dependency(%q<configatron>, [">= 2.6.4"])
77
+ s.add_dependency(%q<rspec>, ["~> 2.12"])
96
78
  end
97
79
  end
98
80
 
metadata CHANGED
@@ -1,16 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wistia-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
+ - Jeff Vincent
8
9
  - Jim Bancroft
9
10
  - Mark Bates
11
+ - Robby Grossman
10
12
  autorequire:
11
13
  bindir: bin
12
14
  cert_chain: []
13
- date: 2012-12-12 00:00:00.000000000 Z
15
+ date: 2013-02-27 00:00:00.000000000 Z
14
16
  dependencies:
15
17
  - !ruby/object:Gem::Dependency
16
18
  name: activeresource
@@ -29,29 +31,13 @@ dependencies:
29
31
  - !ruby/object:Gem::Version
30
32
  version: 2.3.8
31
33
  - !ruby/object:Gem::Dependency
32
- name: configatron
33
- requirement: !ruby/object:Gem::Requirement
34
- none: false
35
- requirements:
36
- - - ! '>='
37
- - !ruby/object:Gem::Version
38
- version: 2.6.4
39
- type: :runtime
40
- prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: 2.6.4
47
- - !ruby/object:Gem::Dependency
48
- name: rspec
34
+ name: bundler
49
35
  requirement: !ruby/object:Gem::Requirement
50
36
  none: false
51
37
  requirements:
52
38
  - - ~>
53
39
  - !ruby/object:Gem::Version
54
- version: 2.3.0
40
+ version: '1.2'
55
41
  type: :development
56
42
  prerelease: false
57
43
  version_requirements: !ruby/object:Gem::Requirement
@@ -59,15 +45,15 @@ dependencies:
59
45
  requirements:
60
46
  - - ~>
61
47
  - !ruby/object:Gem::Version
62
- version: 2.3.0
48
+ version: '1.2'
63
49
  - !ruby/object:Gem::Dependency
64
- name: bundler
50
+ name: fakeweb
65
51
  requirement: !ruby/object:Gem::Requirement
66
52
  none: false
67
53
  requirements:
68
54
  - - ~>
69
55
  - !ruby/object:Gem::Version
70
- version: 1.0.0
56
+ version: '1.3'
71
57
  type: :development
72
58
  prerelease: false
73
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -75,7 +61,7 @@ dependencies:
75
61
  requirements:
76
62
  - - ~>
77
63
  - !ruby/object:Gem::Version
78
- version: 1.0.0
64
+ version: '1.3'
79
65
  - !ruby/object:Gem::Dependency
80
66
  name: jeweler
81
67
  requirement: !ruby/object:Gem::Requirement
@@ -83,7 +69,7 @@ dependencies:
83
69
  requirements:
84
70
  - - ~>
85
71
  - !ruby/object:Gem::Version
86
- version: 1.5.2
72
+ version: '1.8'
87
73
  type: :development
88
74
  prerelease: false
89
75
  version_requirements: !ruby/object:Gem::Requirement
@@ -91,7 +77,7 @@ dependencies:
91
77
  requirements:
92
78
  - - ~>
93
79
  - !ruby/object:Gem::Version
94
- version: 1.5.2
80
+ version: '1.8'
95
81
  - !ruby/object:Gem::Dependency
96
82
  name: rcov
97
83
  requirement: !ruby/object:Gem::Requirement
@@ -109,44 +95,28 @@ dependencies:
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: activeresource
113
- requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
118
- version: 2.3.8
119
- type: :runtime
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ! '>='
125
- - !ruby/object:Gem::Version
126
- version: 2.3.8
127
- - !ruby/object:Gem::Dependency
128
- name: configatron
98
+ name: rspec
129
99
  requirement: !ruby/object:Gem::Requirement
130
100
  none: false
131
101
  requirements:
132
- - - ! '>='
102
+ - - ~>
133
103
  - !ruby/object:Gem::Version
134
- version: 2.6.4
135
- type: :runtime
104
+ version: '2.12'
105
+ type: :development
136
106
  prerelease: false
137
107
  version_requirements: !ruby/object:Gem::Requirement
138
108
  none: false
139
109
  requirements:
140
- - - ! '>='
110
+ - - ~>
141
111
  - !ruby/object:Gem::Version
142
- version: 2.6.4
112
+ version: '2.12'
143
113
  description: A ruby library for working with Wistia's data API.
144
114
  email: support@wistia.com
145
115
  executables: []
146
116
  extensions: []
147
117
  extra_rdoc_files:
148
118
  - LICENSE.txt
149
- - README.rdoc
119
+ - README.md
150
120
  files:
151
121
  - .document
152
122
  - .rspec
@@ -154,29 +124,25 @@ files:
154
124
  - Gemfile
155
125
  - Gemfile.lock
156
126
  - LICENSE.txt
157
- - README.rdoc
127
+ - README.md
158
128
  - Rakefile
159
129
  - VERSION
160
- - lib/config.rb
161
130
  - lib/wistia.rb
162
131
  - lib/wistia/base.rb
163
132
  - lib/wistia/config.rb
133
+ - lib/wistia/initialization.rb
164
134
  - lib/wistia/media.rb
165
135
  - lib/wistia/project.rb
166
136
  - lib/wistia/projects/sharing.rb
167
- - lib/wistia/stats/account.rb
168
- - lib/wistia/stats/base.rb
169
- - lib/wistia/stats/event.rb
170
- - lib/wistia/stats/media.rb
171
- - lib/wistia/stats/project.rb
172
- - lib/wistia/stats/visitor.rb
137
+ - lib/wistia/stats.rb
173
138
  - spec/spec_helper.rb
174
139
  - spec/support/config.test.yml
175
- - spec/support/local_config.rb
176
140
  - spec/wistia/base_spec.rb
141
+ - spec/wistia/config_spec.rb
142
+ - spec/wistia/media_spec.rb
143
+ - spec/wistia/project_spec.rb
177
144
  - spec/wistia/projects/sharing_spec.rb
178
- - spec/wistia/stats/base_spec.rb
179
- - spec/wistia_spec.rb
145
+ - spec/wistia/stats_spec.rb
180
146
  - wistia-api.gemspec
181
147
  homepage: http://github.com/wistia/wistia-api
182
148
  licenses:
@@ -193,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
159
  version: '0'
194
160
  segments:
195
161
  - 0
196
- hash: 76556245729563149
162
+ hash: 3016534490162460679
197
163
  required_rubygems_version: !ruby/object:Gem::Requirement
198
164
  none: false
199
165
  requirements:
@@ -202,14 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
168
  version: '0'
203
169
  requirements: []
204
170
  rubyforge_project:
205
- rubygems_version: 1.8.24
171
+ rubygems_version: 1.8.25
206
172
  signing_key:
207
173
  specification_version: 3
208
174
  summary: Ruby wrapper for Wistia's API
209
- test_files:
210
- - spec/spec_helper.rb
211
- - spec/support/local_config.rb
212
- - spec/wistia/base_spec.rb
213
- - spec/wistia/projects/sharing_spec.rb
214
- - spec/wistia/stats/base_spec.rb
215
- - spec/wistia_spec.rb
175
+ test_files: []
data/README.rdoc DELETED
@@ -1,71 +0,0 @@
1
- = wistia-api
2
-
3
- Ruby wrapper for Wistia's API
4
-
5
- == Installation
6
-
7
- Required gems:
8
- * activeresource >= 2.3.8
9
- * configatron >= 2.6.4
10
-
11
- Install:
12
- gem install wistia-api
13
-
14
- RDoc[http://rubydoc.info/gems/wistia-api/frames]
15
-
16
- == Basic Usage
17
-
18
- Start by requiring wistia:
19
- require 'wistia'
20
-
21
- Configure your API password:
22
- Wistia.password = 'your-api-key-here'
23
-
24
- You can get an API password by following the instructions here: http://wistia.com/doc/data-api#getting_started
25
-
26
- Now you can use the <tt>Wistia::Media</tt>, <tt>Wistia::Project</tt>, and <tt>Wistia::Projects::Sharing</tt> classes as ActiveResource wrappers around Wistia's API.
27
-
28
- See http://wistia.com/doc/data-api for more info.
29
-
30
- == Configuration Options
31
-
32
- Set the format of the API:
33
- Wistia.format = 'json' # This is the default.
34
- Wistia.format = 'xml'
35
-
36
- Read configuration from an external YAML file:
37
- Wistia.use_config!(path_to_yaml)
38
-
39
- For an example YAML config, see spec/support/config.local.yml
40
-
41
- Configure using a Hash:
42
- Wistia.use_config!(:wistia => {
43
- :api => {
44
- :url => 'custom-api-url',
45
- :user => 'custom-api-user',
46
- :password => 'your-api-password',
47
- :format => 'xml-or-json'
48
- }
49
- })
50
-
51
- == Examples
52
-
53
- List all Media in your account:
54
- Wistia::Media.find(:all)
55
-
56
- List all Projects in your account:
57
- Wistia::Project.find(:all)
58
-
59
- List all Sharing objects for project 23:
60
- Wistia::Projects::Sharing.find(:all, :params => { :project_id => 23 })
61
-
62
- Get stats for a project since the December 1, 2012
63
- Wistia::Stats::Project.get('efjh6kxmc9/by_date', :start_date => '2012-12-01')
64
-
65
- List Overall Stats for Your Account
66
- Wistia::Stats::Account.find_singleton
67
-
68
- == Copyright
69
-
70
- Copyright (c) 2011 Wistia, Inc. See LICENSE.txt for
71
- further details.
data/lib/config.rb DELETED
@@ -1,24 +0,0 @@
1
- # Workaround for a problem with configatron in JRuby 1.7+
2
- # Contributors have suggested a solution at
3
- # https://github.com/markbates/configatron/pull/33
4
- # but the patch has not been applied for months
5
-
6
- def running_jruby_1_7_or_later
7
- RUBY_PLATFORM == 'java' && !JRUBY_VERSION.match(/[0-1]\.[0-6]/)
8
- end
9
-
10
- if running_jruby_1_7_or_later && !defined? Psych::Yecht
11
- module Psych
12
- module Yecht
13
- MergeKey = Psych::Syck
14
- end
15
- end
16
- end
17
-
18
- require 'configatron'
19
-
20
- configatron.wistia.api.key = ''
21
- configatron.wistia.api.user = 'api'
22
- configatron.wistia.api.format = :json
23
- configatron.wistia.api.url = 'https://api.wistia.com/v1/'
24
-
@@ -1,12 +0,0 @@
1
- module Wistia
2
- module Stats
3
- class Account < Wistia::Stats::Base
4
-
5
- # to make it easier to find singleton
6
- def self.find_singleton
7
- find :one, :from => '/v1/stats/account.json'
8
- end
9
-
10
- end
11
- end
12
- end
@@ -1,14 +0,0 @@
1
- module Wistia
2
- module Stats
3
- class Base < Wistia::Base
4
-
5
- # we needs to use the stats url
6
- def self.refresh_config!
7
- super
8
- self.site = "#{Wistia::Config.config.api.url}stats/"
9
- end
10
- refresh_config!
11
-
12
- end
13
- end
14
- end
@@ -1,7 +0,0 @@
1
- module Wistia
2
- module Stats
3
- class Event < Wistia::Stats::Base
4
-
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Wistia
2
- module Stats
3
- class Media < Wistia::Stats::Base
4
-
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Wistia
2
- module Stats
3
- class Project < Wistia::Stats::Base
4
-
5
- end
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- module Wistia
2
- module Stats
3
- class Visitor < Wistia::Stats::Base
4
-
5
- end
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- configatron.wistia.api.key = 'test'
2
- configatron.wistia.api.user = 'api'
3
- configatron.wistia.api.format = :json
4
- configatron.wistia.api.url = 'http://api.wistia.local:3000/v1/'
5
- configatron.wistia.api.projects.url = 'http://api.wistia.local:3000/v1/projects'
@@ -1,17 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Wistia
4
- module Stats
5
- describe Base do
6
- describe 'refresh_config!' do
7
- it 'overrides the site value to indicate namespacing under stats' do
8
- api_url = Wistia::Config.config.api.url
9
- Wistia::Stats::Base.should_receive(:site=).with(api_url).ordered
10
-
11
- Wistia::Stats::Base.should_receive(:site=).with("#{api_url}stats/").ordered
12
- Wistia::Stats::Base.refresh_config!
13
- end
14
- end
15
- end
16
- end
17
- end
data/spec/wistia_spec.rb DELETED
@@ -1,80 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe Wistia do
4
-
5
- describe 'use_config!' do
6
- context 'given a hash argument' do
7
- it 'uses the hash to configure configatron' do
8
- Wistia.use_config!( :wistia => { :api => { :key => 'test' } } )
9
- configatron.wistia.api.key.should == 'test'
10
- end
11
- end
12
-
13
- context 'given a path to a yaml file' do
14
- it 'makes configatron use the yaml file for configuration' do
15
- path_to_yaml = File.dirname(__FILE__) + '/support/config.test.yml'
16
- configatron.should_receive(:configure_from_yaml).with(path_to_yaml)
17
- Wistia.use_config!(path_to_yaml)
18
- end
19
- end
20
-
21
- context 'given an invalid config' do
22
- it 'raises an ArgumentError' do
23
- lambda {
24
- Wistia.use_config!(nil)
25
- }.should raise_error(ArgumentError, 'Invalid config')
26
- end
27
- end
28
-
29
- it 'uses the new configuration' do
30
- Wistia.should_receive(:refresh_config!)
31
- Wistia.use_config!( :wistia => { :api => { :key => 'test' } } )
32
- end
33
- end
34
-
35
- describe 'password=' do
36
- it 'reconfigures the API using the new password parameter' do
37
- new_password = 'test'
38
- Wistia.password = new_password
39
- Wistia.should_receive(:use_config!).with(hash_including(:wistia => { :api => { :key => new_password } }))
40
- Wistia.password = new_password
41
- end
42
- end
43
-
44
- describe 'format=' do
45
- context 'given a valid format' do
46
- it 'reconfigures the API using the new format parameter' do
47
- new_format = :xml
48
- Wistia.should_receive(:use_config!).with(hash_including(:wistia => { :api => { :format => new_format } }))
49
- Wistia.format = new_format
50
- end
51
- end
52
-
53
- context 'given an invalid format' do
54
- it 'raises an ArgumentError' do
55
- lambda {
56
- Wistia.format = 'invalid_format'
57
- }.should raise_error(ArgumentError, /Invalid format/)
58
- end
59
- end
60
- end
61
-
62
- describe 'refresh_config!' do
63
- it 'forces Wistia::Media to re-read its configuration from the configatron' do
64
- Wistia::Media.should_receive(:refresh_config!)
65
- Wistia.refresh_config!
66
- end
67
-
68
- it 'forces Wistia::Project to re-read its configuration from the configatron' do
69
- Wistia::Project.should_receive(:refresh_config!)
70
- Wistia.refresh_config!
71
- end
72
-
73
- it 'forces Wistia::Projects::Sharing to re-read its configuration from the configatron' do
74
- Wistia::Projects::Sharing.should_receive(:refresh_config!)
75
- Wistia.refresh_config!
76
- end
77
- end
78
-
79
- end
80
-