viki 0.0.3 → 0.0.4

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.
data/.gitignore CHANGED
@@ -7,3 +7,4 @@ pkg/*
7
7
  *.un~
8
8
  .idea/
9
9
  fixtures/
10
+ spec/secrets.rb
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use ruby-1.9.3-p125@viki-gem --create
1
+ rvm use ruby-1.9.3-p194@viki-gem --create
data/lib/viki/client.rb CHANGED
@@ -21,9 +21,9 @@ module Viki
21
21
  include Viki::Request
22
22
 
23
23
  def get
24
- result = request(@call_chain)
24
+ current_chain = @call_chain
25
25
  @call_chain = []
26
- result
26
+ request(current_chain)
27
27
  end
28
28
 
29
29
  def reset_access_token
data/lib/viki/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Viki
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/spec/request_spec.rb CHANGED
@@ -1,17 +1,18 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  require 'spec_helper'
4
+ require 'secrets'
4
5
  require 'filter_shared_examples_spec'
5
6
 
6
7
  describe "Viki" do
7
- let(:client_id) { '4bd5edd4ba26ac2f3ad9d204dc6359ea8a3ebe2c95b6bc1a9195c0ce5c57d392' }
8
- let(:client_secret) { 'f3b796a1eb6e06458a502a89171a494a9160775ed4f4e9e0008c638f7e7e7d38' }
8
+ let(:client_id) { CLIENT_ID }
9
+ let(:client_secret) { CLIENT_SECRET }
9
10
 
10
11
  describe "Auth" do
11
12
  it "should retrieve an access token when the Viki object is configured and initialized" do
12
13
  VCR.use_cassette "auth" do
13
14
  client = Viki.new(client_id, client_secret)
14
- client.access_token.should == '7e5c411d19aaa60f9a5d18d7cf3c44ae9cf7e28d5ccee84e1a4b699cb7ab07fc'
15
+ client.access_token.should_not be_nil
15
16
  end
16
17
  end
17
18
 
@@ -51,8 +52,6 @@ describe "Viki" do
51
52
  "Require watchable_in parameter when given platform parameter")
52
53
  end
53
54
  end
54
-
55
- #it_behaves_like "API with parameter filters"
56
55
  end
57
56
 
58
57
  describe "/movies/:id" do
@@ -160,10 +159,19 @@ describe "Viki" do
160
159
  end
161
160
  end
162
161
 
163
- describe ".method_missing" do
162
+ describe "Errors" do
164
163
  it "should raise NoMethodError if a method that is not on the whitelist is called" do
165
164
  expect { client.does_not_exist }.should raise_error(NoMethodError)
166
165
  end
166
+
167
+ it "should use the proper call chain after a failed request" do
168
+ VCR.use_cassette "movie_error" do
169
+ lambda { client.movies(50).get }.should raise_error(Viki::Error, "The resource couldn't be found")
170
+ end
171
+
172
+ results = client.movies.get
173
+ results.should be_instance_of(Viki::APIObject)
174
+ end
167
175
  end
168
176
  end
169
177
  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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-06-29 00:00:00.000000000 Z
14
+ date: 2012-07-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rspec