viki 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/README.md +5 -0
- data/lib/viki/utilities.rb +1 -0
- data/lib/viki/version.rb +1 -1
- data/spec/{request_spec.rb → requests/request_spec.rb} +7 -4
- data/spec/spec_config.rb.sample +4 -0
- data/spec/spec_helper.rb +5 -2
- metadata +25 -53
- /data/spec/{client_spec.rb → lib/client_spec.rb} +0 -0
- /data/spec/{error_spec.rb → lib/error_spec.rb} +0 -0
- /data/spec/{filter_shared_examples_spec.rb → support/filter_shared_examples_spec.rb} +0 -0
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -96,3 +96,8 @@ Your ruby application
|
|
96
96
|
viki.newscasts.get #without parameter filter
|
97
97
|
viki.newscasts(language: 'ko').get #with parameter filter
|
98
98
|
|
99
|
+
RSpec Testing
|
100
|
+
----------
|
101
|
+
To run the tests, create a spec_config.rb file from the sample file.
|
102
|
+
|
103
|
+
Add your client id and client secret into the file.
|
data/lib/viki/utilities.rb
CHANGED
@@ -3,6 +3,7 @@ module Viki
|
|
3
3
|
private
|
4
4
|
|
5
5
|
def capture(response)
|
6
|
+
raise Viki::Error.new("408", "Timeout error") if response.header.code == "408"
|
6
7
|
if response.header.code != "200"
|
7
8
|
response_hash = MultiJson.load(response.body)
|
8
9
|
raise Viki::Error.new(response.header.code, response_hash["message"]) if response.header.code != "200"
|
data/lib/viki/version.rb
CHANGED
@@ -1,8 +1,4 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
require 'spec_helper'
|
4
|
-
require 'secrets'
|
5
|
-
require 'filter_shared_examples_spec'
|
6
2
|
|
7
3
|
describe "Viki" do
|
8
4
|
let(:client_id) { CLIENT_ID }
|
@@ -125,6 +121,13 @@ describe "Viki" do
|
|
125
121
|
end
|
126
122
|
end
|
127
123
|
|
124
|
+
describe "when HTTP timeout" do
|
125
|
+
before { stub_request(:any, /www.viki.com/).to_return(:status => [408]) }
|
126
|
+
it "should handle timeout gracefully" do
|
127
|
+
expect { client.movies.get }.should raise_error(Viki::Error, "Timeout error")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
128
131
|
describe "Renew Expired Access Token" do
|
129
132
|
it "should request a new access token when an endpoint returns 401 and client currently has an access_token" do
|
130
133
|
VCR.use_cassette "auth/expired_access_token" do
|
data/spec/spec_helper.rb
CHANGED
@@ -4,9 +4,12 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
4
4
|
require 'rspec'
|
5
5
|
require 'viki'
|
6
6
|
require 'vcr'
|
7
|
+
require 'webmock/rspec'
|
8
|
+
require 'spec_config.rb'
|
9
|
+
include WebMock::API
|
10
|
+
include WebMock::Matchers
|
7
11
|
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support
|
12
|
+
Dir["#{File.dirname(__FILE__)}/support/vcr.rb"].each { |f| require f }
|
9
13
|
|
10
14
|
RSpec.configure do |config|
|
11
|
-
|
12
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: viki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-07-
|
14
|
+
date: 2012-07-04 00:00:00.000000000Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
18
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirement: &70100608348400 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,15 +23,10 @@ dependencies:
|
|
23
23
|
version: 2.10.0
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
|
-
version_requirements:
|
27
|
-
none: false
|
28
|
-
requirements:
|
29
|
-
- - ~>
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
version: 2.10.0
|
26
|
+
version_requirements: *70100608348400
|
32
27
|
- !ruby/object:Gem::Dependency
|
33
28
|
name: vcr
|
34
|
-
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirement: &70100608347900 !ruby/object:Gem::Requirement
|
35
30
|
none: false
|
36
31
|
requirements:
|
37
32
|
- - ~>
|
@@ -39,15 +34,10 @@ dependencies:
|
|
39
34
|
version: 2.2.2
|
40
35
|
type: :development
|
41
36
|
prerelease: false
|
42
|
-
version_requirements:
|
43
|
-
none: false
|
44
|
-
requirements:
|
45
|
-
- - ~>
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 2.2.2
|
37
|
+
version_requirements: *70100608347900
|
48
38
|
- !ruby/object:Gem::Dependency
|
49
39
|
name: webmock
|
50
|
-
requirement: !ruby/object:Gem::Requirement
|
40
|
+
requirement: &70100608347440 !ruby/object:Gem::Requirement
|
51
41
|
none: false
|
52
42
|
requirements:
|
53
43
|
- - ~>
|
@@ -55,15 +45,10 @@ dependencies:
|
|
55
45
|
version: 1.8.7
|
56
46
|
type: :development
|
57
47
|
prerelease: false
|
58
|
-
version_requirements:
|
59
|
-
none: false
|
60
|
-
requirements:
|
61
|
-
- - ~>
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 1.8.7
|
48
|
+
version_requirements: *70100608347440
|
64
49
|
- !ruby/object:Gem::Dependency
|
65
50
|
name: excon
|
66
|
-
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirement: &70100608346980 !ruby/object:Gem::Requirement
|
67
52
|
none: false
|
68
53
|
requirements:
|
69
54
|
- - ~>
|
@@ -71,15 +56,10 @@ dependencies:
|
|
71
56
|
version: 0.9.6
|
72
57
|
type: :development
|
73
58
|
prerelease: false
|
74
|
-
version_requirements:
|
75
|
-
none: false
|
76
|
-
requirements:
|
77
|
-
- - ~>
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 0.9.6
|
59
|
+
version_requirements: *70100608346980
|
80
60
|
- !ruby/object:Gem::Dependency
|
81
61
|
name: httparty
|
82
|
-
requirement: !ruby/object:Gem::Requirement
|
62
|
+
requirement: &70100608346520 !ruby/object:Gem::Requirement
|
83
63
|
none: false
|
84
64
|
requirements:
|
85
65
|
- - ~>
|
@@ -87,15 +67,10 @@ dependencies:
|
|
87
67
|
version: 0.8.3
|
88
68
|
type: :runtime
|
89
69
|
prerelease: false
|
90
|
-
version_requirements:
|
91
|
-
none: false
|
92
|
-
requirements:
|
93
|
-
- - ~>
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 0.8.3
|
70
|
+
version_requirements: *70100608346520
|
96
71
|
- !ruby/object:Gem::Dependency
|
97
72
|
name: multi_json
|
98
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirement: &70100608346060 !ruby/object:Gem::Requirement
|
99
74
|
none: false
|
100
75
|
requirements:
|
101
76
|
- - ~>
|
@@ -103,12 +78,7 @@ dependencies:
|
|
103
78
|
version: 1.3.6
|
104
79
|
type: :runtime
|
105
80
|
prerelease: false
|
106
|
-
version_requirements:
|
107
|
-
none: false
|
108
|
-
requirements:
|
109
|
-
- - ~>
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: 1.3.6
|
81
|
+
version_requirements: *70100608346060
|
112
82
|
description: Viki-gem is an official wrapper gem for the Viki V3 API.
|
113
83
|
email:
|
114
84
|
- engineering@viki.com
|
@@ -129,11 +99,12 @@ files:
|
|
129
99
|
- lib/viki/request.rb
|
130
100
|
- lib/viki/utilities.rb
|
131
101
|
- lib/viki/version.rb
|
132
|
-
- spec/client_spec.rb
|
133
|
-
- spec/error_spec.rb
|
134
|
-
- spec/
|
135
|
-
- spec/
|
102
|
+
- spec/lib/client_spec.rb
|
103
|
+
- spec/lib/error_spec.rb
|
104
|
+
- spec/requests/request_spec.rb
|
105
|
+
- spec/spec_config.rb.sample
|
136
106
|
- spec/spec_helper.rb
|
107
|
+
- spec/support/filter_shared_examples_spec.rb
|
137
108
|
- spec/support/vcr.rb
|
138
109
|
- viki.gemspec
|
139
110
|
homepage: http://dev.viki.com
|
@@ -156,14 +127,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
127
|
version: '0'
|
157
128
|
requirements: []
|
158
129
|
rubyforge_project: viki
|
159
|
-
rubygems_version: 1.8.
|
130
|
+
rubygems_version: 1.8.6
|
160
131
|
signing_key:
|
161
132
|
specification_version: 3
|
162
133
|
summary: A thin wrapper around the Viki V3 API
|
163
134
|
test_files:
|
164
|
-
- spec/client_spec.rb
|
165
|
-
- spec/error_spec.rb
|
166
|
-
- spec/
|
167
|
-
- spec/
|
135
|
+
- spec/lib/client_spec.rb
|
136
|
+
- spec/lib/error_spec.rb
|
137
|
+
- spec/requests/request_spec.rb
|
138
|
+
- spec/spec_config.rb.sample
|
168
139
|
- spec/spec_helper.rb
|
140
|
+
- spec/support/filter_shared_examples_spec.rb
|
169
141
|
- spec/support/vcr.rb
|
File without changes
|
File without changes
|
File without changes
|