storify 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fixtures/vcr_cassettes/auth.yml +119 -0
- data/fixtures/vcr_cassettes/create.yml +71 -0
- data/fixtures/vcr_cassettes/delete.yml +63 -0
- data/fixtures/vcr_cassettes/edit_slug.yml +162 -0
- data/fixtures/vcr_cassettes/featured.yml +28991 -0
- data/fixtures/vcr_cassettes/latest.yml +13835 -0
- data/fixtures/vcr_cassettes/popular.yml +17002 -0
- data/fixtures/vcr_cassettes/profile.yml +86 -0
- data/fixtures/vcr_cassettes/profile_update.yml +238 -0
- data/fixtures/vcr_cassettes/publish.yml +352 -0
- data/fixtures/vcr_cassettes/save.yml +462 -0
- data/fixtures/vcr_cassettes/search.yml +4528 -0
- data/fixtures/vcr_cassettes/stories.yml +8505 -0
- data/fixtures/vcr_cassettes/story.yml +1194 -0
- data/fixtures/vcr_cassettes/topic.yml +31207 -0
- data/fixtures/vcr_cassettes/users.yml +1877 -0
- data/fixtures/vcr_cassettes/userstories.yml +843 -0
- data/lib/storify.rb +1 -1
- data/lib/storify/client.rb +30 -35
- data/lib/storify/storymeta.rb +2 -1
- data/lib/storify/string.rb +10 -0
- data/spec/client_auth_spec.rb +28 -15
- data/spec/client_edit_slug_spec.rb +30 -0
- data/spec/client_profile_spec.rb +19 -0
- data/spec/client_profile_update_spec.rb +57 -0
- data/spec/client_spec.rb +24 -237
- data/spec/client_stories_featured_spec.rb +28 -0
- data/spec/client_stories_latest_spec.rb +28 -0
- data/spec/client_stories_popular_spec.rb +28 -0
- data/spec/client_stories_search_spec.rb +29 -0
- data/spec/client_stories_spec.rb +28 -0
- data/spec/client_stories_topic_spec.rb +35 -0
- data/spec/client_story_create_spec.rb +40 -0
- data/spec/client_story_delete_spec.rb +19 -0
- data/spec/client_story_publish_spec.rb +74 -0
- data/spec/client_story_save_spec.rb +43 -0
- data/spec/client_story_spec.rb +46 -0
- data/spec/client_users_spec.rb +28 -0
- data/spec/client_userstories_spec.rb +32 -0
- data/spec/pager_spec.rb +41 -46
- data/spec/spec_helper.rb +41 -18
- data/spec/storify_spec.rb +73 -72
- metadata +97 -4
- data/spec/client_noauth_spec.rb +0 -120
data/spec/client_noauth_spec.rb
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# These methods did not work with authentication,
|
4
|
-
# so they have been forced to not use the auth token
|
5
|
-
|
6
|
-
describe "Storify::Client -- Unauthenticated" do
|
7
|
-
before(:each) do
|
8
|
-
@client = Storify::Client.new(:api_key => @api_key, :username => @username)
|
9
|
-
@options = {:version => :v1, :protocol => :insecure}
|
10
|
-
end
|
11
|
-
|
12
|
-
context "GET /stories" do
|
13
|
-
it "should get all stories until the maximum" do
|
14
|
-
@client.stories.length.should > 400
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should accept endpoint options (version, protocol)" do
|
18
|
-
@client.stories(options: @options).length.should > 400
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should accept paging options (Pager)" do
|
22
|
-
pager = Storify::Pager.new(page: 1, max: 2, per_page: 20)
|
23
|
-
@client.stories(pager: pager).length.should == 40
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "GET /stories/browse/latest" do
|
28
|
-
it "should get all the latest stories until the maximum" do
|
29
|
-
@client.latest.length.should > 400
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should accept endpoint options (version, protocol)" do
|
33
|
-
@client.latest(options: @options).length > 400
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should get the top 20 stories" do
|
37
|
-
pager = Storify::Pager.new(page: 1, max: 1, per_page: 20)
|
38
|
-
@client.latest(pager: pager).length.should == 20
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "GET /stories/browse/featured" do
|
43
|
-
it "should get all the featured stories until the maximum" do
|
44
|
-
@client.featured.length.should > 400
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should accept endpoint options (version, protocol)" do
|
48
|
-
@client.featured(options: @options).length > 400
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should get the top 20 featured stories" do
|
52
|
-
pager = Storify::Pager.new(page: 1, max: 1, per_page: 20)
|
53
|
-
@client.featured(pager: pager).length.should == 20
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context "GET /stories/browse/popular" do
|
58
|
-
it "should get all the popular stories until the maximum" do
|
59
|
-
@client.popular.length.should > 400
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should accept endpoint options (version, protocol)" do
|
63
|
-
@client.popular(options: @options).length > 400
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should get the top 15 popular stories" do
|
67
|
-
p = Storify::Pager.new(page: 1, max: 1, per_page: 15)
|
68
|
-
@client.popular(pager: p).length.should == 15
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
context "GET /stories/browse/topic/:topic" do
|
73
|
-
it "should get all stories with a topic until the maximum" do
|
74
|
-
@client.topic('nfl-playoffs').length.should > 1
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should accept endpoint options (version, protocol)" do
|
78
|
-
@client.topic('nfl-playoffs', options: @options).length.should > 1
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should get the top 10 stories for a topic" do
|
82
|
-
p = Storify::Pager.new(page: 1, max: 1, per_page: 10)
|
83
|
-
@client.topic('nfl-playoffs', pager: p).length.should == 10
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should raise an exception if the topic is not found" do
|
87
|
-
expect{@client.topic('does-not-exist-topic')}.to raise_exception(Storify::ApiError)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
context "GET /stories/search" do
|
92
|
-
it "should get all stories with a specified search criteria" do
|
93
|
-
@client.search('startups').length.should > 10
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should accept endpoint options (version, protocol)" do
|
97
|
-
@client.search('startups', options: @options).length.should > 10
|
98
|
-
end
|
99
|
-
|
100
|
-
it "should get the first 5 stories about startups" do
|
101
|
-
p = Storify::Pager.new(page: 1, max: 1, per_page: 5)
|
102
|
-
@client.search('startups', pager: p).length.should == 5
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
context "GET /users" do
|
107
|
-
it "should get all users until the maximum" do
|
108
|
-
@client.users.length.should > 100
|
109
|
-
end
|
110
|
-
|
111
|
-
it "should accept endpoint options (version, protocol)" do
|
112
|
-
@client.users(options: @options).length.should > 100
|
113
|
-
end
|
114
|
-
|
115
|
-
it "should support paging options" do
|
116
|
-
p = Storify::Pager.new(page: 1, max: 1, per_page: 10)
|
117
|
-
@client.users(pager: p).length.should == 10
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|