email_vision 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/email_vision.gemspec +2 -2
- data/lib/email_vision.rb +16 -1
- data/spec/account.yml.example +10 -2
- data/spec/email_vision_spec.rb +22 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/email_vision.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{email_vision}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-09}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.files = [
|
15
15
|
".gitignore",
|
data/lib/email_vision.rb
CHANGED
@@ -88,7 +88,12 @@ class EmailVision
|
|
88
88
|
|
89
89
|
def execute_by_obj(method, attributes)
|
90
90
|
existing_email = attributes.delete(:email_was) || attributes[:email]
|
91
|
-
entries = attributes.map
|
91
|
+
entries = attributes.map do |k,v|
|
92
|
+
v = v.strftime('%Y-%m-%d %H:%M:%S') if v.is_a?(Time)
|
93
|
+
{:entry => {:key => k, :value => v}}
|
94
|
+
end
|
95
|
+
entries = flatten_array_to_soap_xml(entries)
|
96
|
+
|
92
97
|
execute(method, :member => {:email => existing_email, :dynContent => entries})
|
93
98
|
end
|
94
99
|
|
@@ -103,4 +108,14 @@ class EmailVision
|
|
103
108
|
hash
|
104
109
|
end
|
105
110
|
end
|
111
|
+
|
112
|
+
def flatten_array_to_soap_xml(array)
|
113
|
+
return array unless array
|
114
|
+
array = array.map{|v| v.to_soap_xml }.join()
|
115
|
+
# hack the string so it does not get escaped
|
116
|
+
def array.to_soap_value
|
117
|
+
self
|
118
|
+
end
|
119
|
+
array
|
120
|
+
end
|
106
121
|
end
|
data/spec/account.yml.example
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
:login: api_your_host
|
2
2
|
:password: your_password
|
3
3
|
:key: your_api_key
|
4
|
-
:
|
4
|
+
:findable_user:
|
5
|
+
:country: "DE"
|
5
6
|
:gender: "0"
|
6
7
|
:email: test@test.de
|
7
8
|
:datejoin: 2009-12-07T13:36:15+01:00
|
9
|
+
:dateunjoin: 2010-09-17T11:03:01+02:00
|
8
10
|
:firstname: Test
|
9
|
-
:member_id: "1014086935042"
|
11
|
+
:member_id: "1014086935042"
|
12
|
+
:changeable_user: # must have firstname, lastname, country columns
|
13
|
+
:email: testaccount@testaccount.de
|
14
|
+
:member_id: "1021531859844"
|
15
|
+
:lastname: "account"
|
16
|
+
:country: "DE"
|
17
|
+
:member_id: "1021531859844"
|
data/spec/email_vision_spec.rb
CHANGED
@@ -31,7 +31,9 @@ describe "EmailVision" do
|
|
31
31
|
let(:client){EmailVision.new(config)}
|
32
32
|
let(:findable_user) do
|
33
33
|
data = config[:findable_user]
|
34
|
-
|
34
|
+
[:datejoin, :dateunjoin].each do |field|
|
35
|
+
data[field] = DateTime.parse(data[field].to_s) if data[field]
|
36
|
+
end
|
35
37
|
data
|
36
38
|
end
|
37
39
|
let(:changeable_user){config[:changeable_user]}
|
@@ -68,15 +70,30 @@ describe "EmailVision" do
|
|
68
70
|
end
|
69
71
|
|
70
72
|
describe :update do
|
71
|
-
it "can update
|
73
|
+
it "can update an attribute" do
|
72
74
|
wait_for_job_to_finish do
|
73
|
-
client.update(
|
75
|
+
client.update(
|
76
|
+
:email => changeable_user[:email],
|
77
|
+
:firstname => random_value,
|
78
|
+
:lastname => random_value
|
79
|
+
)
|
74
80
|
end
|
75
|
-
|
81
|
+
|
82
|
+
data = client.find(changeable_user[:email])
|
76
83
|
data[:firstname].should == random_value
|
84
|
+
data[:lastname].should == random_value
|
77
85
|
|
78
86
|
# it does not overwrite other attributes
|
79
|
-
data[:
|
87
|
+
data[:country].should == changeable_user[:country]
|
88
|
+
end
|
89
|
+
|
90
|
+
it "can update a Time" do
|
91
|
+
time = Time.now
|
92
|
+
wait_for_job_to_finish do
|
93
|
+
client.update(:email => changeable_user[:email], :dateofbirth => time)
|
94
|
+
end
|
95
|
+
data = client.find(changeable_user[:email])
|
96
|
+
data[:dateofbirth].strftime('%s').to_i.should == time.to_i
|
80
97
|
end
|
81
98
|
|
82
99
|
it "returns a job id" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Grosser
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-09 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|