instapaper 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{PostInstall.txt → .gemtest} +0 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.simplecov +1 -0
- data/.yardopts +3 -0
- data/Gemfile +2 -0
- data/LICENSE.md +20 -0
- data/README.md +152 -0
- data/Rakefile +13 -4
- data/instapaper.gemspec +33 -0
- data/lib/faraday/response/raise_http_1xxx.rb +65 -0
- data/lib/instapaper.rb +26 -10
- data/lib/instapaper/authentication.rb +32 -0
- data/lib/instapaper/client.rb +43 -0
- data/lib/instapaper/client/account.rb +13 -0
- data/lib/instapaper/client/bookmark.rb +81 -0
- data/lib/instapaper/client/folder.rb +34 -0
- data/lib/instapaper/client/user.rb +14 -0
- data/lib/instapaper/configuration.rb +88 -0
- data/lib/instapaper/connection.rb +35 -0
- data/lib/instapaper/request.rb +22 -9
- data/lib/instapaper/version.rb +1 -31
- data/spec/faraday/response_spec.rb +22 -0
- data/spec/fixtures/access_token.qline +1 -0
- data/spec/fixtures/bookmarks_add.json +1 -0
- data/spec/fixtures/bookmarks_archive.json +1 -0
- data/spec/fixtures/bookmarks_get_text.txt +299 -0
- data/spec/fixtures/bookmarks_list.json +5 -0
- data/spec/fixtures/bookmarks_move.json +1 -0
- data/spec/fixtures/bookmarks_star.json +1 -0
- data/spec/fixtures/bookmarks_unarchive.json +1 -0
- data/spec/fixtures/bookmarks_unstar.json +1 -0
- data/spec/fixtures/bookmarks_update_read_progress.json +1 -0
- data/spec/fixtures/folders_add.json +1 -0
- data/spec/fixtures/folders_delete.json +1 -0
- data/spec/fixtures/folders_list.json +1 -0
- data/spec/fixtures/folders_set_order.json +1 -0
- data/spec/fixtures/verify_credentials.json +1 -0
- data/spec/instapaper/client/account_spec.rb +27 -0
- data/spec/instapaper/client/bookmark_spec.rb +234 -0
- data/spec/instapaper/client/folder_spec.rb +89 -0
- data/spec/instapaper/client/user_spec.rb +28 -0
- data/spec/instapaper/client_spec.rb +65 -0
- data/spec/instapaper_spec.rb +85 -0
- data/spec/spec_helper.rb +44 -0
- metadata +230 -99
- data/History.txt +0 -3
- data/Manifest.txt +0 -43
- data/README.rdoc +0 -73
- data/config/hoe.rb +0 -73
- data/config/requirements.rb +0 -15
- data/lib/instapaper/base.rb +0 -113
- data/lib/instapaper/constants.rb +0 -37
- data/lib/instapaper/exceptions.rb +0 -41
- data/lib/instapaper/protocol.rb +0 -47
- data/lib/instapaper/request/abstract_request.rb +0 -104
- data/lib/instapaper/request/add_url_request.rb +0 -68
- data/lib/instapaper/request/authentication_request.rb +0 -60
- data/lib/instapaper/request/request_error.rb +0 -34
- data/lib/instapaper/request/request_errors.rb +0 -41
- data/lib/instapaper/request/request_validation.rb +0 -34
- data/lib/instapaper/response.rb +0 -10
- data/lib/instapaper/response/abstract_response.rb +0 -38
- data/lib/instapaper/response/add_url_success_response.rb +0 -41
- data/lib/instapaper/response/authentication_invalid_response.rb +0 -40
- data/lib/instapaper/response/authentication_success_response.rb +0 -40
- data/lib/instapaper/response/bad_request_response.rb +0 -40
- data/lib/instapaper/response/response_builder.rb +0 -61
- data/lib/instapaper/response/service_error_response.rb +0 -40
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -82
- data/setup.rb +0 -1585
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/test/test_auth.rb +0 -62
- data/test/test_error.rb +0 -81
- data/test/test_helper.rb +0 -2
- data/test/test_instapaper.rb +0 -9
- data/test/test_request.rb +0 -45
- data/website/index.html +0 -99
- data/website/index.txt +0 -69
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.html.erb +0 -48
@@ -1,104 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
# An object describing an abstract API request
|
25
|
-
|
26
|
-
module Instapaper
|
27
|
-
|
28
|
-
module Request
|
29
|
-
|
30
|
-
# The class representing a generic request
|
31
|
-
class AbstractRequest
|
32
|
-
|
33
|
-
include Constants
|
34
|
-
include Exceptions
|
35
|
-
include Protocol
|
36
|
-
|
37
|
-
attr_reader :data
|
38
|
-
attr_reader :url
|
39
|
-
|
40
|
-
def initialize #:nodoc:
|
41
|
-
@validation_callbacks = Array.new
|
42
|
-
@validation_errors = RequestErrors.new
|
43
|
-
@data = Hash.new
|
44
|
-
@abstract = true
|
45
|
-
@protocol = PROTOCOLS[:secure]
|
46
|
-
@api = false
|
47
|
-
@validated = false
|
48
|
-
end
|
49
|
-
|
50
|
-
# Prepares the request
|
51
|
-
def prepare
|
52
|
-
build_url
|
53
|
-
end
|
54
|
-
|
55
|
-
# Return a hash of the data to be sent to the server
|
56
|
-
#
|
57
|
-
# Strict determines whether the method raises an exception
|
58
|
-
# or returns an error object
|
59
|
-
def post_data(strict = true)
|
60
|
-
|
61
|
-
return @data if @validated
|
62
|
-
|
63
|
-
raise AbstractRequestException.new if @abstract || !@api
|
64
|
-
|
65
|
-
@validation_callbacks.each do |callback|
|
66
|
-
unless send(callback.method,*callback.args)
|
67
|
-
|
68
|
-
if strict
|
69
|
-
raise InvalidRequestDetailsException.new(callback.message)
|
70
|
-
else
|
71
|
-
@validation_errors << RequestError.new(callback.message,callback.method)
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
if @validation_errors.valid?
|
78
|
-
@validated = true
|
79
|
-
@data
|
80
|
-
else
|
81
|
-
@validation_errors
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
|
86
|
-
private
|
87
|
-
|
88
|
-
def add_validation_callback(callback) #:nodoc:
|
89
|
-
@validation_callbacks << callback unless @validation_callbacks.include?(callback)
|
90
|
-
end
|
91
|
-
|
92
|
-
def build_url #:nodoc:
|
93
|
-
@url = [@protocol,"://",HOST,"/",API_BASE,"/",@api].join('')
|
94
|
-
end
|
95
|
-
|
96
|
-
def has_value(value) #:nodoc:
|
97
|
-
!(value.to_s.nil? || value.to_s.empty? || !value)
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
# The request object that deals with adding urls to Instapaper
|
25
|
-
|
26
|
-
module Instapaper
|
27
|
-
module Request
|
28
|
-
|
29
|
-
class AddURLRequest < AuthenticationRequest
|
30
|
-
|
31
|
-
include Constants
|
32
|
-
|
33
|
-
attr_reader :url
|
34
|
-
|
35
|
-
# Takes a hash of options (see Base#add_url)
|
36
|
-
# and authentication credentials
|
37
|
-
def initialize(opts, username, password = nil)
|
38
|
-
|
39
|
-
super(username,password)
|
40
|
-
|
41
|
-
raise InvalidRequestDetailsException.new unless opts.is_a?(Hash)
|
42
|
-
|
43
|
-
opts = opts.keys.inject({}) do |n,key|
|
44
|
-
n[key.to_s.gsub(/-/,'_').to_sym] = opts[key]
|
45
|
-
n
|
46
|
-
end
|
47
|
-
|
48
|
-
@data["url"] = opts[:url]
|
49
|
-
@data["title"] = opts[:title] if has_value(opts[:title])
|
50
|
-
@data["selection"] = opts[:selection] if has_value(opts[:selection])
|
51
|
-
@data["auto-title"] = opts[:auto_title] if has_value(opts[:auto_title])
|
52
|
-
@api = API_ADD
|
53
|
-
|
54
|
-
validation = RequestValidation.new(:validate_url,"You must provide a url!",[])
|
55
|
-
|
56
|
-
add_validation_callback(validation)
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def validate_url #:nodoc:
|
62
|
-
has_value(@data["url"])
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
# The first actual request that can be made
|
25
|
-
# Can be used to test the credentials or as the base for all other classes
|
26
|
-
|
27
|
-
module Instapaper
|
28
|
-
module Request
|
29
|
-
class AuthenticationRequest < AbstractRequest
|
30
|
-
|
31
|
-
include Constants
|
32
|
-
|
33
|
-
attr_reader :username, :password
|
34
|
-
|
35
|
-
# Use the provided credentials to authenticate against the Instapaper server
|
36
|
-
#
|
37
|
-
# The password is optional
|
38
|
-
def initialize(username, password = nil)
|
39
|
-
super()
|
40
|
-
|
41
|
-
@abstract = false
|
42
|
-
|
43
|
-
@data[:username] = username
|
44
|
-
@data[:password] = password if has_value(password)
|
45
|
-
@api = API_AUTH
|
46
|
-
|
47
|
-
validation = RequestValidation.new(:validate_auth,"You must provide a username!",[])
|
48
|
-
|
49
|
-
add_validation_callback(validation)
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
def validate_auth #:nodoc:
|
55
|
-
has_value(@data[:username])
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
# A wrapper for an error
|
25
|
-
|
26
|
-
module Instapaper
|
27
|
-
|
28
|
-
module Request
|
29
|
-
|
30
|
-
RequestError = Struct.new(:message,:type)
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
# A wrapper for errors
|
25
|
-
|
26
|
-
module Instapaper
|
27
|
-
|
28
|
-
module Request
|
29
|
-
|
30
|
-
class RequestErrors < Array
|
31
|
-
|
32
|
-
# Is the request valid?
|
33
|
-
def valid?
|
34
|
-
empty?
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
# A small struct containing validation info
|
25
|
-
|
26
|
-
module Instapaper
|
27
|
-
|
28
|
-
module Request
|
29
|
-
|
30
|
-
RequestValidation = Struct.new(:method,:message,:args)
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
data/lib/instapaper/response.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
-
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
-
|
4
|
-
require 'response/response_builder'
|
5
|
-
require 'response/abstract_response'
|
6
|
-
require 'response/add_url_success_response'
|
7
|
-
require 'response/authentication_success_response'
|
8
|
-
require 'response/authentication_invalid_response'
|
9
|
-
require 'response/bad_request_response'
|
10
|
-
require 'response/service_error_response'
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
module Instapaper
|
25
|
-
module Response
|
26
|
-
class AbstractResponse
|
27
|
-
|
28
|
-
attr_reader :request, :code, :message
|
29
|
-
|
30
|
-
def initialize(request) #:nodoc:
|
31
|
-
@request = request
|
32
|
-
@code = nil
|
33
|
-
@message = nil
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
module Instapaper
|
25
|
-
module Response
|
26
|
-
|
27
|
-
class AddURLSuccessResponse < AbstractResponse #:nodoc: all
|
28
|
-
|
29
|
-
def initialize(request)
|
30
|
-
super
|
31
|
-
|
32
|
-
@code = 201
|
33
|
-
@message = "URL Added Successfully"
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Douglas Willcocks
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person
|
4
|
-
# obtaining a copy of this software and associated documentation
|
5
|
-
# files (the "Software"), to deal in the Software without
|
6
|
-
# restriction, including without limitation the rights to use,
|
7
|
-
# copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
# copies of the Software, and to permit persons to whom the
|
9
|
-
# Software is furnished to do so, subject to the following
|
10
|
-
# conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be
|
13
|
-
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
# OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
|
24
|
-
module Instapaper
|
25
|
-
module Response
|
26
|
-
|
27
|
-
class AuthenticationInvalidResponse < AbstractResponse #:nodoc: all
|
28
|
-
|
29
|
-
def initialize(request)
|
30
|
-
super
|
31
|
-
|
32
|
-
@code = 403
|
33
|
-
@message = "Authentication Unsuccessful"
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|