rews 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/rews/folder.rb +14 -0
- data/spec/rews/folder_spec.rb +21 -0
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/lib/rews/folder.rb
CHANGED
@@ -264,6 +264,13 @@ module Rews
|
|
264
264
|
@change_key == other.change_key
|
265
265
|
end
|
266
266
|
|
267
|
+
# a JSON compatible key for persistently identifying this folder
|
268
|
+
def key(ignore_change_key=false)
|
269
|
+
key = ["folder", id]
|
270
|
+
key << change_key if !ignore_change_key
|
271
|
+
key
|
272
|
+
end
|
273
|
+
|
267
274
|
def to_xml
|
268
275
|
xml = Builder::XmlMarkup.new
|
269
276
|
attrs = {:Id=>id.to_s}
|
@@ -300,6 +307,13 @@ module Rews
|
|
300
307
|
@mailbox_email = other.mailbox_email
|
301
308
|
end
|
302
309
|
|
310
|
+
# a JSON compatible key for persistently identifying this folder
|
311
|
+
def key(ignore_change_key=false)
|
312
|
+
key = ["distinguished_folder", id]
|
313
|
+
key << mailbox_email if mailbox_email
|
314
|
+
key
|
315
|
+
end
|
316
|
+
|
303
317
|
def to_xml
|
304
318
|
xml = Builder::XmlMarkup.new
|
305
319
|
xml.t :DistinguishedFolderId, :Id=>id do
|
data/spec/rews/folder_spec.rb
CHANGED
@@ -14,6 +14,20 @@ module Rews
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe Folder::DistinguishedFolderId do
|
17
|
+
it "should create a JSON compatible key" do
|
18
|
+
client = Object.new
|
19
|
+
dfid = Folder::DistinguishedFolderId.new(client, 'inbox')
|
20
|
+
dfid.key.should == ["distinguished_folder", 'inbox']
|
21
|
+
dfid.key(true).should == ["distinguished_folder", 'inbox']
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should create a JSON compatible key with a specified mailbox" do
|
25
|
+
client = Object.new
|
26
|
+
dfid = Folder::DistinguishedFolderId.new(client, 'inbox', "foo@bar.com")
|
27
|
+
dfid.key.should == ["distinguished_folder", 'inbox', "foo@bar.com"]
|
28
|
+
dfid.key(true).should == ["distinguished_folder", 'inbox', "foo@bar.com"]
|
29
|
+
end
|
30
|
+
|
17
31
|
it "should generate DistinguishedFolderId xml for the default mailbox" do
|
18
32
|
client = Object.new
|
19
33
|
xml = Folder::DistinguishedFolderId.new(client, 'inbox').to_xml
|
@@ -45,6 +59,13 @@ module Rews
|
|
45
59
|
end
|
46
60
|
|
47
61
|
describe Folder::VanillaFolderId do
|
62
|
+
it "should create a JSON compatible key" do
|
63
|
+
client = Object.new
|
64
|
+
dfid = Folder::VanillaFolderId.new(client, {:id=>'abc', :change_key=>"def"})
|
65
|
+
dfid.key.should == ["folder", 'abc', 'def']
|
66
|
+
dfid.key(true).should == ["folder", 'abc']
|
67
|
+
end
|
68
|
+
|
48
69
|
it "should generate FolderId xml with a change_key" do
|
49
70
|
client = Object.new
|
50
71
|
xml = Folder::VanillaFolderId.new(client, {:id=>"abc", :change_key=>"def"}).to_xml
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rews
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Trampoline Systems Ltd
|