send_with_us 1.11.5 → 1.12.0

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
2
  SHA1:
3
- metadata.gz: 337d955a258aa2a223354d2a33a222681b7253dd
4
- data.tar.gz: c44a47c3a838ded17faae63f6dcda5f87ce118df
3
+ metadata.gz: 78aa4c95fac765b5b16c9ee6ffa8505c41093388
4
+ data.tar.gz: 0bfb17b3d1c8715e7642e42581c1b34e5b03c049
5
5
  SHA512:
6
- metadata.gz: fc9eb38d2b58181466d037ec4cd1cbddd2ec7082fbbffe32b9a4b0d417958af62af7822c4ae3c39b8c43a4c4a6656fe484f7a5e75b2b4fe0fc1afec87d40cd22
7
- data.tar.gz: c1ebf8627bf4dfd4b2b68130cb755aaf3298e15a91cd60295ca97a9f82047e51702c8feb3f4413b187e71f82fe8dd5e6181dd2579cee19ff600b4a391c86b4c9
6
+ metadata.gz: 7538a5552bcb4bd38c4ef8673b64d75d0b2a490f688a7b93d7833786edfe421958b793a034e65bc4ed3666a022d1f7ed800db15abe2e70b336bc932cc3d64d82
7
+ data.tar.gz: 27fd496864cbde1aa97ceae56e909d0e31c33e86953e66c81af97c10e656846b9ea973428db96c7be2f2153ae2f6945893346034c5f6f3859ada218091bbd7ab
data/.travis.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.3"
3
+ - "2.2.1"
data/README.md CHANGED
@@ -289,6 +289,19 @@ obj.customer_add_to_group(email_address, group_id)
289
289
  obj.customer_remove_from_group(email_address, group_id)
290
290
  ```
291
291
 
292
+ ### Get logs for customer
293
+ This will retrieve email logs for a customer.
294
+
295
+ Optional Arguments:
296
+ - **count** – The number of logs to return. _Max: 100, Default: 100._
297
+ - **created_gt** – Return logs created strictly after the given UTC timestamp.
298
+ - **created_lt** – Return logs created strictly before the given UTC timestamp.
299
+
300
+
301
+ ```ruby
302
+ obj.customer_email_log('customer@example.com', count: 1)
303
+ ```
304
+
292
305
  ### Customer Conversion Event
293
306
  You can use the Conversion API to track conversion and revenue data events against your sent emails
294
307
 
@@ -277,10 +277,25 @@ module SendWithUs
277
277
  SendWithUs::ApiRequest.new(@configuration).delete(endpoint)
278
278
  end
279
279
 
280
- def logs(options = {})
281
- endpoint = "logs"
280
+ def customer_email_log(email_address, options = {})
281
+ endpoint = "customers/#{email_address}/logs"
282
+ params = {}
283
+
284
+ params[:count] = options[:count] unless options[:count].nil?
285
+ params[:created_gt] = options[:created_gt] unless options[:created_gt].nil?
286
+ params[:created_lt] = options[:created_lt] unless options[:created_lt].nil?
282
287
 
283
- params = {}
288
+ unless params.empty?
289
+ params = URI.encode_www_form(params)
290
+ endpoint = endpoint + '?' + params
291
+ end
292
+
293
+ SendWithUs::ApiRequest.new(@configuration).get(endpoint)
294
+ end
295
+
296
+ def logs(options = {})
297
+ endpoint = 'logs'
298
+ params = {}
284
299
 
285
300
  params[:count] = options[:count] unless options[:count].nil?
286
301
  params[:offset] = options[:offset] unless options[:offset].nil?
@@ -289,9 +304,9 @@ module SendWithUs
289
304
  params[:created_lt] = options[:created_lt] unless options[:created_lt].nil?
290
305
  params[:created_lte] = options[:created_lte] unless options[:created_lte].nil?
291
306
 
292
- unless params
293
- params = URI.encode_www_form(params)
294
- endpoint = endpoint + "?" + params
307
+ unless params.empty?
308
+ params = URI.encode_www_form(params)
309
+ endpoint = endpoint + '?' + params
295
310
  end
296
311
 
297
312
  SendWithUs::ApiRequest.new(@configuration).get(endpoint)
@@ -1,3 +1,3 @@
1
1
  module SendWithUs
2
- VERSION = '1.11.5'
2
+ VERSION = '1.12.0'
3
3
  end
@@ -29,6 +29,29 @@ describe SendWithUs::Api do
29
29
 
30
30
  it { subject.logs }
31
31
  end
32
+ describe 'with options' do
33
+ let(:options) { { count: 2 } }
34
+ before { SendWithUs::ApiRequest.any_instance.expects(:get).with('logs?count=2') }
35
+
36
+ it { subject.logs(options) }
37
+ end
38
+ end
39
+
40
+ describe '#customer_email_log' do
41
+ describe 'without options' do
42
+ let(:options) { nil }
43
+ let(:email) { 'some@email.stub' }
44
+ before { SendWithUs::ApiRequest.any_instance.expects(:get).with("customers/#{email}/logs") }
45
+
46
+ it { subject.customer_email_log(email) }
47
+ end
48
+ describe 'with options' do
49
+ let(:options) { { count: 2 } }
50
+ let(:email) { 'some@email.stub' }
51
+ before { SendWithUs::ApiRequest.any_instance.expects(:get).with("customers/#{email}/logs?count=2") }
52
+
53
+ it { subject.customer_email_log(email, options) }
54
+ end
32
55
  end
33
56
 
34
57
  describe '#log' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: send_with_us
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.5
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Harris
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-02-23 00:00:00.000000000 Z
15
+ date: 2016-03-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rake