sendgrid-ruby 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9e089f11c9fcefbb345b5031cb7319a423c31c5
4
- data.tar.gz: bbdce0d5b46c388c7e31c383531a2d026e800d3a
3
+ metadata.gz: d87e0ebd7948408c1716659ae622d2be7f95f59a
4
+ data.tar.gz: bc8f0d2d86daa5fea84161a044aac3f0960825cf
5
5
  SHA512:
6
- metadata.gz: 9120ecc8f69f5b16f05ebf7a6302594063f80c13be13b44bb8fd08e7563baed25fa050af579db1b0f8a06f3c836f1ca9c631e5b3b0da998448aae2756a5bae93
7
- data.tar.gz: 607643666e9f63e9f0d46f9e50c348da837c330d01645db804fc6cdde24b93a8580d506f2e232f9df690da5d885de5c4f18685e6d40a8c4414002bf209037787
6
+ metadata.gz: dd419b14d5b9b113b7860a4dc0683c70cb051dfa6494d225b28c6998b12b1dc025ab3fc53dce71a962044dc8dce15d23b815b4d3ec503d9f6d35d0978a9ccb64
7
+ data.tar.gz: e651ea89308ba59e482cd6fdc26058a3638a9ff0cc692daa294f2078c53e0c01040fd9d75a1c874c86fda2dcc4151dd29aeac8c99227c363de19ac56c8372b8d
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [3.0.6] - 2016-07-05 ##
5
+ ### Added
6
+ - Update docs, unit tests and examples to include Sender ID
7
+
4
8
  ## [3.0.5] - 2016-07-05 ##
5
9
  ### Added
6
10
  - Accept: application/json header per https://sendgrid.com/docs/API_Reference/Web_API_v3/How_To_Use_The_Web_API_v3/requests.html
data/USAGE.md CHANGED
@@ -28,6 +28,7 @@ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
28
28
  * [MAILBOX PROVIDERS](#mailbox_providers)
29
29
  * [PARTNER SETTINGS](#partner_settings)
30
30
  * [SCOPES](#scopes)
31
+ * [SENDERS](#senders)
31
32
  * [STATS](#stats)
32
33
  * [SUBUSERS](#subusers)
33
34
  * [SUPPRESSION](#suppression)
@@ -1469,7 +1470,7 @@ The contactdb is a database of your contacts for [SendGrid Marketing Campaigns](
1469
1470
 
1470
1471
 
1471
1472
  ```ruby
1472
- params = JSON.parse('{"%7Bfield_name%7D": "test_string", "{field_name}": "test_string"}')
1473
+ params = JSON.parse('{"{field_name}": "test_string"}')
1473
1474
  response = sg.client.contactdb.recipients.search.get(query_params: params)
1474
1475
  puts response.status_code
1475
1476
  puts response.body
@@ -2698,6 +2699,141 @@ puts response.status_code
2698
2699
  puts response.body
2699
2700
  puts response.headers
2700
2701
  ```
2702
+ <a name="senders"></a>
2703
+ # SENDERS
2704
+
2705
+ ## Create a Sender Identity
2706
+
2707
+ **This endpoint allows you to create a new sender identity.**
2708
+
2709
+ *You may create up to 100 unique sender identities.*
2710
+
2711
+ Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
2712
+
2713
+ ### POST /senders
2714
+
2715
+
2716
+ ```ruby
2717
+ data = JSON.parse('{
2718
+ "address": "123 Elm St.",
2719
+ "address_2": "Apt. 456",
2720
+ "city": "Denver",
2721
+ "country": "United States",
2722
+ "from": {
2723
+ "email": "from@example.com",
2724
+ "name": "Example INC"
2725
+ },
2726
+ "nickname": "My Sender ID",
2727
+ "reply_to": {
2728
+ "email": "replyto@example.com",
2729
+ "name": "Example INC"
2730
+ },
2731
+ "state": "Colorado",
2732
+ "zip": "80202"
2733
+ }')
2734
+ response = sg.client.senders.post(request_body: data)
2735
+ puts response.status_code
2736
+ puts response.body
2737
+ puts response.headers
2738
+ ```
2739
+ ## Get all Sender Identities
2740
+
2741
+ **This endpoint allows you to retrieve a list of all sender identities that have been created for your account.**
2742
+
2743
+ Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
2744
+
2745
+ ### GET /senders
2746
+
2747
+
2748
+ ```ruby
2749
+ response = sg.client.senders.get()
2750
+ puts response.status_code
2751
+ puts response.body
2752
+ puts response.headers
2753
+ ```
2754
+ ## Update a Sender Identity
2755
+
2756
+ **This endpoint allows you to update a sender identity.**
2757
+
2758
+ Updates to `from.email` require re-verification. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
2759
+
2760
+ Partial updates are allowed, but fields that are marked as "required" in the POST (create) endpoint must not be nil if that field is included in the PATCH request.
2761
+
2762
+ ### PATCH /senders/{sender_id}
2763
+
2764
+
2765
+ ```ruby
2766
+ data = JSON.parse('{
2767
+ "address": "123 Elm St.",
2768
+ "address_2": "Apt. 456",
2769
+ "city": "Denver",
2770
+ "country": "United States",
2771
+ "from": {
2772
+ "email": "from@example.com",
2773
+ "name": "Example INC"
2774
+ },
2775
+ "nickname": "My Sender ID",
2776
+ "reply_to": {
2777
+ "email": "replyto@example.com",
2778
+ "name": "Example INC"
2779
+ },
2780
+ "state": "Colorado",
2781
+ "zip": "80202"
2782
+ }')
2783
+ sender_id = "test_url_param"
2784
+ response = sg.client.senders._(sender_id).patch(request_body: data)
2785
+ puts response.status_code
2786
+ puts response.body
2787
+ puts response.headers
2788
+ ```
2789
+ ## View a Sender Identity
2790
+
2791
+ **This endpoint allows you to retrieve a specific sender identity.**
2792
+
2793
+ Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
2794
+
2795
+ ### GET /senders/{sender_id}
2796
+
2797
+
2798
+ ```ruby
2799
+ sender_id = "test_url_param"
2800
+ response = sg.client.senders._(sender_id).get()
2801
+ puts response.status_code
2802
+ puts response.body
2803
+ puts response.headers
2804
+ ```
2805
+ ## Delete a Sender Identity
2806
+
2807
+ **This endoint allows you to delete one of your sender identities.**
2808
+
2809
+ Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
2810
+
2811
+ ### DELETE /senders/{sender_id}
2812
+
2813
+
2814
+ ```ruby
2815
+ sender_id = "test_url_param"
2816
+ response = sg.client.senders._(sender_id).delete()
2817
+ puts response.status_code
2818
+ puts response.body
2819
+ puts response.headers
2820
+ ```
2821
+ ## Resend Sender Identity Verification
2822
+
2823
+ **This enpdoint allows you to resend a sender identity verification email.**
2824
+
2825
+ Sender Identities are required to be verified before use. If your domain has been whitelabeled it will auto verify on creation. Otherwise an email will be sent to the `from.email`.
2826
+
2827
+ ### POST /senders/{sender_id}/resend_verification
2828
+
2829
+
2830
+ ```ruby
2831
+ sender_id = "test_url_param"
2832
+ response = sg.client.senders._(sender_id).resend_verification.post()
2833
+ puts response.status_code
2834
+ puts response.body
2835
+ puts response.headers
2836
+ ```
2701
2837
  <a name="stats"></a>
2702
2838
  # STATS
2703
2839
 
@@ -240,7 +240,7 @@ puts response.headers
240
240
  # Retrieve recipients matching search criteria #
241
241
  # GET /contactdb/recipients/search #
242
242
 
243
- params = JSON.parse('{"%7Bfield_name%7D": "test_string", "{field_name}": "test_string"}')
243
+ params = JSON.parse('{"{field_name}": "test_string"}')
244
244
  response = sg.client.contactdb.recipients.search.get(query_params: params)
245
245
  puts response.status_code
246
246
  puts response.body
@@ -0,0 +1,98 @@
1
+ require 'sendgrid-ruby'
2
+
3
+
4
+ sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
5
+
6
+
7
+ ##################################################
8
+ # Create a Sender Identity #
9
+ # POST /senders #
10
+
11
+ data = JSON.parse('{
12
+ "address": "123 Elm St.",
13
+ "address_2": "Apt. 456",
14
+ "city": "Denver",
15
+ "country": "United States",
16
+ "from": {
17
+ "email": "from@example.com",
18
+ "name": "Example INC"
19
+ },
20
+ "nickname": "My Sender ID",
21
+ "reply_to": {
22
+ "email": "replyto@example.com",
23
+ "name": "Example INC"
24
+ },
25
+ "state": "Colorado",
26
+ "zip": "80202"
27
+ }')
28
+ response = sg.client.senders.post(request_body: data)
29
+ puts response.status_code
30
+ puts response.body
31
+ puts response.headers
32
+
33
+ ##################################################
34
+ # Get all Sender Identities #
35
+ # GET /senders #
36
+
37
+ response = sg.client.senders.get()
38
+ puts response.status_code
39
+ puts response.body
40
+ puts response.headers
41
+
42
+ ##################################################
43
+ # Update a Sender Identity #
44
+ # PATCH /senders/{sender_id} #
45
+
46
+ data = JSON.parse('{
47
+ "address": "123 Elm St.",
48
+ "address_2": "Apt. 456",
49
+ "city": "Denver",
50
+ "country": "United States",
51
+ "from": {
52
+ "email": "from@example.com",
53
+ "name": "Example INC"
54
+ },
55
+ "nickname": "My Sender ID",
56
+ "reply_to": {
57
+ "email": "replyto@example.com",
58
+ "name": "Example INC"
59
+ },
60
+ "state": "Colorado",
61
+ "zip": "80202"
62
+ }')
63
+ sender_id = "test_url_param"
64
+ response = sg.client.senders._(sender_id).patch(request_body: data)
65
+ puts response.status_code
66
+ puts response.body
67
+ puts response.headers
68
+
69
+ ##################################################
70
+ # View a Sender Identity #
71
+ # GET /senders/{sender_id} #
72
+
73
+ sender_id = "test_url_param"
74
+ response = sg.client.senders._(sender_id).get()
75
+ puts response.status_code
76
+ puts response.body
77
+ puts response.headers
78
+
79
+ ##################################################
80
+ # Delete a Sender Identity #
81
+ # DELETE /senders/{sender_id} #
82
+
83
+ sender_id = "test_url_param"
84
+ response = sg.client.senders._(sender_id).delete()
85
+ puts response.status_code
86
+ puts response.body
87
+ puts response.headers
88
+
89
+ ##################################################
90
+ # Resend Sender Identity Verification #
91
+ # POST /senders/{sender_id}/resend_verification #
92
+
93
+ sender_id = "test_url_param"
94
+ response = sg.client.senders._(sender_id).resend_verification.post()
95
+ puts response.status_code
96
+ puts response.body
97
+ puts response.headers
98
+
@@ -1,3 +1,3 @@
1
1
  module SendGrid
2
- VERSION = '3.0.5'
2
+ VERSION = '3.0.6'
3
3
  end
@@ -30,7 +30,7 @@ class TestAPI < Minitest::Test
30
30
  ')
31
31
  assert_equal(test_headers, sg.request_headers)
32
32
  assert_equal("v3", sg.version)
33
- assert_equal("3.0.5", SendGrid::VERSION)
33
+ assert_equal("3.0.6", SendGrid::VERSION)
34
34
  assert_instance_of(SendGrid::Client, sg.client)
35
35
  end
36
36
 
@@ -659,7 +659,7 @@ class TestAPI < Minitest::Test
659
659
  end
660
660
 
661
661
  def test_contactdb_recipients_search_get
662
- params = JSON.parse('{"%7Bfield_name%7D": "test_string", "{field_name}": "test_string"}')
662
+ params = JSON.parse('{"{field_name}": "test_string"}')
663
663
  headers = JSON.parse('{"X-Mock": 200}')
664
664
  response = @sg.client.contactdb.recipients.search.get(query_params: params, request_headers: headers)
665
665
  self.assert_equal(response.status_code, "200")
@@ -1242,6 +1242,80 @@ class TestAPI < Minitest::Test
1242
1242
  self.assert_equal(response.status_code, "200")
1243
1243
  end
1244
1244
 
1245
+ def test_senders_post
1246
+ data = JSON.parse('{
1247
+ "address": "123 Elm St.",
1248
+ "address_2": "Apt. 456",
1249
+ "city": "Denver",
1250
+ "country": "United States",
1251
+ "from": {
1252
+ "email": "from@example.com",
1253
+ "name": "Example INC"
1254
+ },
1255
+ "nickname": "My Sender ID",
1256
+ "reply_to": {
1257
+ "email": "replyto@example.com",
1258
+ "name": "Example INC"
1259
+ },
1260
+ "state": "Colorado",
1261
+ "zip": "80202"
1262
+ }')
1263
+ headers = JSON.parse('{"X-Mock": 201}')
1264
+ response = @sg.client.senders.post(request_body: data, request_headers: headers)
1265
+ self.assert_equal(response.status_code, "201")
1266
+ end
1267
+
1268
+ def test_senders_get
1269
+ headers = JSON.parse('{"X-Mock": 200}')
1270
+ response = @sg.client.senders.get(request_headers: headers)
1271
+ self.assert_equal(response.status_code, "200")
1272
+ end
1273
+
1274
+ def test_senders__sender_id__patch
1275
+ data = JSON.parse('{
1276
+ "address": "123 Elm St.",
1277
+ "address_2": "Apt. 456",
1278
+ "city": "Denver",
1279
+ "country": "United States",
1280
+ "from": {
1281
+ "email": "from@example.com",
1282
+ "name": "Example INC"
1283
+ },
1284
+ "nickname": "My Sender ID",
1285
+ "reply_to": {
1286
+ "email": "replyto@example.com",
1287
+ "name": "Example INC"
1288
+ },
1289
+ "state": "Colorado",
1290
+ "zip": "80202"
1291
+ }')
1292
+ sender_id = "test_url_param"
1293
+ headers = JSON.parse('{"X-Mock": 200}')
1294
+ response = @sg.client.senders._(sender_id).patch(request_body: data, request_headers: headers)
1295
+ self.assert_equal(response.status_code, "200")
1296
+ end
1297
+
1298
+ def test_senders__sender_id__get
1299
+ sender_id = "test_url_param"
1300
+ headers = JSON.parse('{"X-Mock": 200}')
1301
+ response = @sg.client.senders._(sender_id).get(request_headers: headers)
1302
+ self.assert_equal(response.status_code, "200")
1303
+ end
1304
+
1305
+ def test_senders__sender_id__delete
1306
+ sender_id = "test_url_param"
1307
+ headers = JSON.parse('{"X-Mock": 204}')
1308
+ response = @sg.client.senders._(sender_id).delete(request_headers: headers)
1309
+ self.assert_equal(response.status_code, "204")
1310
+ end
1311
+
1312
+ def test_senders__sender_id__resend_verification_post
1313
+ sender_id = "test_url_param"
1314
+ headers = JSON.parse('{"X-Mock": 204}')
1315
+ response = @sg.client.senders._(sender_id).resend_verification.post(request_headers: headers)
1316
+ self.assert_equal(response.status_code, "204")
1317
+ end
1318
+
1245
1319
  def test_stats_get
1246
1320
  params = JSON.parse('{"aggregated_by": "day", "limit": 1, "start_date": "2016-01-01", "end_date": "2016-04-01", "offset": 1}')
1247
1321
  headers = JSON.parse('{"X-Mock": 200}')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendgrid-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elmer Thomas
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-07-05 00:00:00.000000000 Z
13
+ date: 2016-07-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ruby_http_client
@@ -74,6 +74,7 @@ files:
74
74
  - examples/mailsettings/mailsettings.rb
75
75
  - examples/partnersettings/partnersettings.rb
76
76
  - examples/scopes/scopes.rb
77
+ - examples/senders/senders.rb
77
78
  - examples/stats/stats.rb
78
79
  - examples/subusers/subusers.rb
79
80
  - examples/suppression/suppression.rb