jugyo-simplenote 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +6 -0
- data/.document +5 -0
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.rdoc +21 -0
- data/Rakefile +60 -0
- data/VERSION +1 -0
- data/lib/simplenote.rb +89 -0
- data/test/fixtures/create_note.yml +176 -0
- data/test/fixtures/delete_note_with_bad_key.yml +71 -0
- data/test/fixtures/get_index.yml +112 -0
- data/test/fixtures/get_note_with_bad_key.yml +73 -0
- data/test/fixtures/login_failure.yml +39 -0
- data/test/fixtures/search.yml +100 -0
- data/test/fixtures/update_note.yml +182 -0
- data/test/simplenote_test.rb +99 -0
- data/test/test_helper.rb +14 -0
- metadata +142 -0
data/.autotest
ADDED
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Simon Jefford
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
= jugyo-simplenote
|
2
|
+
|
3
|
+
A dead simple gem for accessing SimpleNote notes via its API
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Contributors
|
16
|
+
|
17
|
+
Aaron Peckham - create_note and awesome test coverage
|
18
|
+
|
19
|
+
== Copyright
|
20
|
+
|
21
|
+
Copyright (c) 2009 Simon Jefford. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "jugyo-simplenote"
|
8
|
+
gem.summary = %Q{Simple wrapper for the SimpleNote HTTP API}
|
9
|
+
gem.description = %Q{Uses HTTParty to present a nice Ruby wrapper for SimpleNote}
|
10
|
+
gem.email = "simon.jefford@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/simonjefford/simplenote"
|
12
|
+
gem.authors = ["Simon Jefford"]
|
13
|
+
gem.add_development_dependency "shoulda"
|
14
|
+
gem.add_development_dependency "fakeweb"
|
15
|
+
gem.add_development_dependency "vcr"
|
16
|
+
gem.add_runtime_dependency "httparty", "=0.6.0"
|
17
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
+
end
|
19
|
+
Jeweler::GemcutterTasks.new
|
20
|
+
rescue LoadError
|
21
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
Rake::TestTask.new(:test) do |test|
|
26
|
+
test.libs << 'test'
|
27
|
+
test.pattern = 'test/**/*_test.rb'
|
28
|
+
test.verbose = true
|
29
|
+
end
|
30
|
+
|
31
|
+
begin
|
32
|
+
require 'rcov/rcovtask'
|
33
|
+
Rcov::RcovTask.new do |test|
|
34
|
+
test.libs << 'test'
|
35
|
+
test.pattern = 'test/**/*_test.rb'
|
36
|
+
test.verbose = true
|
37
|
+
end
|
38
|
+
rescue LoadError
|
39
|
+
task :rcov do
|
40
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
task :test => :check_dependencies
|
45
|
+
|
46
|
+
task :default => :test
|
47
|
+
|
48
|
+
require 'rake/rdoctask'
|
49
|
+
Rake::RDocTask.new do |rdoc|
|
50
|
+
if File.exist?('VERSION')
|
51
|
+
version = File.read('VERSION')
|
52
|
+
else
|
53
|
+
version = ""
|
54
|
+
end
|
55
|
+
|
56
|
+
rdoc.rdoc_dir = 'rdoc'
|
57
|
+
rdoc.title = "simplenote #{version}"
|
58
|
+
rdoc.rdoc_files.include('README*')
|
59
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
60
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/lib/simplenote.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'base64'
|
3
|
+
require 'crack'
|
4
|
+
|
5
|
+
class SimpleNote
|
6
|
+
include HTTParty
|
7
|
+
attr_reader :token, :email
|
8
|
+
format :json
|
9
|
+
base_uri 'https://simple-note.appspot.com/api'
|
10
|
+
|
11
|
+
def self.jsonize(method)
|
12
|
+
class_eval do
|
13
|
+
alias_method "_#{method}", method
|
14
|
+
define_method(method) do |*args|
|
15
|
+
Crack::JSON.parse self.send("_#{method}", *args).body
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.textize(method)
|
21
|
+
class_eval do
|
22
|
+
alias_method "_#{method}", method
|
23
|
+
define_method(method) do |*args|
|
24
|
+
self.send("_#{method}", *args).body
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(*args)
|
30
|
+
self.login(*args)
|
31
|
+
end
|
32
|
+
|
33
|
+
def login(email, password)
|
34
|
+
encoded_body = Base64.encode64({:email => email, :password => password}.to_params)
|
35
|
+
@email = email
|
36
|
+
@token = self.class.post "/login", :body => encoded_body
|
37
|
+
raise "Login failed" unless @token.response.is_a?(Net::HTTPOK)
|
38
|
+
end
|
39
|
+
|
40
|
+
def get_index
|
41
|
+
self.class.get "/index", :query => request_hash, :format => :json
|
42
|
+
end
|
43
|
+
jsonize :get_index
|
44
|
+
|
45
|
+
def get_note(key)
|
46
|
+
out = self.class.get "/note", :query => request_hash.merge(:key => key), :format => :plain
|
47
|
+
out.response.is_a?(Net::HTTPNotFound) ? nil : out
|
48
|
+
end
|
49
|
+
textize :get_note
|
50
|
+
|
51
|
+
def delete_note(key)
|
52
|
+
out = self.class.get "/delete", :query => request_hash.merge(:key => key)
|
53
|
+
raise "Couldn't delete note" unless out.response.is_a?(Net::HTTPOK)
|
54
|
+
out
|
55
|
+
end
|
56
|
+
jsonize :delete_note
|
57
|
+
|
58
|
+
def update_note(key, content)
|
59
|
+
self.class.post "/note", :query => request_hash.merge(:key => key), :body => Base64.encode64(content)
|
60
|
+
end
|
61
|
+
jsonize :update_note
|
62
|
+
|
63
|
+
def create_note(content)
|
64
|
+
self.class.post "/note", :query => request_hash, :body => Base64.encode64(content)
|
65
|
+
end
|
66
|
+
jsonize :create_note
|
67
|
+
|
68
|
+
def search(search_string, max_results=10)
|
69
|
+
self.class.get "/search", :query => request_hash.merge(:query => search_string, :results => max_results)
|
70
|
+
end
|
71
|
+
jsonize :search
|
72
|
+
|
73
|
+
def keys
|
74
|
+
get_index.map do |i|
|
75
|
+
i["key"]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
alias_method :[], :get_note
|
80
|
+
alias_method :delete, :delete_note
|
81
|
+
alias_method :[]=, :update_note
|
82
|
+
alias_method :<<, :create_note
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def request_hash
|
87
|
+
{ :auth => token, :email => email }
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://simple-note.appspot.com:443/api/login
|
6
|
+
body: |
|
7
|
+
cGFzc3dvcmQ9cGFzc3dvcmQhJmVtYWlsPXNpbXBsZW5vdGV0ZXN0JTQwbWFp
|
8
|
+
bGluYXRvci5jb20=
|
9
|
+
|
10
|
+
headers:
|
11
|
+
connection:
|
12
|
+
- close
|
13
|
+
content-type:
|
14
|
+
- application/x-www-form-urlencoded
|
15
|
+
content-length:
|
16
|
+
- "78"
|
17
|
+
host:
|
18
|
+
- simple-note.appspot.com
|
19
|
+
response: !ruby/struct:VCR::Response
|
20
|
+
status: !ruby/struct:VCR::ResponseStatus
|
21
|
+
code: 200
|
22
|
+
message: OK
|
23
|
+
headers:
|
24
|
+
expires:
|
25
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
26
|
+
content-type:
|
27
|
+
- text/html; charset=utf-8
|
28
|
+
connection:
|
29
|
+
- close
|
30
|
+
date:
|
31
|
+
- Sat, 03 Jul 2010 23:21:15 GMT
|
32
|
+
server:
|
33
|
+
- Google Frontend
|
34
|
+
account-type:
|
35
|
+
- "000"
|
36
|
+
set-cookie:
|
37
|
+
- auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6; expires=Sat, 17-Jul-2010 23:21:15 GMT
|
38
|
+
- email=simplenotetest@mailinator.com; expires=Sat, 17-Jul-2010 23:21:15 GMT
|
39
|
+
cache-control:
|
40
|
+
- no-cache
|
41
|
+
body: 2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
42
|
+
http_version: "1.1"
|
43
|
+
- !ruby/struct:VCR::HTTPInteraction
|
44
|
+
request: !ruby/struct:VCR::Request
|
45
|
+
method: :post
|
46
|
+
uri: https://simple-note.appspot.com:443/api/note?email=simplenotetest%40mailinator.com&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
47
|
+
body: |
|
48
|
+
QSB0ZXN0IG5vdGU=
|
49
|
+
|
50
|
+
headers:
|
51
|
+
connection:
|
52
|
+
- close
|
53
|
+
content-type:
|
54
|
+
- application/x-www-form-urlencoded
|
55
|
+
content-length:
|
56
|
+
- "17"
|
57
|
+
host:
|
58
|
+
- simple-note.appspot.com
|
59
|
+
response: !ruby/struct:VCR::Response
|
60
|
+
status: !ruby/struct:VCR::ResponseStatus
|
61
|
+
code: 200
|
62
|
+
message: OK
|
63
|
+
headers:
|
64
|
+
expires:
|
65
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
66
|
+
content-type:
|
67
|
+
- text/html; charset=utf-8
|
68
|
+
connection:
|
69
|
+
- close
|
70
|
+
date:
|
71
|
+
- Sat, 03 Jul 2010 23:21:16 GMT
|
72
|
+
server:
|
73
|
+
- Google Frontend
|
74
|
+
cache-control:
|
75
|
+
- no-cache
|
76
|
+
body: agtzaW1wbGUtbm90ZXINCxIETm90ZRjFkrsCDA
|
77
|
+
http_version: "1.1"
|
78
|
+
- !ruby/struct:VCR::HTTPInteraction
|
79
|
+
request: !ruby/struct:VCR::Request
|
80
|
+
method: :get
|
81
|
+
uri: https://simple-note.appspot.com:443/api/index?email=simplenotetest%40mailinator.com&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
82
|
+
body:
|
83
|
+
headers:
|
84
|
+
connection:
|
85
|
+
- close
|
86
|
+
host:
|
87
|
+
- simple-note.appspot.com
|
88
|
+
response: !ruby/struct:VCR::Response
|
89
|
+
status: !ruby/struct:VCR::ResponseStatus
|
90
|
+
code: 200
|
91
|
+
message: OK
|
92
|
+
headers:
|
93
|
+
expires:
|
94
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
95
|
+
content-type:
|
96
|
+
- text/html; charset=utf-8
|
97
|
+
connection:
|
98
|
+
- close
|
99
|
+
date:
|
100
|
+
- Sat, 03 Jul 2010 23:21:16 GMT
|
101
|
+
server:
|
102
|
+
- Google Frontend
|
103
|
+
cache-control:
|
104
|
+
- no-cache
|
105
|
+
body: "[{\"deleted\": false, \"modify\": \"2010-07-03 23:21:16.233127\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRjFkrsCDA\"}, {\"deleted\": true, \"modify\": \"2010-07-03 23:20:54.516094\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRiy4rgCDA\"}, {\"deleted\": true, \"modify\": \"2010-07-03 23:20:28.660330\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRjvlLgCDA\"}, {\"deleted\": true, \"modify\": \"2010-07-03 23:19:57.167038\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRjYu7gCDA\"}, {\"deleted\": true, \"modify\": \"2010-07-03 23:19:39.575275\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRjwx7kCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 23:19:18.637359\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRj9oLkCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 23:17:16.238075\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRje27oCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 23:17:06.317652\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRjhv7kCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 23:15:43.961084\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRighbgCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 23:15:23.937139\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRiOv7cCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 23:14:46.996127\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRiyibkCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 23:14:12.942223\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRjuo7gCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 23:14:01.105683\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRjto7gCDA\"}, {\"deleted\": false, \"modify\": \"2010-07-03 22:41:13.721231\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRiD1LoCDA\"}]"
|
106
|
+
http_version: "1.1"
|
107
|
+
- !ruby/struct:VCR::HTTPInteraction
|
108
|
+
request: !ruby/struct:VCR::Request
|
109
|
+
method: :get
|
110
|
+
uri: https://simple-note.appspot.com:443/api/note?email=simplenotetest%40mailinator.com&key=agtzaW1wbGUtbm90ZXINCxIETm90ZRjFkrsCDA&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
111
|
+
body:
|
112
|
+
headers:
|
113
|
+
connection:
|
114
|
+
- close
|
115
|
+
host:
|
116
|
+
- simple-note.appspot.com
|
117
|
+
response: !ruby/struct:VCR::Response
|
118
|
+
status: !ruby/struct:VCR::ResponseStatus
|
119
|
+
code: 200
|
120
|
+
message: OK
|
121
|
+
headers:
|
122
|
+
note-screatedate:
|
123
|
+
- "1278199276.233131"
|
124
|
+
note-smodifydate:
|
125
|
+
- "1278199276.233127"
|
126
|
+
expires:
|
127
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
128
|
+
content-type:
|
129
|
+
- text/html; charset=utf-8
|
130
|
+
note-modifydate:
|
131
|
+
- 2010-07-03 23:21:16.233127
|
132
|
+
connection:
|
133
|
+
- close
|
134
|
+
note-key:
|
135
|
+
- agtzaW1wbGUtbm90ZXINCxIETm90ZRjFkrsCDA
|
136
|
+
date:
|
137
|
+
- Sat, 03 Jul 2010 23:21:17 GMT
|
138
|
+
server:
|
139
|
+
- Google Frontend
|
140
|
+
note-createdate:
|
141
|
+
- 2010-07-03 23:21:16.233131
|
142
|
+
note-deleted:
|
143
|
+
- "False"
|
144
|
+
cache-control:
|
145
|
+
- no-cache
|
146
|
+
body: A test note
|
147
|
+
http_version: "1.1"
|
148
|
+
- !ruby/struct:VCR::HTTPInteraction
|
149
|
+
request: !ruby/struct:VCR::Request
|
150
|
+
method: :get
|
151
|
+
uri: https://simple-note.appspot.com:443/api/delete?email=simplenotetest%40mailinator.com&key=agtzaW1wbGUtbm90ZXINCxIETm90ZRjFkrsCDA&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
152
|
+
body:
|
153
|
+
headers:
|
154
|
+
connection:
|
155
|
+
- close
|
156
|
+
host:
|
157
|
+
- simple-note.appspot.com
|
158
|
+
response: !ruby/struct:VCR::Response
|
159
|
+
status: !ruby/struct:VCR::ResponseStatus
|
160
|
+
code: 200
|
161
|
+
message: OK
|
162
|
+
headers:
|
163
|
+
expires:
|
164
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
165
|
+
content-type:
|
166
|
+
- text/html; charset=utf-8
|
167
|
+
connection:
|
168
|
+
- close
|
169
|
+
date:
|
170
|
+
- Sat, 03 Jul 2010 23:21:17 GMT
|
171
|
+
server:
|
172
|
+
- Google Frontend
|
173
|
+
cache-control:
|
174
|
+
- no-cache
|
175
|
+
body: agtzaW1wbGUtbm90ZXINCxIETm90ZRjFkrsCDA
|
176
|
+
http_version: "1.1"
|
@@ -0,0 +1,71 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://simple-note.appspot.com:443/api/login
|
6
|
+
body: |
|
7
|
+
cGFzc3dvcmQ9cGFzc3dvcmQhJmVtYWlsPXNpbXBsZW5vdGV0ZXN0JTQwbWFp
|
8
|
+
bGluYXRvci5jb20=
|
9
|
+
|
10
|
+
headers:
|
11
|
+
connection:
|
12
|
+
- close
|
13
|
+
content-type:
|
14
|
+
- application/x-www-form-urlencoded
|
15
|
+
content-length:
|
16
|
+
- "78"
|
17
|
+
host:
|
18
|
+
- simple-note.appspot.com
|
19
|
+
response: !ruby/struct:VCR::Response
|
20
|
+
status: !ruby/struct:VCR::ResponseStatus
|
21
|
+
code: 200
|
22
|
+
message: OK
|
23
|
+
headers:
|
24
|
+
expires:
|
25
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
26
|
+
content-type:
|
27
|
+
- text/html; charset=utf-8
|
28
|
+
connection:
|
29
|
+
- close
|
30
|
+
date:
|
31
|
+
- Sat, 03 Jul 2010 23:25:36 GMT
|
32
|
+
server:
|
33
|
+
- Google Frontend
|
34
|
+
account-type:
|
35
|
+
- "000"
|
36
|
+
set-cookie:
|
37
|
+
- auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6; expires=Sat, 17-Jul-2010 23:25:36 GMT
|
38
|
+
- email=simplenotetest@mailinator.com; expires=Sat, 17-Jul-2010 23:25:36 GMT
|
39
|
+
cache-control:
|
40
|
+
- no-cache
|
41
|
+
body: 2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
42
|
+
http_version: "1.1"
|
43
|
+
- !ruby/struct:VCR::HTTPInteraction
|
44
|
+
request: !ruby/struct:VCR::Request
|
45
|
+
method: :get
|
46
|
+
uri: https://simple-note.appspot.com:443/api/delete?email=simplenotetest%40mailinator.com&key=key%20that%20doesn't%20exist&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
47
|
+
body:
|
48
|
+
headers:
|
49
|
+
connection:
|
50
|
+
- close
|
51
|
+
host:
|
52
|
+
- simple-note.appspot.com
|
53
|
+
response: !ruby/struct:VCR::Response
|
54
|
+
status: !ruby/struct:VCR::ResponseStatus
|
55
|
+
code: 404
|
56
|
+
message: Not Found
|
57
|
+
headers:
|
58
|
+
expires:
|
59
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
60
|
+
content-type:
|
61
|
+
- text/html; charset=utf-8
|
62
|
+
connection:
|
63
|
+
- close
|
64
|
+
date:
|
65
|
+
- Sat, 03 Jul 2010 23:25:36 GMT
|
66
|
+
server:
|
67
|
+
- Google Frontend
|
68
|
+
cache-control:
|
69
|
+
- no-cache
|
70
|
+
body: "0"
|
71
|
+
http_version: "1.1"
|
@@ -0,0 +1,112 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://simple-note.appspot.com:443/api/login
|
6
|
+
body: |
|
7
|
+
cGFzc3dvcmQ9cGFzc3dvcmQhJmVtYWlsPXNpbXBsZW5vdGV0ZXN0JTQwbWFp
|
8
|
+
bGluYXRvci5jb20=
|
9
|
+
|
10
|
+
headers:
|
11
|
+
connection:
|
12
|
+
- close
|
13
|
+
content-type:
|
14
|
+
- application/x-www-form-urlencoded
|
15
|
+
content-length:
|
16
|
+
- "78"
|
17
|
+
host:
|
18
|
+
- simple-note.appspot.com
|
19
|
+
response: !ruby/struct:VCR::Response
|
20
|
+
status: !ruby/struct:VCR::ResponseStatus
|
21
|
+
code: 200
|
22
|
+
message: OK
|
23
|
+
headers:
|
24
|
+
expires:
|
25
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
26
|
+
content-type:
|
27
|
+
- text/html; charset=utf-8
|
28
|
+
connection:
|
29
|
+
- close
|
30
|
+
date:
|
31
|
+
- Sat, 03 Jul 2010 22:51:55 GMT
|
32
|
+
server:
|
33
|
+
- Google Frontend
|
34
|
+
account-type:
|
35
|
+
- "000"
|
36
|
+
set-cookie:
|
37
|
+
- auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6; expires=Sat, 17-Jul-2010 22:51:55 GMT
|
38
|
+
- email=simplenotetest@mailinator.com; expires=Sat, 17-Jul-2010 22:51:55 GMT
|
39
|
+
cache-control:
|
40
|
+
- no-cache
|
41
|
+
body: 2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
42
|
+
http_version: "1.1"
|
43
|
+
- !ruby/struct:VCR::HTTPInteraction
|
44
|
+
request: !ruby/struct:VCR::Request
|
45
|
+
method: :get
|
46
|
+
uri: https://simple-note.appspot.com:443/api/index?auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6&email=simplenotetest%40mailinator.com
|
47
|
+
body:
|
48
|
+
headers:
|
49
|
+
connection:
|
50
|
+
- close
|
51
|
+
host:
|
52
|
+
- simple-note.appspot.com
|
53
|
+
response: !ruby/struct:VCR::Response
|
54
|
+
status: !ruby/struct:VCR::ResponseStatus
|
55
|
+
code: 200
|
56
|
+
message: OK
|
57
|
+
headers:
|
58
|
+
expires:
|
59
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
60
|
+
content-type:
|
61
|
+
- text/html; charset=utf-8
|
62
|
+
connection:
|
63
|
+
- close
|
64
|
+
date:
|
65
|
+
- Sat, 03 Jul 2010 22:51:56 GMT
|
66
|
+
server:
|
67
|
+
- Google Frontend
|
68
|
+
cache-control:
|
69
|
+
- no-cache
|
70
|
+
body: "[{\"deleted\": false, \"modify\": \"2010-07-03 22:41:13.721231\", \"key\": \"agtzaW1wbGUtbm90ZXINCxIETm90ZRiD1LoCDA\"}]"
|
71
|
+
http_version: "1.1"
|
72
|
+
- !ruby/struct:VCR::HTTPInteraction
|
73
|
+
request: !ruby/struct:VCR::Request
|
74
|
+
method: :get
|
75
|
+
uri: https://simple-note.appspot.com:443/api/note?auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6&key=agtzaW1wbGUtbm90ZXINCxIETm90ZRiD1LoCDA&email=simplenotetest%40mailinator.com
|
76
|
+
body:
|
77
|
+
headers:
|
78
|
+
connection:
|
79
|
+
- close
|
80
|
+
host:
|
81
|
+
- simple-note.appspot.com
|
82
|
+
response: !ruby/struct:VCR::Response
|
83
|
+
status: !ruby/struct:VCR::ResponseStatus
|
84
|
+
code: 200
|
85
|
+
message: OK
|
86
|
+
headers:
|
87
|
+
note-screatedate:
|
88
|
+
- "1278196867.833135"
|
89
|
+
note-smodifydate:
|
90
|
+
- "1278196873.721231"
|
91
|
+
expires:
|
92
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
93
|
+
content-type:
|
94
|
+
- text/html; charset=utf-8
|
95
|
+
note-modifydate:
|
96
|
+
- 2010-07-03 22:41:13.721231
|
97
|
+
connection:
|
98
|
+
- close
|
99
|
+
note-key:
|
100
|
+
- agtzaW1wbGUtbm90ZXINCxIETm90ZRiD1LoCDA
|
101
|
+
date:
|
102
|
+
- Sat, 03 Jul 2010 22:51:57 GMT
|
103
|
+
server:
|
104
|
+
- Google Frontend
|
105
|
+
note-createdate:
|
106
|
+
- 2010-07-03 22:41:07.833135
|
107
|
+
note-deleted:
|
108
|
+
- "False"
|
109
|
+
cache-control:
|
110
|
+
- no-cache
|
111
|
+
body: hello world this is a new note
|
112
|
+
http_version: "1.1"
|
@@ -0,0 +1,73 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://simple-note.appspot.com:443/api/login
|
6
|
+
body: |
|
7
|
+
cGFzc3dvcmQ9cGFzc3dvcmQhJmVtYWlsPXNpbXBsZW5vdGV0ZXN0JTQwbWFp
|
8
|
+
bGluYXRvci5jb20=
|
9
|
+
|
10
|
+
headers:
|
11
|
+
connection:
|
12
|
+
- close
|
13
|
+
content-type:
|
14
|
+
- application/x-www-form-urlencoded
|
15
|
+
content-length:
|
16
|
+
- "78"
|
17
|
+
host:
|
18
|
+
- simple-note.appspot.com
|
19
|
+
response: !ruby/struct:VCR::Response
|
20
|
+
status: !ruby/struct:VCR::ResponseStatus
|
21
|
+
code: 200
|
22
|
+
message: OK
|
23
|
+
headers:
|
24
|
+
expires:
|
25
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
26
|
+
content-type:
|
27
|
+
- text/html; charset=utf-8
|
28
|
+
connection:
|
29
|
+
- close
|
30
|
+
date:
|
31
|
+
- Sat, 03 Jul 2010 23:23:55 GMT
|
32
|
+
server:
|
33
|
+
- Google Frontend
|
34
|
+
account-type:
|
35
|
+
- "000"
|
36
|
+
set-cookie:
|
37
|
+
- auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6; expires=Sat, 17-Jul-2010 23:23:55 GMT
|
38
|
+
- email=simplenotetest@mailinator.com; expires=Sat, 17-Jul-2010 23:23:55 GMT
|
39
|
+
cache-control:
|
40
|
+
- no-cache
|
41
|
+
body: 2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
42
|
+
http_version: "1.1"
|
43
|
+
- !ruby/struct:VCR::HTTPInteraction
|
44
|
+
request: !ruby/struct:VCR::Request
|
45
|
+
method: :get
|
46
|
+
uri: https://simple-note.appspot.com:443/api/note?email=simplenotetest%40mailinator.com&key=key%20that%20doesn't%20exist&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
47
|
+
body:
|
48
|
+
headers:
|
49
|
+
connection:
|
50
|
+
- close
|
51
|
+
host:
|
52
|
+
- simple-note.appspot.com
|
53
|
+
response: !ruby/struct:VCR::Response
|
54
|
+
status: !ruby/struct:VCR::ResponseStatus
|
55
|
+
code: 404
|
56
|
+
message: Not Found
|
57
|
+
headers:
|
58
|
+
expires:
|
59
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
60
|
+
content-type:
|
61
|
+
- text/html; charset=utf-8
|
62
|
+
connection:
|
63
|
+
- close
|
64
|
+
date:
|
65
|
+
- Sat, 03 Jul 2010 23:23:55 GMT
|
66
|
+
server:
|
67
|
+
- Google Frontend
|
68
|
+
content-length:
|
69
|
+
- "0"
|
70
|
+
cache-control:
|
71
|
+
- no-cache
|
72
|
+
body: ""
|
73
|
+
http_version: "1.1"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://simple-note.appspot.com:443/api/login
|
6
|
+
body: |
|
7
|
+
ZW1haWw9c2ltcGxlbm90ZXRlc3QlNDBtYWlsaW5hdG9yLmNvbSZwYXNzd29y
|
8
|
+
ZD1ub3QlMjBteSUyMHBhc3N3b3JkIQ==
|
9
|
+
|
10
|
+
headers:
|
11
|
+
connection:
|
12
|
+
- close
|
13
|
+
content-type:
|
14
|
+
- application/x-www-form-urlencoded
|
15
|
+
content-length:
|
16
|
+
- "94"
|
17
|
+
host:
|
18
|
+
- simple-note.appspot.com
|
19
|
+
response: !ruby/struct:VCR::Response
|
20
|
+
status: !ruby/struct:VCR::ResponseStatus
|
21
|
+
code: 400
|
22
|
+
message: Bad Request
|
23
|
+
headers:
|
24
|
+
expires:
|
25
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
26
|
+
content-type:
|
27
|
+
- text/html; charset=utf-8
|
28
|
+
connection:
|
29
|
+
- close
|
30
|
+
date:
|
31
|
+
- Sat, 03 Jul 2010 23:05:14 GMT
|
32
|
+
server:
|
33
|
+
- Google Frontend
|
34
|
+
content-length:
|
35
|
+
- "0"
|
36
|
+
cache-control:
|
37
|
+
- no-cache
|
38
|
+
body: ""
|
39
|
+
http_version: "1.1"
|
@@ -0,0 +1,100 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://simple-note.appspot.com:443/api/login
|
6
|
+
body: |
|
7
|
+
cGFzc3dvcmQ9cGFzc3dvcmQhJmVtYWlsPXNpbXBsZW5vdGV0ZXN0JTQwbWFp
|
8
|
+
bGluYXRvci5jb20=
|
9
|
+
|
10
|
+
headers:
|
11
|
+
connection:
|
12
|
+
- close
|
13
|
+
content-type:
|
14
|
+
- application/x-www-form-urlencoded
|
15
|
+
content-length:
|
16
|
+
- "78"
|
17
|
+
host:
|
18
|
+
- simple-note.appspot.com
|
19
|
+
response: !ruby/struct:VCR::Response
|
20
|
+
status: !ruby/struct:VCR::ResponseStatus
|
21
|
+
code: 200
|
22
|
+
message: OK
|
23
|
+
headers:
|
24
|
+
expires:
|
25
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
26
|
+
content-type:
|
27
|
+
- text/html; charset=utf-8
|
28
|
+
connection:
|
29
|
+
- close
|
30
|
+
date:
|
31
|
+
- Sat, 03 Jul 2010 22:59:23 GMT
|
32
|
+
server:
|
33
|
+
- Google Frontend
|
34
|
+
account-type:
|
35
|
+
- "000"
|
36
|
+
set-cookie:
|
37
|
+
- auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6; expires=Sat, 17-Jul-2010 22:59:23 GMT
|
38
|
+
- email=simplenotetest@mailinator.com; expires=Sat, 17-Jul-2010 22:59:23 GMT
|
39
|
+
cache-control:
|
40
|
+
- no-cache
|
41
|
+
body: 2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
42
|
+
http_version: "1.1"
|
43
|
+
- !ruby/struct:VCR::HTTPInteraction
|
44
|
+
request: !ruby/struct:VCR::Request
|
45
|
+
method: :get
|
46
|
+
uri: https://simple-note.appspot.com:443/api/search?query=hello&results=10&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6&email=simplenotetest%40mailinator.com
|
47
|
+
body:
|
48
|
+
headers:
|
49
|
+
connection:
|
50
|
+
- close
|
51
|
+
host:
|
52
|
+
- simple-note.appspot.com
|
53
|
+
response: !ruby/struct:VCR::Response
|
54
|
+
status: !ruby/struct:VCR::ResponseStatus
|
55
|
+
code: 200
|
56
|
+
message: OK
|
57
|
+
headers:
|
58
|
+
expires:
|
59
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
60
|
+
content-type:
|
61
|
+
- text/html; charset=utf-8
|
62
|
+
connection:
|
63
|
+
- close
|
64
|
+
date:
|
65
|
+
- Sat, 03 Jul 2010 22:59:24 GMT
|
66
|
+
server:
|
67
|
+
- Google Frontend
|
68
|
+
cache-control:
|
69
|
+
- no-cache
|
70
|
+
body: "{\"Response\":{\"totalRecords\":1,\"Results\":[{\"content\":\"hello world this is a new note\",\"key\":\"agtzaW1wbGUtbm90ZXINCxIETm90ZRiD1LoCDA\"}]}}"
|
71
|
+
http_version: "1.1"
|
72
|
+
- !ruby/struct:VCR::HTTPInteraction
|
73
|
+
request: !ruby/struct:VCR::Request
|
74
|
+
method: :get
|
75
|
+
uri: https://simple-note.appspot.com:443/api/search?query=goodbye&results=10&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6&email=simplenotetest%40mailinator.com
|
76
|
+
body:
|
77
|
+
headers:
|
78
|
+
connection:
|
79
|
+
- close
|
80
|
+
host:
|
81
|
+
- simple-note.appspot.com
|
82
|
+
response: !ruby/struct:VCR::Response
|
83
|
+
status: !ruby/struct:VCR::ResponseStatus
|
84
|
+
code: 200
|
85
|
+
message: OK
|
86
|
+
headers:
|
87
|
+
expires:
|
88
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
89
|
+
content-type:
|
90
|
+
- text/html; charset=utf-8
|
91
|
+
connection:
|
92
|
+
- close
|
93
|
+
date:
|
94
|
+
- Sat, 03 Jul 2010 22:59:24 GMT
|
95
|
+
server:
|
96
|
+
- Google Frontend
|
97
|
+
cache-control:
|
98
|
+
- no-cache
|
99
|
+
body: "{\"Response\":{\"totalRecords\":0,\"Results\":[]}}"
|
100
|
+
http_version: "1.1"
|
@@ -0,0 +1,182 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://simple-note.appspot.com:443/api/login
|
6
|
+
body: |
|
7
|
+
cGFzc3dvcmQ9cGFzc3dvcmQhJmVtYWlsPXNpbXBsZW5vdGV0ZXN0JTQwbWFp
|
8
|
+
bGluYXRvci5jb20=
|
9
|
+
|
10
|
+
headers:
|
11
|
+
connection:
|
12
|
+
- close
|
13
|
+
content-type:
|
14
|
+
- application/x-www-form-urlencoded
|
15
|
+
content-length:
|
16
|
+
- "78"
|
17
|
+
host:
|
18
|
+
- simple-note.appspot.com
|
19
|
+
response: !ruby/struct:VCR::Response
|
20
|
+
status: !ruby/struct:VCR::ResponseStatus
|
21
|
+
code: 200
|
22
|
+
message: OK
|
23
|
+
headers:
|
24
|
+
expires:
|
25
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
26
|
+
content-type:
|
27
|
+
- text/html; charset=utf-8
|
28
|
+
connection:
|
29
|
+
- close
|
30
|
+
date:
|
31
|
+
- Sat, 03 Jul 2010 23:46:10 GMT
|
32
|
+
server:
|
33
|
+
- Google Frontend
|
34
|
+
account-type:
|
35
|
+
- "000"
|
36
|
+
set-cookie:
|
37
|
+
- auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6; expires=Sat, 17-Jul-2010 23:46:09 GMT
|
38
|
+
- email=simplenotetest@mailinator.com; expires=Sat, 17-Jul-2010 23:46:09 GMT
|
39
|
+
cache-control:
|
40
|
+
- no-cache
|
41
|
+
body: 2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
42
|
+
http_version: "1.1"
|
43
|
+
- !ruby/struct:VCR::HTTPInteraction
|
44
|
+
request: !ruby/struct:VCR::Request
|
45
|
+
method: :post
|
46
|
+
uri: https://simple-note.appspot.com:443/api/note?email=simplenotetest%40mailinator.com&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
47
|
+
body: |
|
48
|
+
QSB0ZXN0IG5vdGU=
|
49
|
+
|
50
|
+
headers:
|
51
|
+
connection:
|
52
|
+
- close
|
53
|
+
content-type:
|
54
|
+
- application/x-www-form-urlencoded
|
55
|
+
content-length:
|
56
|
+
- "17"
|
57
|
+
host:
|
58
|
+
- simple-note.appspot.com
|
59
|
+
response: !ruby/struct:VCR::Response
|
60
|
+
status: !ruby/struct:VCR::ResponseStatus
|
61
|
+
code: 200
|
62
|
+
message: OK
|
63
|
+
headers:
|
64
|
+
expires:
|
65
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
66
|
+
content-type:
|
67
|
+
- text/html; charset=utf-8
|
68
|
+
connection:
|
69
|
+
- close
|
70
|
+
date:
|
71
|
+
- Sat, 03 Jul 2010 23:46:11 GMT
|
72
|
+
server:
|
73
|
+
- Google Frontend
|
74
|
+
cache-control:
|
75
|
+
- no-cache
|
76
|
+
body: agtzaW1wbGUtbm90ZXINCxIETm90ZRjq37sCDA
|
77
|
+
http_version: "1.1"
|
78
|
+
- !ruby/struct:VCR::HTTPInteraction
|
79
|
+
request: !ruby/struct:VCR::Request
|
80
|
+
method: :post
|
81
|
+
uri: https://simple-note.appspot.com:443/api/note?key=agtzaW1wbGUtbm90ZXINCxIETm90ZRjq37sCDA&email=simplenotetest%40mailinator.com&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
82
|
+
body: |
|
83
|
+
VGhlIG5ldyBjb250ZW50
|
84
|
+
|
85
|
+
headers:
|
86
|
+
connection:
|
87
|
+
- close
|
88
|
+
content-type:
|
89
|
+
- application/x-www-form-urlencoded
|
90
|
+
content-length:
|
91
|
+
- "21"
|
92
|
+
host:
|
93
|
+
- simple-note.appspot.com
|
94
|
+
response: !ruby/struct:VCR::Response
|
95
|
+
status: !ruby/struct:VCR::ResponseStatus
|
96
|
+
code: 200
|
97
|
+
message: OK
|
98
|
+
headers:
|
99
|
+
expires:
|
100
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
101
|
+
content-type:
|
102
|
+
- text/html; charset=utf-8
|
103
|
+
connection:
|
104
|
+
- close
|
105
|
+
date:
|
106
|
+
- Sat, 03 Jul 2010 23:46:12 GMT
|
107
|
+
server:
|
108
|
+
- Google Frontend
|
109
|
+
cache-control:
|
110
|
+
- no-cache
|
111
|
+
body: agtzaW1wbGUtbm90ZXINCxIETm90ZRjq37sCDA
|
112
|
+
http_version: "1.1"
|
113
|
+
- !ruby/struct:VCR::HTTPInteraction
|
114
|
+
request: !ruby/struct:VCR::Request
|
115
|
+
method: :get
|
116
|
+
uri: https://simple-note.appspot.com:443/api/note?key=agtzaW1wbGUtbm90ZXINCxIETm90ZRjq37sCDA&email=simplenotetest%40mailinator.com&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
117
|
+
body:
|
118
|
+
headers:
|
119
|
+
connection:
|
120
|
+
- close
|
121
|
+
host:
|
122
|
+
- simple-note.appspot.com
|
123
|
+
response: !ruby/struct:VCR::Response
|
124
|
+
status: !ruby/struct:VCR::ResponseStatus
|
125
|
+
code: 200
|
126
|
+
message: OK
|
127
|
+
headers:
|
128
|
+
note-screatedate:
|
129
|
+
- "1278200771.134240"
|
130
|
+
note-smodifydate:
|
131
|
+
- "1278200772.046788"
|
132
|
+
expires:
|
133
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
134
|
+
content-type:
|
135
|
+
- text/html; charset=utf-8
|
136
|
+
note-modifydate:
|
137
|
+
- 2010-07-03 23:46:12.046788
|
138
|
+
connection:
|
139
|
+
- close
|
140
|
+
note-key:
|
141
|
+
- agtzaW1wbGUtbm90ZXINCxIETm90ZRjq37sCDA
|
142
|
+
date:
|
143
|
+
- Sat, 03 Jul 2010 23:46:12 GMT
|
144
|
+
server:
|
145
|
+
- Google Frontend
|
146
|
+
note-createdate:
|
147
|
+
- 2010-07-03 23:46:11.134240
|
148
|
+
note-deleted:
|
149
|
+
- "False"
|
150
|
+
cache-control:
|
151
|
+
- no-cache
|
152
|
+
body: The new content
|
153
|
+
http_version: "1.1"
|
154
|
+
- !ruby/struct:VCR::HTTPInteraction
|
155
|
+
request: !ruby/struct:VCR::Request
|
156
|
+
method: :get
|
157
|
+
uri: https://simple-note.appspot.com:443/api/delete?key=agtzaW1wbGUtbm90ZXINCxIETm90ZRjq37sCDA&email=simplenotetest%40mailinator.com&auth=2D3D3762E9204476AF991F3347C50CA9379980415D32962552C40FBE3EE4CBB6
|
158
|
+
body:
|
159
|
+
headers:
|
160
|
+
connection:
|
161
|
+
- close
|
162
|
+
host:
|
163
|
+
- simple-note.appspot.com
|
164
|
+
response: !ruby/struct:VCR::Response
|
165
|
+
status: !ruby/struct:VCR::ResponseStatus
|
166
|
+
code: 200
|
167
|
+
message: OK
|
168
|
+
headers:
|
169
|
+
expires:
|
170
|
+
- Fri, 01 Jan 1990 00:00:00 GMT
|
171
|
+
content-type:
|
172
|
+
- text/html; charset=utf-8
|
173
|
+
connection:
|
174
|
+
- close
|
175
|
+
date:
|
176
|
+
- Sat, 03 Jul 2010 23:46:13 GMT
|
177
|
+
server:
|
178
|
+
- Google Frontend
|
179
|
+
cache-control:
|
180
|
+
- no-cache
|
181
|
+
body: agtzaW1wbGUtbm90ZXINCxIETm90ZRjq37sCDA
|
182
|
+
http_version: "1.1"
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class SimpleNoteTest < Test::Unit::TestCase
|
4
|
+
context SimpleNote do
|
5
|
+
setup do
|
6
|
+
@simplenote = SimpleNote.new
|
7
|
+
end
|
8
|
+
|
9
|
+
should "log in, list notes and fetch a note" do
|
10
|
+
VCR.use_cassette('get_index', :record => :none) do
|
11
|
+
login
|
12
|
+
|
13
|
+
notes = @simplenote.get_index
|
14
|
+
assert_equal 1, notes.length
|
15
|
+
assert !notes.first["deleted"]
|
16
|
+
assert_equal "2010-07-03 22:41:13.721231", notes.first["modify"]
|
17
|
+
assert_equal "agtzaW1wbGUtbm90ZXINCxIETm90ZRiD1LoCDA", notes.first["key"]
|
18
|
+
|
19
|
+
note = @simplenote.get_note(notes.first["key"])
|
20
|
+
assert_equal "hello world this is a new note", note
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
should "search notes" do
|
25
|
+
VCR.use_cassette('search', :record => :none) do
|
26
|
+
login
|
27
|
+
|
28
|
+
response = @simplenote.search("hello")
|
29
|
+
assert_equal 1, response["Response"]["Results"].length
|
30
|
+
assert_equal "agtzaW1wbGUtbm90ZXINCxIETm90ZRiD1LoCDA", response["Response"]["Results"].first["key"]
|
31
|
+
|
32
|
+
response = @simplenote.search("goodbye")
|
33
|
+
assert_equal 0, response["Response"]["Results"].length
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
should "raise when login fails" do
|
38
|
+
VCR.use_cassette('login_failure', :record => :none) do
|
39
|
+
error = assert_raises RuntimeError do
|
40
|
+
@simplenote.login("simplenotetest@mailinator.com", "not my password!")
|
41
|
+
end
|
42
|
+
assert_equal "Login failed", error.message
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
should "create, list, fetch and delete a note" do
|
47
|
+
VCR.use_cassette('create_note', :record => :none) do
|
48
|
+
login
|
49
|
+
|
50
|
+
key = @simplenote.create_note("A test note")
|
51
|
+
|
52
|
+
notes = @simplenote.get_index
|
53
|
+
assert_contains notes.collect { |note| note["key"] }, key
|
54
|
+
|
55
|
+
note = @simplenote.get_note(key)
|
56
|
+
assert_equal "A test note", note
|
57
|
+
|
58
|
+
@simplenote.delete_note(key)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
should "update a note" do
|
63
|
+
VCR.use_cassette('update_note', :record => :none) do
|
64
|
+
login
|
65
|
+
|
66
|
+
key = @simplenote.create_note("A test note")
|
67
|
+
@simplenote.update_note(key, "The new content")
|
68
|
+
|
69
|
+
note = @simplenote.get_note(key)
|
70
|
+
assert_equal "The new content", note
|
71
|
+
|
72
|
+
@simplenote.delete_note(key)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
should "return nil when you fetch a note that doesn't exist" do
|
77
|
+
VCR.use_cassette('get_note_with_bad_key', :record => :none) do
|
78
|
+
login
|
79
|
+
|
80
|
+
assert_nil @simplenote.get_note("key that doesn't exist")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
should "raise if you try to delete a note that doesn't exist" do
|
85
|
+
VCR.use_cassette('delete_note_with_bad_key', :record => :none) do
|
86
|
+
login
|
87
|
+
|
88
|
+
error = assert_raises RuntimeError do
|
89
|
+
@simplenote.delete_note("key that doesn't exist")
|
90
|
+
end
|
91
|
+
assert_equal "Couldn't delete note", error.message
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def login
|
97
|
+
@simplenote.login("simplenotetest@mailinator.com", "password!")
|
98
|
+
end
|
99
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
require 'shoulda'
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
+
require 'simplenote'
|
8
|
+
%w(httparty fakeweb base64 vcr).each { |x| require x }
|
9
|
+
FakeWeb.allow_net_connect = false
|
10
|
+
|
11
|
+
VCR.config do |c|
|
12
|
+
c.cassette_library_dir = 'test/fixtures'
|
13
|
+
c.http_stubbing_library = :fakeweb
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jugyo-simplenote
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Simon Jefford
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-08-19 00:00:00 +09:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: shoulda
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: fakeweb
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: vcr
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: httparty
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - "="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 7
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
- 6
|
75
|
+
- 0
|
76
|
+
version: 0.6.0
|
77
|
+
type: :runtime
|
78
|
+
version_requirements: *id004
|
79
|
+
description: Uses HTTParty to present a nice Ruby wrapper for SimpleNote
|
80
|
+
email: simon.jefford@gmail.com
|
81
|
+
executables: []
|
82
|
+
|
83
|
+
extensions: []
|
84
|
+
|
85
|
+
extra_rdoc_files:
|
86
|
+
- LICENSE
|
87
|
+
- README.rdoc
|
88
|
+
files:
|
89
|
+
- .autotest
|
90
|
+
- .document
|
91
|
+
- .gitignore
|
92
|
+
- LICENSE
|
93
|
+
- README.rdoc
|
94
|
+
- Rakefile
|
95
|
+
- VERSION
|
96
|
+
- lib/simplenote.rb
|
97
|
+
- test/fixtures/create_note.yml
|
98
|
+
- test/fixtures/delete_note_with_bad_key.yml
|
99
|
+
- test/fixtures/get_index.yml
|
100
|
+
- test/fixtures/get_note_with_bad_key.yml
|
101
|
+
- test/fixtures/login_failure.yml
|
102
|
+
- test/fixtures/search.yml
|
103
|
+
- test/fixtures/update_note.yml
|
104
|
+
- test/simplenote_test.rb
|
105
|
+
- test/test_helper.rb
|
106
|
+
has_rdoc: true
|
107
|
+
homepage: http://github.com/simonjefford/simplenote
|
108
|
+
licenses: []
|
109
|
+
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options:
|
112
|
+
- --charset=UTF-8
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 3
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
version: "0"
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
132
|
+
version: "0"
|
133
|
+
requirements: []
|
134
|
+
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 1.3.7
|
137
|
+
signing_key:
|
138
|
+
specification_version: 3
|
139
|
+
summary: Simple wrapper for the SimpleNote HTTP API
|
140
|
+
test_files:
|
141
|
+
- test/simplenote_test.rb
|
142
|
+
- test/test_helper.rb
|