feedlr 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +22 -0
- data/.yardopts +5 -0
- data/Gemfile +32 -0
- data/Guardfile +7 -0
- data/LICENSE.md +16 -0
- data/README.md +85 -0
- data/Rakefile +10 -0
- data/feedlr.gemspec +27 -0
- data/lib/feedlr.rb +34 -0
- data/lib/feedlr/base.rb +4 -0
- data/lib/feedlr/client.rb +60 -0
- data/lib/feedlr/collection.rb +15 -0
- data/lib/feedlr/error.rb +79 -0
- data/lib/feedlr/gateway/categories.rb +36 -0
- data/lib/feedlr/gateway/entries.rb +40 -0
- data/lib/feedlr/gateway/evernote.rb +37 -0
- data/lib/feedlr/gateway/facebook.rb +28 -0
- data/lib/feedlr/gateway/feeds.rb +26 -0
- data/lib/feedlr/gateway/markers.rb +195 -0
- data/lib/feedlr/gateway/microsoft.rb +30 -0
- data/lib/feedlr/gateway/mixes.rb +29 -0
- data/lib/feedlr/gateway/opml.rb +26 -0
- data/lib/feedlr/gateway/preferences.rb +25 -0
- data/lib/feedlr/gateway/profile.rb +25 -0
- data/lib/feedlr/gateway/search.rb +41 -0
- data/lib/feedlr/gateway/shorten.rb +17 -0
- data/lib/feedlr/gateway/streams.rb +42 -0
- data/lib/feedlr/gateway/subscriptions.rb +43 -0
- data/lib/feedlr/gateway/tags.rb +88 -0
- data/lib/feedlr/gateway/topics.rb +43 -0
- data/lib/feedlr/gateway/twitter.rb +29 -0
- data/lib/feedlr/mapper.rb +25 -0
- data/lib/feedlr/rate_limit.rb +21 -0
- data/lib/feedlr/request.rb +148 -0
- data/lib/feedlr/success.rb +5 -0
- data/lib/feedlr/version.rb +15 -0
- data/spec/cassettes/Feedlr_Gateway_Categories/_change_category_label/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Categories/_delete_category/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Categories/_user_categories/resoponds_with_hashie_object.yml +52 -0
- data/spec/cassettes/Feedlr_Gateway_Entries/_add_entry/resoponds_with_hashie_object.yml +52 -0
- data/spec/cassettes/Feedlr_Gateway_Entries/_user_entries/resoponds_with_hashie_object.yml +337 -0
- data/spec/cassettes/Feedlr_Gateway_Evernote/_add_to_evernote/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Evernote/_evernote_notebooks/resoponds_with_hashie_object.yml +51 -0
- data/spec/cassettes/Feedlr_Gateway_Evernote/_unlink_evernote/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Facebook/_facebook_suggestions/resoponds_with_hashie_object.yml +52 -0
- data/spec/cassettes/Feedlr_Gateway_Facebook/_unlink_facebook/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Feeds/_feeds/resoponds_with_hashie_object.yml +51 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_lastest_tagged_entries/resoponds_with_hashie_object.yml +52 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_mark_articles_as_read/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_mark_articles_as_unread/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_mark_categories_as_read/with_asOf_param/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_mark_categories_as_read/with_lastReadEntryId_param/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_mark_feeds_as_read/with_asOf_param/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_mark_feeds_as_read/with_lastReadEntryId_param/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_sync_read_counts/resoponds_with_hashie_object.yml +52 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_undo_mark_categories_as_read/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_undo_mark_feeds_as_read/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Markers/_user_unread_counts/resoponds_with_hashie_object.yml +52 -0
- data/spec/cassettes/Feedlr_Gateway_Microsoft/_add_to_onenote/resoponds_with_hashie_object.yml +52 -0
- data/spec/cassettes/Feedlr_Gateway_Microsoft/_unlink_microsoft/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Mixes/_stream_most_engaging/resoponds_with_hashie_object.yml +102 -0
- data/spec/cassettes/Feedlr_Gateway_Opml/_import_opml/resoponds_with_hashie_object.yml +63 -0
- data/spec/cassettes/Feedlr_Gateway_Opml/_user_opml/resoponds_with_hashie_object.yml +80 -0
- data/spec/cassettes/Feedlr_Gateway_Preferences/_preferences/resoponds_with_hashie_object.yml +52 -0
- data/spec/cassettes/Feedlr_Gateway_Preferences/_update_preferences/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Profile/_get_profile/resoponds_with_hashie_object.yml +54 -0
- data/spec/cassettes/Feedlr_Gateway_Profile/_profile/resoponds_with_hashie_object.yml +54 -0
- data/spec/cassettes/Feedlr_Gateway_Profile/_update_profile/resoponds_with_hashie_object.yml +54 -0
- data/spec/cassettes/Feedlr_Gateway_Search/_search_feeds/resoponds_with_hashie_object.yml +303 -0
- data/spec/cassettes/Feedlr_Gateway_Search/_search_stream/resoponds_with_hashie_object.yml +1941 -0
- data/spec/cassettes/Feedlr_Gateway_Shorten/_shorten/resoponds_with_hashie_object.yml +51 -0
- data/spec/cassettes/Feedlr_Gateway_Streams/_stream_entries_contents/resoponds_with_hashie_object.yml +1150 -0
- data/spec/cassettes/Feedlr_Gateway_Streams/_stream_entries_ids/resoponds_with_hashie_object.yml +51 -0
- data/spec/cassettes/Feedlr_Gateway_Subscriptions/_add_subscription/resoponds_with_hashie_object.yml +53 -0
- data/spec/cassettes/Feedlr_Gateway_Subscriptions/_create_subscription/resoponds_with_hashie_object.yml +51 -0
- data/spec/cassettes/Feedlr_Gateway_Subscriptions/_delete_subscription/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Subscriptions/_update_subscription/resoponds_with_hashie_object.yml +51 -0
- data/spec/cassettes/Feedlr_Gateway_Subscriptions/_user_subscriptions/resoponds_with_hashie_object.yml +57 -0
- data/spec/cassettes/Feedlr_Gateway_Tags/_change_tag_label/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Tags/_delete_tags/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Tags/_get_tags/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Tags/_tag_entries/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Tags/_untag_entries/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Tags/_user_tags/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Topics/_add_topic/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Topics/_delete_topic/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Topics/_update_topic/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Topics/_user_topics/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Twitter/_twitter_suggestions/resoponds_with_hashie_object.yml +50 -0
- data/spec/cassettes/Feedlr_Gateway_Twitter/_unlink_twitter/resoponds_with_hashie_object.yml +50 -0
- data/spec/feedly/base_spec.rb +10 -0
- data/spec/feedly/client_spec.rb +49 -0
- data/spec/feedly/collection_spec.rb +21 -0
- data/spec/feedly/error_spec.rb +59 -0
- data/spec/feedly/feedly_spec.rb +54 -0
- data/spec/feedly/gateway/categories_spec.rb +59 -0
- data/spec/feedly/gateway/entries_spec.rb +67 -0
- data/spec/feedly/gateway/evernote_spec.rb +60 -0
- data/spec/feedly/gateway/facebook_spec.rb +36 -0
- data/spec/feedly/gateway/feeds_spec.rb +36 -0
- data/spec/feedly/gateway/markers_spec.rb +295 -0
- data/spec/feedly/gateway/microsoft_spec.rb +40 -0
- data/spec/feedly/gateway/mixes_spec.rb +27 -0
- data/spec/feedly/gateway/opml_spec.rb +57 -0
- data/spec/feedly/gateway/preferences_spec.rb +41 -0
- data/spec/feedly/gateway/profile_spec.rb +40 -0
- data/spec/feedly/gateway/search_spec.rb +43 -0
- data/spec/feedly/gateway/shorten_spec.rb +27 -0
- data/spec/feedly/gateway/streams_spec.rb +44 -0
- data/spec/feedly/gateway/subscriptions_spec.rb +87 -0
- data/spec/feedly/gateway/tags_spec.rb +129 -0
- data/spec/feedly/gateway/topics_spec.rb +77 -0
- data/spec/feedly/gateway/twitter_spec.rb +37 -0
- data/spec/feedly/mapper_spec.rb +25 -0
- data/spec/feedly/rate_limit_spec.rb +41 -0
- data/spec/feedly/request_spec.rb +74 -0
- data/spec/feedly/success_spec.rb +7 -0
- data/spec/feedly/version_spec.rb +9 -0
- data/spec/helper.rb +52 -0
- metadata +319 -0
@@ -0,0 +1,295 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Feedlr::Gateway::Markers, vcr: { record: :new_episodes } do
|
4
|
+
let(:client) do
|
5
|
+
Feedlr::Client.new(sandbox: true, oauth_access_token: access_token)
|
6
|
+
end
|
7
|
+
let(:feeds_ids) do
|
8
|
+
['feed/http://feeds.engadget.com/weblogsinc/engadget',
|
9
|
+
'feed/http://www.yatzer.com/feed/index.php']
|
10
|
+
end
|
11
|
+
let(:categories_ids) do
|
12
|
+
['user/96cc52b7-a17f-4ce0-9b38-de1b6f08f156/category/Tech',
|
13
|
+
'user/96cc52b7-a17f-4ce0-9b38-de1b6f08f156/category/Entreprenuership']
|
14
|
+
end
|
15
|
+
let(:articles_ids) do
|
16
|
+
['qXKMwD+H9w7rc42rGNxj3U1BuAKE5TpW1EZAANkzhmk=_145e2cb3a50:2c3:592195db',
|
17
|
+
'qXKMwD+H9w7rc42rGNxj3U1BuAKE5TpW1EZAANkzhmk=_145b9cdf580:544:7f4ba42e']
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#user_unread_counts' do
|
21
|
+
let(:options) { { autorefresh: '1' } }
|
22
|
+
it 'sends a get request' do
|
23
|
+
stub = stub_request(:get, 'http://sandbox.feedly.com/v3/markers/counts')
|
24
|
+
.with(query: options)
|
25
|
+
client.user_unread_counts(options)
|
26
|
+
expect(stub).to have_been_requested
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'resoponds with hashie object' do
|
30
|
+
subject = client.user_unread_counts(options)
|
31
|
+
expect(subject.unreadcounts.size).to be > 1
|
32
|
+
expect(subject.unreadcounts.first.count).to be > 1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe '#mark_article_as_read' do
|
37
|
+
it 'calls mark_articles_as_read' do
|
38
|
+
allow(client).to receive(:mark_articles_as_read)
|
39
|
+
expect(client).to receive(:mark_articles_as_read)
|
40
|
+
.with([articles_ids.first])
|
41
|
+
client.mark_article_as_read(articles_ids.first)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#mark_articles_as_read' do
|
46
|
+
it 'sends a post request' do
|
47
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/markers')
|
48
|
+
.with(body: MultiJson.dump(
|
49
|
+
entryIds: articles_ids,
|
50
|
+
action: 'markAsRead',
|
51
|
+
type: 'entries'
|
52
|
+
))
|
53
|
+
client.mark_articles_as_read(articles_ids)
|
54
|
+
expect(stub).to have_been_requested
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'resoponds with hashie object' do
|
58
|
+
subject = client.mark_articles_as_read(articles_ids)
|
59
|
+
expect(subject).to be_a(Feedlr::Success)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe '#mark_article_as_unread' do
|
64
|
+
it 'calls mark_articles_as_unread' do
|
65
|
+
allow(client).to receive(:mark_articles_as_unread)
|
66
|
+
expect(client).to receive(:mark_articles_as_unread)
|
67
|
+
.with([articles_ids.first])
|
68
|
+
client.mark_article_as_unread(articles_ids.first)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#mark_articles_as_unread' do
|
73
|
+
it 'sends a post request' do
|
74
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/markers')
|
75
|
+
.with(body: MultiJson.dump(
|
76
|
+
entryIds: articles_ids,
|
77
|
+
action: 'keepUnread',
|
78
|
+
type: 'entries'
|
79
|
+
)).to_return(body: '{ }')
|
80
|
+
client.mark_articles_as_unread(articles_ids)
|
81
|
+
expect(stub).to have_been_requested
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'resoponds with hashie object' do
|
85
|
+
subject = client.mark_articles_as_unread(articles_ids)
|
86
|
+
expect(subject).to be_a(Feedlr::Success)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe '#mark_feed_as_read' do
|
91
|
+
[:lastReadEntryId, :asOf].each do|param|
|
92
|
+
context 'with #{ param} param' do
|
93
|
+
it 'calls mark_feeds_as_read' do
|
94
|
+
allow(client).to receive(:mark_feeds_as_read)
|
95
|
+
expect(client).to receive(:mark_feeds_as_read)
|
96
|
+
.with([feeds_ids.first], param => 'test')
|
97
|
+
client.mark_feed_as_read(feeds_ids.first, param => 'test')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
describe '#mark_feeds_as_read' do
|
104
|
+
context 'with lastReadEntryId param' do
|
105
|
+
let(:lastReadEntryId) do
|
106
|
+
'k3wM4lkt2uyzklIaZG/piLCFwWpRsuSz4luWQLHP0YY=_142814c6526:338b:2190d777'
|
107
|
+
end
|
108
|
+
it 'sends a post request' do
|
109
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/markers')
|
110
|
+
.with(body: MultiJson.dump(
|
111
|
+
feedIds: feeds_ids,
|
112
|
+
action: 'markAsRead',
|
113
|
+
type: 'feeds',
|
114
|
+
lastReadEntryId: lastReadEntryId
|
115
|
+
)).to_return(body: '{ }')
|
116
|
+
client.mark_feeds_as_read(feeds_ids, lastReadEntryId: lastReadEntryId)
|
117
|
+
expect(stub).to have_been_requested
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'resoponds with hashie object' do
|
121
|
+
subject = client.mark_feeds_as_read(feeds_ids,
|
122
|
+
lastReadEntryId: lastReadEntryId)
|
123
|
+
expect(subject).to be_a(Feedlr::Success)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'with asOf param' do
|
128
|
+
let(:asOf) { '1400876097' }
|
129
|
+
it 'sends a post request' do
|
130
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/markers')
|
131
|
+
.with(body: MultiJson.dump(
|
132
|
+
feedIds: feeds_ids,
|
133
|
+
action: 'markAsRead',
|
134
|
+
type: 'feeds',
|
135
|
+
asOf: asOf
|
136
|
+
)).to_return(body: '{ }')
|
137
|
+
client.mark_feeds_as_read(feeds_ids, asOf: asOf)
|
138
|
+
expect(stub).to have_been_requested
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'resoponds with hashie object' do
|
142
|
+
subject = client.mark_feeds_as_read(feeds_ids, asOf: asOf)
|
143
|
+
expect(subject).to be_a(Feedlr::Success)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
describe '#mark_category_as_read' do
|
150
|
+
[:lastReadEntryId, :asOf].each do |param|
|
151
|
+
context 'with #{ param} param' do
|
152
|
+
it 'calls mark_categories_as_read' do
|
153
|
+
allow(client).to receive(:mark_categories_as_read)
|
154
|
+
expect(client).to receive(:mark_categories_as_read)
|
155
|
+
.with([categories_ids.first], param => 'test')
|
156
|
+
client.mark_category_as_read(categories_ids.first,
|
157
|
+
param => 'test')
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
describe '#mark_categories_as_read' do
|
164
|
+
context 'with lastReadEntryId param' do
|
165
|
+
let(:lastReadEntryId) do
|
166
|
+
'k3wM4lkt2uyzklIaZG/piLCFwWpRsuSz4luWQLHP0YY=_142814c6526:338b:2190d777'
|
167
|
+
end
|
168
|
+
it 'sends a post request' do
|
169
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/markers')
|
170
|
+
.with(body: MultiJson.dump(
|
171
|
+
categoryIds: categories_ids,
|
172
|
+
action: 'markAsRead',
|
173
|
+
type: 'categories',
|
174
|
+
lastReadEntryId: lastReadEntryId
|
175
|
+
)).to_return(body: '{ }')
|
176
|
+
client.mark_categories_as_read(categories_ids,
|
177
|
+
lastReadEntryId: lastReadEntryId)
|
178
|
+
expect(stub).to have_been_requested
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'resoponds with hashie object' do
|
182
|
+
subject = client.mark_categories_as_read(categories_ids,
|
183
|
+
lastReadEntryId:
|
184
|
+
lastReadEntryId)
|
185
|
+
expect(subject).to be_a(Feedlr::Success)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
context 'with asOf param' do
|
190
|
+
let(:asOf) { '1400876097' }
|
191
|
+
it 'sends a post request' do
|
192
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/markers')
|
193
|
+
.with(body: MultiJson.dump(
|
194
|
+
categoryIds: categories_ids,
|
195
|
+
action: 'markAsRead',
|
196
|
+
type: 'categories',
|
197
|
+
asOf: asOf
|
198
|
+
)).to_return(body: '{ }')
|
199
|
+
client.mark_categories_as_read(categories_ids, asOf: asOf)
|
200
|
+
expect(stub).to have_been_requested
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'resoponds with hashie object' do
|
204
|
+
subject = client.mark_categories_as_read(categories_ids, asOf: asOf)
|
205
|
+
expect(subject).to be_a(Feedlr::Success)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
210
|
+
|
211
|
+
describe '#undo_mark_feed_as_read' do
|
212
|
+
it 'calls undo_mark_feeds_as_read' do
|
213
|
+
allow(client).to receive(:undo_mark_feeds_as_read)
|
214
|
+
expect(client).to receive(:undo_mark_feeds_as_read)
|
215
|
+
.with([feeds_ids.first])
|
216
|
+
client.undo_mark_feed_as_read(feeds_ids.first)
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
describe '#undo_mark_feeds_as_read' do
|
221
|
+
it 'sends a post request' do
|
222
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/markers')
|
223
|
+
.with(body: MultiJson.dump(
|
224
|
+
feedIds: feeds_ids,
|
225
|
+
action: 'undoMarkAsRead',
|
226
|
+
type: 'feeds'
|
227
|
+
)).to_return(body: '{ }')
|
228
|
+
client.undo_mark_feeds_as_read(feeds_ids)
|
229
|
+
expect(stub).to have_been_requested
|
230
|
+
end
|
231
|
+
|
232
|
+
it 'resoponds with hashie object' do
|
233
|
+
subject = client.undo_mark_feeds_as_read(feeds_ids)
|
234
|
+
expect(subject).to be_a(Feedlr::Success)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
describe '#undo_mark_category_as_read' do
|
239
|
+
it 'calls undo_mark_categories_as_read' do
|
240
|
+
allow(client).to receive(:undo_mark_categories_as_read)
|
241
|
+
expect(client).to receive(:undo_mark_categories_as_read)
|
242
|
+
.with([categories_ids.first])
|
243
|
+
client.undo_mark_category_as_read(categories_ids.first)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
describe '#undo_mark_categories_as_read' do
|
248
|
+
it 'sends a post request' do
|
249
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/markers')
|
250
|
+
.with(body: MultiJson.dump(
|
251
|
+
categoryIds: categories_ids,
|
252
|
+
action: 'undoMarkAsRead',
|
253
|
+
type: 'categories'
|
254
|
+
)).to_return(body: '{ }')
|
255
|
+
client.undo_mark_categories_as_read(categories_ids)
|
256
|
+
expect(stub).to have_been_requested
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'resoponds with hashie object' do
|
260
|
+
subject = client.undo_mark_categories_as_read(categories_ids)
|
261
|
+
expect(subject).to be_a(Feedlr::Success)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
describe '#sync_read_counts' do
|
266
|
+
let(:options) { { newerThan: '1400876097' } }
|
267
|
+
it 'sends a get request' do
|
268
|
+
stub = stub_request(:get, 'http://sandbox.feedly.com/v3/markers/reads')
|
269
|
+
.with(query: options)
|
270
|
+
client.sync_read_counts(options)
|
271
|
+
expect(stub).to have_been_requested
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'resoponds with hashie object' do
|
275
|
+
subject = client.sync_read_counts(options)
|
276
|
+
expect(subject.entries.size).to be > 1
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
describe '#lastest_tagged_entries' do
|
281
|
+
let(:options) { { newerThan: '1400876097' } }
|
282
|
+
it 'sends a get request' do
|
283
|
+
stub = stub_request(:get, 'http://sandbox.feedly.com/v3/markers/tags')
|
284
|
+
.with(query: options)
|
285
|
+
client.lastest_tagged_entries(options)
|
286
|
+
expect(stub).to have_been_requested
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'resoponds with hashie object' do
|
290
|
+
subject = client.lastest_tagged_entries(options)
|
291
|
+
expect(subject.taggedEntries.size).to be > 1
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Feedlr::Gateway::Microsoft, vcr: { record: :new_episodes } do
|
4
|
+
let(:client) do
|
5
|
+
Feedlr::Client.new(sandbox: true, oauth_access_token: access_token)
|
6
|
+
end
|
7
|
+
describe '#unlink_microsoft' do
|
8
|
+
|
9
|
+
it 'sends a delete request' do
|
10
|
+
stub = stub_request(:delete, 'http://sandbox.feedly.com/v3/microsoft/' \
|
11
|
+
'liveAuth')
|
12
|
+
client.unlink_microsoft
|
13
|
+
expect(stub).to have_been_requested
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'resoponds with hashie object' do
|
17
|
+
subject = client.unlink_microsoft
|
18
|
+
expect(subject).to be_a(Feedlr::Success)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#add_to_onenote' do
|
23
|
+
let(:entry_id) do
|
24
|
+
'k3wM4lkt2uyzklIaZG/piLCFwWpRsuSz4luWQLHP0YY=_142814c6526:338b:2190d777'
|
25
|
+
end
|
26
|
+
it 'sends a get request' do
|
27
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/microsoft/' \
|
28
|
+
'oneNoteAdd').with(body: MultiJson.dump(entryId: entry_id))
|
29
|
+
|
30
|
+
client.add_to_onenote(entry_id)
|
31
|
+
expect(stub).to have_been_requested
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'resoponds with hashie object' do
|
35
|
+
subject = client.add_to_onenote(entry_id)
|
36
|
+
expect(subject.pageUrl).to be
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Feedlr::Gateway::Mixes, vcr: { record: :new_episodes } do
|
4
|
+
let(:client) do
|
5
|
+
Feedlr::Client.new(sandbox: true, oauth_access_token: access_token)
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:options) { { count: '30' } }
|
9
|
+
describe '#stream_most_engaging' do
|
10
|
+
let(:stream) do
|
11
|
+
'user/96cc52b7-a17f-4ce0-9b38-de1b6f08f156/category/Entreprenuership'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'sends a get request' do
|
15
|
+
stub = stub_request(:get, 'http://sandbox.feedly.com/v3/mixes/contents')
|
16
|
+
.with(query: { streamId: stream }.merge(options))
|
17
|
+
client.stream_most_engaging(stream, options)
|
18
|
+
expect(stub).to have_been_requested
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'resoponds with hashie object' do
|
22
|
+
subject = client.stream_most_engaging(stream, options)
|
23
|
+
expect(subject.items.size).to be >= 1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Feedlr::Gateway::Opml, vcr: { record: :new_episodes } do
|
4
|
+
let(:client) do
|
5
|
+
Feedlr::Client.new(sandbox: true, oauth_access_token: access_token)
|
6
|
+
end
|
7
|
+
describe '#user_opml' do
|
8
|
+
|
9
|
+
it 'sends a get request' do
|
10
|
+
stub = stub_request(:get, 'http://sandbox.feedly.com/v3/opml')
|
11
|
+
.with(headers: { 'Content-Type' => 'text/xml' })
|
12
|
+
client.user_opml
|
13
|
+
expect(stub).to have_been_requested
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'resoponds with hashie object' do
|
17
|
+
subject = client.user_opml
|
18
|
+
expect(subject.opml.size).to be(3)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#import_opml' do
|
23
|
+
before :each do
|
24
|
+
data = '
|
25
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
26
|
+
<opml version="1.0">
|
27
|
+
<body>
|
28
|
+
<outline title="MY" icon="">
|
29
|
+
<outline title="Coding Horror" type="rss" xmlUrl="http://feeds.feedburner.'\
|
30
|
+
'com/codinghorror" htmlUrl="http://www.codinghorror.com/blog/"/>
|
31
|
+
<outline title="Git Ready" type="rss" xmlUrl="http://feeds.feedburner.com/'\
|
32
|
+
'git-ready" htmlUrl="http://gitready.com/"/>
|
33
|
+
<outline title="PragDave" type="rss" xmlUrl="http://pragdave.blogs'\
|
34
|
+
'.pragprog.com/pragdave/atom.xml" htmlUrl="http://pragdave.blogs'\
|
35
|
+
'.pragprog.com/pragdave/"/>
|
36
|
+
</outline>
|
37
|
+
</body>
|
38
|
+
</opml>
|
39
|
+
'
|
40
|
+
@xml_data = StringIO.new(data)
|
41
|
+
end
|
42
|
+
it 'sends a post request' do
|
43
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/opml')
|
44
|
+
.with(headers: { 'Content-Type' => 'text/xml' },
|
45
|
+
body: @xml_data.read)
|
46
|
+
@xml_data.rewind
|
47
|
+
client.import_opml(@xml_data)
|
48
|
+
expect(stub).to have_been_requested
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'resoponds with hashie object' do
|
52
|
+
subject = client.import_opml(@xml_data)
|
53
|
+
expect(subject).to be_a(Feedlr::Success)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Feedlr::Gateway::Preferences, vcr: { record: :new_episodes } do
|
4
|
+
let(:client) do
|
5
|
+
Feedlr::Client.new(sandbox: true, oauth_access_token: access_token)
|
6
|
+
end
|
7
|
+
describe '#preferences' do
|
8
|
+
|
9
|
+
it 'sends a get request' do
|
10
|
+
stub = stub_request(:get, 'http://sandbox.feedly.com/v3/preferences')
|
11
|
+
.to_return(body: '{ }')
|
12
|
+
client.preferences
|
13
|
+
expect(stub).to have_been_requested
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'resoponds with hashie object' do
|
17
|
+
subject = client.preferences
|
18
|
+
expect(subject.size).to be >= 2
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#update_preferences' do
|
23
|
+
let(:preferences) do
|
24
|
+
{ :'category/reviews/entryOverviewSize' => 0,
|
25
|
+
:'category/photography/entryOverviewSize' => 7 }
|
26
|
+
end
|
27
|
+
it 'sends a post request' do
|
28
|
+
stub = stub_request(:post, 'http://sandbox.feedly.com/v3/preferences')
|
29
|
+
.with(body: MultiJson.dump(preferences))
|
30
|
+
client.update_preferences(preferences)
|
31
|
+
expect(stub).to have_been_requested
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'resoponds with hashie object' do
|
35
|
+
subject = client.update_preferences(preferences)
|
36
|
+
expect(subject.gender).to eq('female')
|
37
|
+
expect(subject.fullName).to eq('Best lady')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|