expresspigeon-ruby 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/Gemfile.lock +6 -4
- data/lib/expresspigeon-ruby/contacts.rb +5 -5
- data/lib/expresspigeon-ruby/version.rb +1 -1
- data/spec/contacts_spec.rb +15 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a4d22490495ba935d2a33e7c47a18b434007f051e97324bbe6ad4fe21a7cff73
|
4
|
+
data.tar.gz: 6ac14ba2eb6d4437e0d93bef0e3cc2e1cadbe288459fad1a0798e561700da9c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b4d5a49383789e4261512714e27f02c94af1f0845748809f8455a6496b1e878530570d5bb5e4a9e281c5e01f100ca7681053abbd3f858f99b77dfc6ee5398d2
|
7
|
+
data.tar.gz: eaa011ac4ecc9fd83b87015133c4e5c11f2b91d705413b9fc7a164537285c6eb8cbb6fb9f5fca0624945b3b8f7c6b242905829fab72e3c7209da8795aa86160d
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.3.1
|
data/Gemfile.lock
CHANGED
@@ -8,11 +8,13 @@ GEM
|
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
diff-lcs (1.2.5)
|
11
|
-
domain_name (0.5.
|
11
|
+
domain_name (0.5.20180417)
|
12
12
|
unf (>= 0.0.5, < 1.0.0)
|
13
13
|
http-cookie (1.0.3)
|
14
14
|
domain_name (~> 0.5)
|
15
|
-
mime-types (2.
|
15
|
+
mime-types (3.2.2)
|
16
|
+
mime-types-data (~> 3.2015)
|
17
|
+
mime-types-data (3.2018.0812)
|
16
18
|
netrc (0.11.0)
|
17
19
|
rest-client (2.0.2)
|
18
20
|
http-cookie (>= 1.0.2, < 2.0)
|
@@ -28,7 +30,7 @@ GEM
|
|
28
30
|
rspec-mocks (2.14.3)
|
29
31
|
unf (0.1.4)
|
30
32
|
unf_ext
|
31
|
-
unf_ext (0.0.7.
|
33
|
+
unf_ext (0.0.7.5)
|
32
34
|
|
33
35
|
PLATFORMS
|
34
36
|
ruby
|
@@ -38,4 +40,4 @@ DEPENDENCIES
|
|
38
40
|
rspec (~> 2.6)
|
39
41
|
|
40
42
|
BUNDLED WITH
|
41
|
-
|
43
|
+
2.0.1
|
@@ -12,7 +12,7 @@ module ExpressPigeon
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
# JSON
|
15
|
+
# JSON list represents contacts to be created or updated.
|
16
16
|
# The email field is required.
|
17
17
|
# When updating a contact, list_id is optional,
|
18
18
|
# since the contact is uniquely identified by email across all lists.
|
@@ -21,10 +21,10 @@ module ExpressPigeon
|
|
21
21
|
#
|
22
22
|
# :param contact: Hash describes new contact. The "email" field is required.
|
23
23
|
#
|
24
|
-
# :returns:
|
24
|
+
# :returns: :status, :code, :messages, :contacts and :failed_contact_num if contact failed to create
|
25
25
|
#
|
26
|
-
def upsert(list_id,
|
27
|
-
post @endpoint, params = {:
|
26
|
+
def upsert(list_id, contacts)
|
27
|
+
post @endpoint, params = { list_id: list_id, contacts: [contacts].flatten }
|
28
28
|
end
|
29
29
|
|
30
30
|
# Delete single contact. If list_id is not provided, contact will be deleted from system.
|
@@ -39,4 +39,4 @@ module ExpressPigeon
|
|
39
39
|
|
40
40
|
|
41
41
|
end
|
42
|
-
end
|
42
|
+
end
|
data/spec/contacts_spec.rb
CHANGED
@@ -114,6 +114,21 @@ describe 'contacts integration test' do
|
|
114
114
|
ExpressPigeon::API.lists.delete list_response.list.id
|
115
115
|
end
|
116
116
|
|
117
|
+
it 'updates multiple contacts' do
|
118
|
+
list_response = ExpressPigeon::API.lists.create('My Lists', 'John Doe', "a@a.a")
|
119
|
+
resp = ExpressPigeon::API.contacts.upsert(
|
120
|
+
list_response.list.id,
|
121
|
+
[
|
122
|
+
{ email: 'mary@e.e', first_name: 'Mary', last_name: 'Johns' },
|
123
|
+
{ email: 'gary@e.e', first_name: 'Gary', last_name: 'Johns' },
|
124
|
+
]
|
125
|
+
)
|
126
|
+
validate_response resp, 200, 'success', /contacts created\/updated successfully/
|
127
|
+
expect(ExpressPigeon::API.contacts.find_by_email("mary@e.e").last_name).to eq 'Johns'
|
128
|
+
expect(ExpressPigeon::API.contacts.find_by_email("gary@e.e").first_name).to eq 'Gary'
|
129
|
+
ExpressPigeon::API.lists.delete list_response.list.id
|
130
|
+
end
|
131
|
+
|
117
132
|
it 'cannot delete contact with non-existent email' do
|
118
133
|
res = ExpressPigeon::API.contacts.delete("g@g.g")
|
119
134
|
validate_response res, 404, 'error', /contact=g@g.g not found/
|
@@ -165,4 +180,3 @@ describe 'contacts integration test' do
|
|
165
180
|
ExpressPigeon::API.contacts.delete('mary@e.e')
|
166
181
|
end
|
167
182
|
end
|
168
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expresspigeon-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ipolevoy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -96,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
|
100
|
-
rubygems_version: 2.2.2
|
99
|
+
rubygems_version: 3.0.1
|
101
100
|
signing_key:
|
102
101
|
specification_version: 4
|
103
102
|
summary: ExpressPigeon API Ruby Wrapper
|