expresspigeon-ruby 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 740eda4d7d4f1e572ce3d256f24f5b076b891d00
4
- data.tar.gz: 5a7c7f792fedced6f59fda76d4f8a40cfd162a7f
2
+ SHA256:
3
+ metadata.gz: a4d22490495ba935d2a33e7c47a18b434007f051e97324bbe6ad4fe21a7cff73
4
+ data.tar.gz: 6ac14ba2eb6d4437e0d93bef0e3cc2e1cadbe288459fad1a0798e561700da9c5
5
5
  SHA512:
6
- metadata.gz: af4c0be7a36f27623981947e6b2e7c9cb9fcc72024d84fa3dab1a81b2c29c8d2596aca5bf4a9b5a652e0ee5936b323ad37d22152616ec015a346ff417dcdd5b0
7
- data.tar.gz: f52d89c356545ef134463f3ddd89b3fb6536f065ee28c251c110d9d1f7b3d13b49f047f1f2981378f7a0223c5369dd350e8adcf69fb0bbbe4bdfcbb7a219413d
6
+ metadata.gz: 4b4d5a49383789e4261512714e27f02c94af1f0845748809f8455a6496b1e878530570d5bb5e4a9e281c5e01f100ca7681053abbd3f858f99b77dfc6ee5398d2
7
+ data.tar.gz: eaa011ac4ecc9fd83b87015133c4e5c11f2b91d705413b9fc7a164537285c6eb8cbb6fb9f5fca0624945b3b8f7c6b242905829fab72e3c7209da8795aa86160d
@@ -1 +1 @@
1
- ruby-2.1.1
1
+ ruby-2.3.1
@@ -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.20161021)
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.99.3)
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.2)
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
- 1.13.6
43
+ 2.0.1
@@ -12,7 +12,7 @@ module ExpressPigeon
12
12
 
13
13
 
14
14
 
15
- # JSON document represents a contact to be created or updated.
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: representation of a contact
24
+ # :returns: :status, :code, :messages, :contacts and :failed_contact_num if contact failed to create
25
25
  #
26
- def upsert(list_id, contact)
27
- post @endpoint, params = {:list_id => list_id, :contacts => [contact]}
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
@@ -1,5 +1,5 @@
1
1
  module Expresspigeon
2
2
  module API
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -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.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: 2018-09-19 00:00:00.000000000 Z
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
- rubyforge_project:
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