instapaper 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. data/{PostInstall.txt → .gemtest} +0 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +3 -0
  4. data/.simplecov +1 -0
  5. data/.yardopts +3 -0
  6. data/Gemfile +2 -0
  7. data/LICENSE.md +20 -0
  8. data/README.md +152 -0
  9. data/Rakefile +13 -4
  10. data/instapaper.gemspec +33 -0
  11. data/lib/faraday/response/raise_http_1xxx.rb +65 -0
  12. data/lib/instapaper.rb +26 -10
  13. data/lib/instapaper/authentication.rb +32 -0
  14. data/lib/instapaper/client.rb +43 -0
  15. data/lib/instapaper/client/account.rb +13 -0
  16. data/lib/instapaper/client/bookmark.rb +81 -0
  17. data/lib/instapaper/client/folder.rb +34 -0
  18. data/lib/instapaper/client/user.rb +14 -0
  19. data/lib/instapaper/configuration.rb +88 -0
  20. data/lib/instapaper/connection.rb +35 -0
  21. data/lib/instapaper/request.rb +22 -9
  22. data/lib/instapaper/version.rb +1 -31
  23. data/spec/faraday/response_spec.rb +22 -0
  24. data/spec/fixtures/access_token.qline +1 -0
  25. data/spec/fixtures/bookmarks_add.json +1 -0
  26. data/spec/fixtures/bookmarks_archive.json +1 -0
  27. data/spec/fixtures/bookmarks_get_text.txt +299 -0
  28. data/spec/fixtures/bookmarks_list.json +5 -0
  29. data/spec/fixtures/bookmarks_move.json +1 -0
  30. data/spec/fixtures/bookmarks_star.json +1 -0
  31. data/spec/fixtures/bookmarks_unarchive.json +1 -0
  32. data/spec/fixtures/bookmarks_unstar.json +1 -0
  33. data/spec/fixtures/bookmarks_update_read_progress.json +1 -0
  34. data/spec/fixtures/folders_add.json +1 -0
  35. data/spec/fixtures/folders_delete.json +1 -0
  36. data/spec/fixtures/folders_list.json +1 -0
  37. data/spec/fixtures/folders_set_order.json +1 -0
  38. data/spec/fixtures/verify_credentials.json +1 -0
  39. data/spec/instapaper/client/account_spec.rb +27 -0
  40. data/spec/instapaper/client/bookmark_spec.rb +234 -0
  41. data/spec/instapaper/client/folder_spec.rb +89 -0
  42. data/spec/instapaper/client/user_spec.rb +28 -0
  43. data/spec/instapaper/client_spec.rb +65 -0
  44. data/spec/instapaper_spec.rb +85 -0
  45. data/spec/spec_helper.rb +44 -0
  46. metadata +230 -99
  47. data/History.txt +0 -3
  48. data/Manifest.txt +0 -43
  49. data/README.rdoc +0 -73
  50. data/config/hoe.rb +0 -73
  51. data/config/requirements.rb +0 -15
  52. data/lib/instapaper/base.rb +0 -113
  53. data/lib/instapaper/constants.rb +0 -37
  54. data/lib/instapaper/exceptions.rb +0 -41
  55. data/lib/instapaper/protocol.rb +0 -47
  56. data/lib/instapaper/request/abstract_request.rb +0 -104
  57. data/lib/instapaper/request/add_url_request.rb +0 -68
  58. data/lib/instapaper/request/authentication_request.rb +0 -60
  59. data/lib/instapaper/request/request_error.rb +0 -34
  60. data/lib/instapaper/request/request_errors.rb +0 -41
  61. data/lib/instapaper/request/request_validation.rb +0 -34
  62. data/lib/instapaper/response.rb +0 -10
  63. data/lib/instapaper/response/abstract_response.rb +0 -38
  64. data/lib/instapaper/response/add_url_success_response.rb +0 -41
  65. data/lib/instapaper/response/authentication_invalid_response.rb +0 -40
  66. data/lib/instapaper/response/authentication_success_response.rb +0 -40
  67. data/lib/instapaper/response/bad_request_response.rb +0 -40
  68. data/lib/instapaper/response/response_builder.rb +0 -61
  69. data/lib/instapaper/response/service_error_response.rb +0 -40
  70. data/script/console +0 -10
  71. data/script/destroy +0 -14
  72. data/script/generate +0 -14
  73. data/script/txt2html +0 -82
  74. data/setup.rb +0 -1585
  75. data/tasks/deployment.rake +0 -34
  76. data/tasks/environment.rake +0 -7
  77. data/tasks/website.rake +0 -17
  78. data/test/test_auth.rb +0 -62
  79. data/test/test_error.rb +0 -81
  80. data/test/test_helper.rb +0 -2
  81. data/test/test_instapaper.rb +0 -9
  82. data/test/test_request.rb +0 -45
  83. data/website/index.html +0 -99
  84. data/website/index.txt +0 -69
  85. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  86. data/website/stylesheets/screen.css +0 -138
  87. data/website/template.html.erb +0 -48
@@ -0,0 +1,5 @@
1
+ [{"type":"meta"},
2
+ {"type":"user","user_id":1075837,"username":"steve.agalloco@gmail.com","subscription_is_active":"1"},
3
+ {"type":"bookmark","bookmark_id":170939225,"url":"http:\/\/www.igvita.com\/2010\/11\/17\/routing-with-ruby-zeromq-devices\/","title":"Routing with Ruby & ZeroMQ Devices","description":"ZeroMQ sockets provide message-oriented messaging, support for multiple transports, transparent setup and teardown, and an entire array of routing patterns via different socket types","time":1307319089,"starred":"0","private_source":"","hash":"PGU0MMPw","progress":0,"progress_timestamp":0},
4
+ {"type":"bookmark","bookmark_id":169529989,"url":"http:\/\/www.fastcodesign.com\/1662169\/ideos-axioms-for-starting-disruptive-new-businesses","title":"Ideo's Axioms for Starting Disruptive New Businesses | Co.Design","description":"www.fastcodesign.com","time":1306963988,"starred":"0","private_source":"","hash":"v27qHZc2","progress":"0","progress_timestamp":1307145892}
5
+ ]
@@ -0,0 +1 @@
1
+ [{"type":"bookmark","bookmark_id":169529989,"url":"http:\/\/www.fastcodesign.com\/1662169\/ideos-axioms-for-starting-disruptive-new-businesses","title":"Ideo's Axioms for Starting Disruptive New Businesses | Co.Design","description":"www.fastcodesign.com","time":1307586766,"starred":"0","private_source":"","hash":"9GZzaC8U","progress":"0","progress_timestamp":1307585389}]
@@ -0,0 +1 @@
1
+ [{"type":"bookmark","bookmark_id":170939225,"url":"http:\/\/www.igvita.com\/2010\/11\/17\/routing-with-ruby-zeromq-devices\/","title":"Routing with Ruby & ZeroMQ Devices","description":"ZeroMQ sockets provide message-oriented messaging, support for multiple transports, transparent setup and teardown, and an entire array of routing patterns via different socket types","time":1307319089,"starred":"1","private_source":"","hash":"PGU0MMPw","progress":0,"progress_timestamp":0}]
@@ -0,0 +1 @@
1
+ [{"type":"bookmark","bookmark_id":169529989,"url":"http:\/\/www.fastcodesign.com\/1662169\/ideos-axioms-for-starting-disruptive-new-businesses","title":"Ideo's Axioms for Starting Disruptive New Businesses | Co.Design","description":"www.fastcodesign.com","time":1307507347,"starred":"0","private_source":"","hash":"v27qHZc2","progress":"0","progress_timestamp":1307145892}]
@@ -0,0 +1 @@
1
+ [{"type":"bookmark","bookmark_id":170939225,"url":"http:\/\/www.igvita.com\/2010\/11\/17\/routing-with-ruby-zeromq-devices\/","title":"Routing with Ruby & ZeroMQ Devices","description":"ZeroMQ sockets provide message-oriented messaging, support for multiple transports, transparent setup and teardown, and an entire array of routing patterns via different socket types","time":1307319089,"starred":"0","private_source":"","hash":"PGU0MMPw","progress":0,"progress_timestamp":0}]
@@ -0,0 +1 @@
1
+ [{"type":"bookmark","bookmark_id":169529989,"url":"http:\/\/www.fastcodesign.com\/1662169\/ideos-axioms-for-starting-disruptive-new-businesses","title":"Ideo's Axioms for Starting Disruptive New Businesses | Co.Design","description":"www.fastcodesign.com","time":1307507347,"starred":"0","private_source":"","hash":"6n9G6qFt","progress":"0.5","progress_timestamp":1307585332}]
@@ -0,0 +1 @@
1
+ [{"type":"folder","folder_id":1121141,"title":"Ruby","sync_to_mobile":"1","position":1307330035}]
@@ -0,0 +1 @@
1
+ [{"type":"folder","folder_id":1121173,"title":"Ruby","sync_to_mobile":"1","position":1307331865},{"type":"folder","folder_id":1121174,"title":"JavaScript","sync_to_mobile":"1","position":1307331865}]
@@ -0,0 +1 @@
1
+ [{"type":"folder","folder_id":1121174,"title":"JavaScript","sync_to_mobile":"1","position":1},{"type":"folder","folder_id":1121173,"title":"Ruby","sync_to_mobile":"1","position":2}]
@@ -0,0 +1 @@
1
+ [{"type":"user","user_id":54321,"username":"TestUserOMGLOL"}]
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Instapaper::Client::Account do
4
+ before(:each) do
5
+ @client = Instapaper::Client.new
6
+ end
7
+
8
+ describe '.verify_credentials' do
9
+ before do
10
+ stub_post("account/verify_credentials").
11
+ to_return(:body => fixture("verify_credentials.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ end
13
+
14
+ it "should get the correct resource" do
15
+ @client.verify_credentials
16
+ a_post("account/verify_credentials").
17
+ should have_been_made
18
+ end
19
+
20
+ it "should return the user" do
21
+ user = @client.verify_credentials.first
22
+ user.should be_a Hashie::Rash
23
+ user.username.should == 'TestUserOMGLOL'
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,234 @@
1
+ require 'spec_helper'
2
+
3
+ describe Instapaper::Client::Bookmark do
4
+ before(:each) do
5
+ @client = Instapaper::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :oauth_token => 'OT', :oauth_token_secret => 'OS')
6
+ end
7
+
8
+ describe '.bookmarks' do
9
+ before do
10
+ stub_post("bookmarks/list").
11
+ to_return(:body => fixture("bookmarks_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ end
13
+
14
+ it "should get the correct resource" do
15
+ @client.bookmarks
16
+ a_post("bookmarks/list").
17
+ should have_been_made
18
+ end
19
+
20
+ it "should return an array containing bookmarks on success" do
21
+ bookmarks = @client.bookmarks
22
+ bookmarks.should be_an Array
23
+ bookmarks.size.should == 2
24
+ end
25
+
26
+ it "should remove the meta and current user objects from the array" do
27
+ bookmarks = @client.bookmarks
28
+ bookmarks.each do |bookmark|
29
+ bookmark.should be_a Hashie::Rash
30
+ bookmark.type.should == 'bookmark'
31
+ end
32
+ end
33
+ end
34
+
35
+ describe '.update_read_progress' do
36
+ before do
37
+ @time = Time.now
38
+ stub_post("bookmarks/update_read_progress").
39
+ to_return(:body => fixture("bookmarks_update_read_progress.json"), :headers => {:content_type => "application/json; charset=utf-8"})
40
+ end
41
+
42
+ it "should get the correct resource" do
43
+ @client.update_read_progress(123, 0.5, @time)
44
+ a_post("bookmarks/update_read_progress").with(:body => {:bookmark_id => "123", :progress => '0.5', :progress_timestamp => @time.to_i.to_s }).
45
+ should have_been_made
46
+ end
47
+
48
+ it "should return an array containing bookmarks on success" do
49
+ bookmark = @client.update_read_progress(123, 0.5, @time)
50
+ bookmark.should be_a Hashie::Rash
51
+ bookmark.type.should == 'bookmark'
52
+ bookmark.progress.should == "0.5"
53
+ end
54
+ end
55
+
56
+ describe '.add_bookmark' do
57
+ before do
58
+ stub_post("bookmarks/add").
59
+ to_return(:body => fixture('bookmarks_add.json'), :headers => {:content_type => "application/json; charset=utf-8"})
60
+ end
61
+
62
+ it "should get the correct resource" do
63
+ @client.add_bookmark('http://someurl.com', :title => 'This is the title', :description => 'This is the description')
64
+ a_post("bookmarks/add").with(:body => {:url => "http://someurl.com", :title => 'This is the title', :description => 'This is the description' }).
65
+ should have_been_made
66
+ end
67
+
68
+ it "should return the bookmark on success" do
69
+ bookmark = @client.add_bookmark('http://someurl.com', :title => 'This is the title', :description => 'This is the description')
70
+ bookmark.should be_a Hashie::Rash
71
+ bookmark.type.should == 'bookmark'
72
+ end
73
+ end
74
+
75
+ describe '.delete_bookmark' do
76
+ before do
77
+ stub_post("bookmarks/delete").
78
+ to_return(:body => '[]', :headers => {:content_type => "application/json; charset=utf-8"})
79
+ end
80
+
81
+ it "should get the correct resource" do
82
+ @client.delete_bookmark(123)
83
+ a_post("bookmarks/delete").with(:body => {:bookmark_id => "123" }).
84
+ should have_been_made
85
+ end
86
+
87
+ it "should return an array containing bookmarks on success" do
88
+ confirm = @client.delete_bookmark(123)
89
+ confirm.should be_an Array
90
+ confirm.should be_empty
91
+ end
92
+ end
93
+
94
+ describe '.star' do
95
+ before do
96
+ stub_post("bookmarks/star").
97
+ to_return(:body => fixture("bookmarks_star.json"), :headers => {:content_type => "application/json; charset=utf-8"})
98
+ end
99
+
100
+ it "should get the correct resource" do
101
+ @client.star(123)
102
+ a_post("bookmarks/star").with(:body => {:bookmark_id => "123" }).
103
+ should have_been_made
104
+ end
105
+
106
+ it "should return a starred bookmark on success" do
107
+ bookmark = @client.star(123)
108
+ bookmark.should be_a Hashie::Rash
109
+ bookmark.type.should == 'bookmark'
110
+ bookmark.starred.should == '1'
111
+ end
112
+
113
+ it 'should be aliased as .star_bookmark' do
114
+ @client.star(123).should == @client.star_bookmark(123)
115
+ end
116
+ end
117
+
118
+ describe '.unstar' do
119
+ before do
120
+ stub_post("bookmarks/unstar").
121
+ to_return(:body => fixture("bookmarks_unstar.json"), :headers => {:content_type => "application/json; charset=utf-8"})
122
+ end
123
+
124
+ it "should get the correct resource" do
125
+ @client.unstar(123)
126
+ a_post("bookmarks/unstar").with(:body => {:bookmark_id => "123" }).
127
+ should have_been_made
128
+ end
129
+
130
+ it "should return an unstarred bookmark on success" do
131
+ bookmark = @client.unstar(123)
132
+ bookmark.should be_a Hashie::Rash
133
+ bookmark.type.should == 'bookmark'
134
+ bookmark.starred.should == '0'
135
+ end
136
+
137
+ it 'should be aliased as .unstar_bookmark' do
138
+ @client.unstar(123).should == @client.unstar_bookmark(123)
139
+ end
140
+ end
141
+
142
+ describe '.archive' do
143
+ before do
144
+ stub_post("bookmarks/archive").
145
+ to_return(:body => fixture("bookmarks_archive.json"), :headers => {:content_type => "application/json; charset=utf-8"})
146
+ end
147
+
148
+ it "should get the correct resource" do
149
+ @client.archive(123)
150
+ a_post("bookmarks/archive").with(:body => {:bookmark_id => "123" }).
151
+ should have_been_made
152
+ end
153
+
154
+ it "should return the bookmark on success" do
155
+ bookmark = @client.archive(123)
156
+ bookmark.should be_a Hashie::Rash
157
+ bookmark.type.should == 'bookmark'
158
+ end
159
+
160
+ it 'should be aliased as .archive_bookmark' do
161
+ @client.archive(123).should == @client.archive_bookmark(123)
162
+ end
163
+ end
164
+
165
+ describe '.unarchive' do
166
+ before do
167
+ stub_post("bookmarks/unarchive").
168
+ to_return(:body => fixture("bookmarks_unarchive.json"), :headers => {:content_type => "application/json; charset=utf-8"})
169
+ end
170
+
171
+ it "should get the correct resource" do
172
+ @client.unarchive(123)
173
+ a_post("bookmarks/unarchive").with(:body => {:bookmark_id => "123" }).
174
+ should have_been_made
175
+ end
176
+
177
+ it "should return the bookmark on success" do
178
+ bookmark = @client.unarchive(123)
179
+ bookmark.should be_a Hashie::Rash
180
+ bookmark.type.should == 'bookmark'
181
+ end
182
+
183
+ it 'should be aliased as .unarchive_bookmark' do
184
+ @client.unarchive(123).should == @client.unarchive_bookmark(123)
185
+ end
186
+ end
187
+
188
+ describe '.move' do
189
+ before do
190
+ stub_post("bookmarks/move").
191
+ to_return(:body => fixture("bookmarks_move.json"), :headers => {:content_type => "application/json; charset=utf-8"})
192
+ end
193
+
194
+ it "should get the correct resource" do
195
+ @client.move(123, 12345)
196
+ a_post("bookmarks/move").with(:body => {:bookmark_id => "123", :folder_id => "12345" }).
197
+ should have_been_made
198
+ end
199
+
200
+ it "should return the bookmark on success" do
201
+ bookmark = @client.move(123, 12345)
202
+ bookmark.should be_a Hashie::Rash
203
+ bookmark.type.should == 'bookmark'
204
+ end
205
+
206
+ it 'should be aliased as .move_bookmark' do
207
+ @client.move(123, 12345).should == @client.move_bookmark(123, 12345)
208
+ end
209
+ end
210
+
211
+ describe '.text' do
212
+ before do
213
+ stub_post("bookmarks/get_text").
214
+ to_return(:body => fixture("bookmarks_get_text.txt"), :headers => {:content_type => "text/html; charset=utf-8"})
215
+ end
216
+
217
+ it "should get the correct resource" do
218
+ @client.text(123)
219
+ a_post("bookmarks/get_text").with(:body => {:bookmark_id => "123" }).
220
+ should have_been_made
221
+ end
222
+
223
+ it "should return the bookmark's html on success" do
224
+ bookmark = @client.text(123)
225
+ bookmark.length.should > 0
226
+ bookmark.should include("Ideo's Axioms for Starting Disruptive New Businesses")
227
+ end
228
+
229
+ it 'should be aliased as .get_text' do
230
+ @client.text(123).should == @client.get_text(123)
231
+ end
232
+ end
233
+
234
+ end
@@ -0,0 +1,89 @@
1
+ require 'spec_helper'
2
+
3
+ describe Instapaper::Client::Folder do
4
+ before(:each) do
5
+ @client = Instapaper::Client.new
6
+ end
7
+
8
+ describe '.folders' do
9
+ before do
10
+ stub_post("folders/list").
11
+ to_return(:body => fixture("folders_list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
12
+ end
13
+
14
+ it "should get the correct resource" do
15
+ @client.folders
16
+ a_post("folders/list").
17
+ should have_been_made
18
+ end
19
+
20
+ it "should return an array containing folders on success" do
21
+ folders = @client.folders
22
+ folders.should be_an Array
23
+ folders.size.should == 2
24
+ folders.first.should be_a Hashie::Rash
25
+ folders.first['title'].should == 'Ruby'
26
+ end
27
+ end
28
+
29
+ describe '.add_folder' do
30
+ before do
31
+ stub_post("folders/add").with(:body => {:title => "Ruby" }).
32
+ to_return(:body => fixture("folders_add.json"), :headers => {:content_type => "application/json; charset=utf-8"})
33
+ end
34
+
35
+ it "should get the correct resource" do
36
+ @client.add_folder("Ruby")
37
+ a_post("folders/add").
38
+ should have_been_made
39
+ end
40
+
41
+ it "should return an array containing the new folder on success" do
42
+ folders = @client.add_folder("Ruby")
43
+ folders.should be_an Array
44
+ folders.should_not be_empty
45
+ folders.first.should be_a Hashie::Rash
46
+ folders.first['title'].should == 'Ruby'
47
+ end
48
+ end
49
+
50
+ describe '.delete_folder' do
51
+ before do
52
+ stub_post("folders/delete"). with(:body => {:folder_id => "1" }).
53
+ to_return(:body => fixture("folders_delete.json"), :headers => {:content_type => "application/json; charset=utf-8"})
54
+ end
55
+
56
+ it "should get the correct resource" do
57
+ @client.delete_folder("1")
58
+ a_post("folders/delete").
59
+ should have_been_made
60
+ end
61
+
62
+ it "should return an empty array on success" do
63
+ confirm = @client.delete_folder("1")
64
+ confirm.should be_an Array
65
+ confirm.should be_empty
66
+ end
67
+ end
68
+
69
+ describe '.set_order' do
70
+ before do
71
+ stub_post("folders/set_order"). with(:body => {:order => "1121173:2,1121174:1" }).
72
+ to_return(:body => fixture("folders_set_order.json"), :headers => {:content_type => "application/json; charset=utf-8"})
73
+ end
74
+
75
+ it "should get the correct resource" do
76
+ @client.set_order(['1121173:2','1121174:1'])
77
+ a_post("folders/set_order").
78
+ should have_been_made
79
+ end
80
+
81
+ it "should return an array reflecting the new order on success" do
82
+ folders = @client.set_order(['1121173:2','1121174:1'])
83
+ folders.should be_an Array
84
+ folders.first.should be_a Hashie::Rash
85
+ folders.first['position'].should == 1
86
+ end
87
+ end
88
+
89
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Instapaper::Client::User do
4
+ before(:each) do
5
+ @client = Instapaper::Client.new
6
+ end
7
+
8
+ describe '.access_token' do
9
+ before do
10
+ stub_post("oauth/access_token").with(:body => { :x_auth_username => 'ohai', :x_auth_password => 'p455w0rd', :x_auth_mode => 'client_auth'}).
11
+ to_return(:body => fixture("access_token.qline"), :headers => {:content_type => "text/plain; charset=utf-8"})
12
+ end
13
+
14
+ it "should get the correct resource" do
15
+ @client.access_token('ohai', 'p455w0rd')
16
+ a_post("oauth/access_token").
17
+ should have_been_made
18
+ end
19
+
20
+ it "should return the a hash containing an oauth token and secret" do
21
+ tokens = @client.access_token('ohai', 'p455w0rd')
22
+ tokens.should be_a Hash
23
+ tokens.key?('oauth_token').should be_true
24
+ tokens.key?('oauth_token_secret').should be_true
25
+ end
26
+ end
27
+
28
+ end
@@ -0,0 +1,65 @@
1
+ require 'spec_helper'
2
+
3
+ describe Instapaper::Client do
4
+
5
+ before do
6
+ @options = { :adapter => :em_synchrony, :user_agent => 'Instapaper::Client spec' }
7
+ @keys = Instapaper::Configuration::VALID_OPTIONS_KEYS
8
+ end
9
+
10
+ describe '.new' do
11
+ before(:each) do
12
+ @keys.each do |key|
13
+ Instapaper.send("#{key}=", key)
14
+ end
15
+ end
16
+
17
+ after do
18
+ Instapaper.reset
19
+ end
20
+
21
+ context 'with module configuration' do
22
+ it "should inherit module configuration" do
23
+ api = Instapaper::Client.new
24
+ @keys.each do |key|
25
+ api.send(key).should eq(key)
26
+ end
27
+ end
28
+ end
29
+
30
+ context 'with class configuration' do
31
+ context "during initialization" do
32
+ it "should override module configuration" do
33
+ api = Instapaper::Client.new(@options)
34
+ @keys.each do |key|
35
+ h = @options.has_key?(key) ? @options : Instapaper.options
36
+ api.send(key).should eq(h[key])
37
+ end
38
+ end
39
+ end
40
+
41
+ context "after initialization" do
42
+ it "should override module configuration after initialization" do
43
+ api = Instapaper::Client.new
44
+ @options.each do |key, value|
45
+ api.send("#{key}=", value)
46
+ end
47
+ @keys.each do |key|
48
+ h = @options.has_key?(key) ? @options : Instapaper.options
49
+ api.send(key).should eq(h[key])
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ describe '.endpoint_with_prefix' do
57
+ before(:each) do
58
+ @client = Instapaper::Client.new
59
+ end
60
+
61
+ it 'should return the ' do
62
+ @client.endpoint_with_prefix.should == Instapaper.endpoint + Instapaper.path_prefix
63
+ end
64
+ end
65
+ end