simple_spark 1.0.3 → 1.0.4

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: 987fbf9d3e51b544aa33eae28f83e65708b36a33
4
- data.tar.gz: 38f6a9f0ca695c79904a72cb5d2cdd8dc007d8c7
3
+ metadata.gz: c2d4168cfad467ad86cb254fe01f6a17dcd3df92
4
+ data.tar.gz: bf14dc1293c65bdf3c7a7c4858dbf9ac4fe62acf
5
5
  SHA512:
6
- metadata.gz: ef0589adda9275e41f1781ba27c1c6ec774ea8a6e0ad27ee469b9134bfece252e6f79117b744f69468b9df89a9e7ea7e3a301bbdc32e9d270f2f3eb9878fc7f9
7
- data.tar.gz: afab1c06b5387fde2cb2646e6a588b2f28629f897374a641b9870035b876d44034496e2b52946ed1abaf97028f48953e904c411d05f7990b149dd3669fd4673a
6
+ metadata.gz: e3e3dba8c7f136987fbf9c697f608d7a8d1a748a14b663f164390179c2aab4cad6af0c8facf2ce74505d5a0d72e574eb793d3100a1bffca50de711337947cb9c
7
+ data.tar.gz: 06c246a18cdc54b6a3390b5e4fad8f54a78ff6ba7f51785c2443351bb5bb9a8feb98918045890373edabfe2567a05a1b57ab8ede7ceddd72d5367cdcddd72422
data/README.md CHANGED
@@ -578,6 +578,59 @@ simple_spark.inbound_domains.delete('mail.mydomain.com')
578
578
 
579
579
  <a href="https://developers.sparkpost.com/api/#/reference/inbound-domains/retrieve-and-delete" target="_blank">see SparkPost API Documentation</a>
580
580
 
581
+ ### Supression List
582
+
583
+ #### Search
584
+
585
+ Find supression list entries
586
+
587
+ ```ruby
588
+ params = {
589
+ from: '2013-04-20T07:12',
590
+ to: '2018-04-20T07:12'
591
+ }
592
+ simple_spark.suppression_list.create_or_update(params)
593
+ ```
594
+
595
+ <a href="https://developers.sparkpost.com/api/suppression-list#suppression-list-search-get" target="_blank">see SparkPost API Documentation</a>
596
+
597
+ #### Create or Update
598
+
599
+ Bulk update supression list entries
600
+
601
+ ```ruby
602
+ recipients = {
603
+ {
604
+ recipient: "rcpt_1@example.com",
605
+ transactional: true,
606
+ description: "User requested to not receive any transactional emails."
607
+ },
608
+ {
609
+ recipient: "rcpt_2@example.com",
610
+ non_transactional: true
611
+ }
612
+ }
613
+ simple_spark.suppression_list.create_or_update(recipients)
614
+ ```
615
+
616
+ <a href="https://developers.sparkpost.com/api/suppression-list#suppression-list-bulk-insert-update-put" target="_blank">see SparkPost API Documentation</a>
617
+
618
+ #### Retrieve
619
+
620
+ ```ruby
621
+ simple_spark.suppression_list.retrieve("rcpt_1@example.com")
622
+ ```
623
+
624
+ <a href="https://developers.sparkpost.com/api/suppression-list#suppression-list-retrieve,-delete-get" target="_blank">see SparkPost API Documentation</a>
625
+
626
+ #### Delete
627
+
628
+ ```ruby
629
+ simple_spark.suppression_list.delete("rcpt_1@example.com")
630
+ ```
631
+
632
+ <a href="https://developers.sparkpost.com/api/suppression-list#suppression-list-retrieve,-delete-get" target="_blank">see SparkPost API Documentation</a>
633
+
581
634
  ### Relay Webhooks
582
635
 
583
636
  #### List
@@ -715,10 +768,14 @@ simple_spark.templates.delete(yourtemplateid)
715
768
 
716
769
  ## Changelog
717
770
 
771
+ ### 1.0.4
772
+
773
+ - Add Supression List Endpoint
774
+
718
775
  ### 1.0.3
719
776
 
720
- Using JSON.generate instead of .to_json (https://github.com/leadmachineapp/simple_spark/pull/11)
721
- Fixing inbound domains bug (https://github.com/leadmachineapp/simple_spark/pull/9)
777
+ - Using JSON.generate instead of .to_json (https://github.com/leadmachineapp/simple_spark/pull/11)
778
+ - Fixing inbound domains bug (https://github.com/leadmachineapp/simple_spark/pull/9)
722
779
 
723
780
  ### 1.0.2
724
781
 
@@ -139,5 +139,9 @@ module SimpleSpark
139
139
  def relay_webhooks
140
140
  Endpoints::RelayWebhooks.new(self)
141
141
  end
142
+
143
+ def suppression_list
144
+ Endpoints::SuppressionList.new(self)
145
+ end
142
146
  end
143
147
  end
@@ -0,0 +1,48 @@
1
+ module SimpleSpark
2
+ module Endpoints
3
+ # Provides access to the /suppression-list endpoint
4
+ # @note Example suppression list recipient
5
+ # { "recipient": "rcpt_1@example.com", "transactional": true,
6
+ # "description": "User requested to not receive any transactional emails." }
7
+ # @note See: https://developers.sparkpost.com/api/suppression-list
8
+ class SuppressionList
9
+ attr_accessor :client
10
+
11
+ def initialize(client)
12
+ @client = client
13
+ end
14
+
15
+ # Search for list entries
16
+ # @param params [String] Params to use in the search
17
+ # @return [Array] a list of sample Suppression Status hash objects
18
+ # @note See: https://developers.sparkpost.com/api/suppression-list#suppression-list-search-get
19
+ def search(params = {})
20
+ @client.call(method: :get, path: 'suppression-list', query_params: params)
21
+ end
22
+
23
+ # Insert or Update List Entries
24
+ # @param recipients [Array] the entries to insert or update
25
+ # @note See: https://developers.sparkpost.com/api/suppression-list#suppression-list-bulk-insert-update-put
26
+ def create_or_update(recipients)
27
+ @client.call(method: :put, path: 'suppression-list', body_values: {recipients: recipients})
28
+ end
29
+
30
+ # Retrieve a Recipient Suppression Status
31
+ # @param recipient_email [String] the recipient email to retrieve
32
+ # @return [Hash] a suppression status result hash object
33
+ # @note See: https://developers.sparkpost.com/api/suppression-list#suppression-list-retrieve,-delete-get
34
+ def retrieve(recipient_email)
35
+ recipient_email = @client.url_encode(recipient_email)
36
+ @client.call(method: :get, path: "suppression-list/#{recipient_email}")
37
+ end
38
+
39
+ # Delete a List Entry
40
+ # @param recipient_email [String] the recipient email to delete
41
+ # @note See: https://developers.sparkpost.com/api/suppression-list#suppression-list-retrieve,-delete-delete
42
+ def delete(recipient_email)
43
+ recipient_email = @client.url_encode(recipient_email)
44
+ @client.call(method: :delete, path: "suppression-list/#{recipient_email}")
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleSpark
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
data/lib/simple_spark.rb CHANGED
@@ -10,4 +10,5 @@ require 'simple_spark/endpoints/message_events'
10
10
  require 'simple_spark/endpoints/webhooks'
11
11
  require 'simple_spark/endpoints/relay_webhooks'
12
12
  require 'simple_spark/endpoints/subaccounts'
13
+ require 'simple_spark/endpoints/suppression_list'
13
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_spark
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jak Charlton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-20 00:00:00.000000000 Z
11
+ date: 2016-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -73,6 +73,7 @@ files:
73
73
  - lib/simple_spark/endpoints/relay_webhooks.rb
74
74
  - lib/simple_spark/endpoints/sending_domains.rb
75
75
  - lib/simple_spark/endpoints/subaccounts.rb
76
+ - lib/simple_spark/endpoints/suppression_list.rb
76
77
  - lib/simple_spark/endpoints/templates.rb
77
78
  - lib/simple_spark/endpoints/transmissions.rb
78
79
  - lib/simple_spark/endpoints/webhooks.rb