sendgrid_webapi 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -0
  3. data/.rspec +0 -0
  4. data/.ruby-version +0 -0
  5. data/.tekton/Chart.lock +6 -0
  6. data/.tekton/Chart.yaml +14 -0
  7. data/.tekton/templates/pipelinerun.yaml +53 -0
  8. data/.tekton/values-main.yaml +14 -0
  9. data/.tekton/values-pr.yaml +8 -0
  10. data/.tekton/values.yaml +19 -0
  11. data/.tool-versions +0 -0
  12. data/Gemfile +0 -0
  13. data/MIT-LICENSE +0 -0
  14. data/README.rdoc +69 -18
  15. data/Rakefile +0 -0
  16. data/lib/api_key/management.rb +0 -0
  17. data/lib/api_key/modules.rb +0 -0
  18. data/lib/apikey_client.rb +0 -0
  19. data/lib/base.rb +7 -0
  20. data/lib/helper.rb +0 -0
  21. data/lib/middlewares/sendgrid_response.rb +0 -0
  22. data/lib/sendgrid_webapi.rb +0 -0
  23. data/lib/sub_user/apps.rb +0 -0
  24. data/lib/sub_user/auth.rb +0 -0
  25. data/lib/sub_user/bounces.rb +0 -0
  26. data/lib/sub_user/event_notification.rb +0 -0
  27. data/lib/sub_user/iframe.rb +0 -0
  28. data/lib/sub_user/invalid_emails.rb +0 -0
  29. data/lib/sub_user/ip_management.rb +0 -0
  30. data/lib/sub_user/limits.rb +0 -0
  31. data/lib/sub_user/management.rb +0 -0
  32. data/lib/sub_user/modules.rb +0 -0
  33. data/lib/sub_user/monitor_records.rb +0 -0
  34. data/lib/sub_user/parse.rb +0 -0
  35. data/lib/sub_user/spam.rb +0 -0
  36. data/lib/sub_user/stats.rb +0 -0
  37. data/lib/sub_user/unsubscribes.rb +0 -0
  38. data/lib/sub_user/white_label.rb +0 -0
  39. data/lib/subuser_client.rb +0 -0
  40. data/lib/version.rb +1 -1
  41. data/lib/web_api/blocks.rb +20 -7
  42. data/lib/web_api/bounces.rb +19 -6
  43. data/lib/web_api/event_notification.rb +0 -0
  44. data/lib/web_api/invalid_emails.rb +15 -5
  45. data/lib/web_api/mail.rb +0 -0
  46. data/lib/web_api/modules.rb +0 -0
  47. data/lib/web_api/parse.rb +0 -0
  48. data/lib/web_api/profile.rb +0 -0
  49. data/lib/web_api/spam.rb +14 -4
  50. data/lib/web_api/stats.rb +0 -0
  51. data/lib/web_api/unsubscribes.rb +19 -6
  52. data/lib/web_api/version.rb +0 -0
  53. data/lib/webapi_client.rb +0 -0
  54. data/sendgrid_webapi.gemspec +0 -0
  55. data/spec/cassettes/client/_modules/_block/should_get_block_emails.yml +1 -1
  56. data/spec/cassettes/client/_modules/_block/should_get_totals_blocks.yml +2 -2
  57. data/spec/cassettes/client/_modules/_block/should_try_delete_not_existing_block_email.yml +2 -2
  58. data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails.yml +1 -1
  59. data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails_using_params.yml +36 -0
  60. data/spec/cassettes/client/_modules/_bounce/should_get_totals_bounces.yml +0 -0
  61. data/spec/cassettes/client/_modules/_bounce/should_try_delete_not_existing_bounce_email.yml +2 -2
  62. data/spec/cassettes/client/_modules/_event_notification/should_delete_event_notification_url.yml +0 -0
  63. data/spec/cassettes/client/_modules/_event_notification/should_get_event_notification_url.yml +0 -0
  64. data/spec/cassettes/client/_modules/_event_notification/should_set_event_notification_url.yml +0 -0
  65. data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails.yml +1 -1
  66. data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails_emails_using_params.yml +37 -0
  67. data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails_using_params.yml +36 -0
  68. data/spec/cassettes/client/_modules/_invalid_email/should_try_delete_not_existing_invalid_emails.yml +2 -2
  69. data/spec/cassettes/client/_modules/_parse_email/should_delete_parse_email.yml +0 -0
  70. data/spec/cassettes/client/_modules/_parse_email/should_get_parse_email.yml +0 -0
  71. data/spec/cassettes/client/_modules/_parse_email/should_set_parse_email.yml +0 -0
  72. data/spec/cassettes/client/_modules/_profile/should_get_profile.yml +0 -0
  73. data/spec/cassettes/client/_modules/_profile/should_set_first_name.yml +0 -0
  74. data/spec/cassettes/client/_modules/_spam/should_get_spam_emails.yml +1 -1
  75. data/spec/cassettes/client/_modules/_spam/should_try_delete_not_existing_spam_emails.yml +2 -2
  76. data/spec/cassettes/client/_modules/_unsubscribe/should_add_unsubscribe_emails.yml +2 -2
  77. data/spec/cassettes/client/_modules/_unsubscribe/should_delete_unsubscribe_email.yml +2 -2
  78. data/spec/cassettes/client/_modules/_unsubscribe/should_get_unsubscribe_emails.yml +1 -1
  79. data/spec/cassettes/client/_modules/_unsubscribe/should_try_delete_not_existing_unsubscribe_emails.yml +3 -3
  80. data/spec/cassettes/helper/_create_sub_user_account/should_create_sub_user_account.yml +0 -0
  81. data/spec/cassettes/helper/_run_sendgrid_query/should_raise_with_unsucessfull_request.yml +0 -0
  82. data/spec/cassettes/helper/_run_sendgrid_query/should_run_sendgrid_request.yml +0 -0
  83. data/spec/cassettes/sub_user/_apps/should_activate_app.yml +0 -0
  84. data/spec/cassettes/sub_user/_apps/should_deactivate_app.yml +0 -0
  85. data/spec/cassettes/sub_user/_apps/should_get_current_setting_from_one_app.yml +0 -0
  86. data/spec/cassettes/sub_user/_apps/should_return_available_apps.yml +0 -0
  87. data/spec/cassettes/sub_user/_apps/should_set_current_app.yml +0 -0
  88. data/spec/cassettes/sub_user/_authentication/should_auth_a_sub_user.yml +0 -0
  89. data/spec/cassettes/sub_user/_authentication/should_return_error_with_a_bad_sub_user.yml +0 -0
  90. data/spec/cassettes/sub_user/_bounces/should_returns_bounce_emails.yml +0 -0
  91. data/spec/cassettes/sub_user/_bounces/should_tries_to_delete_unexisting_bounce_emails.yml +0 -0
  92. data/spec/cassettes/sub_user/_event_notification/should_add_event_notification_url.yml +0 -0
  93. data/spec/cassettes/sub_user/_event_notification/should_delete_event_notification_url.yml +0 -0
  94. data/spec/cassettes/sub_user/_event_notification/should_get_event_notification_url.yml +0 -0
  95. data/spec/cassettes/sub_user/_invalid_emails/should_return_invalid_emails.yml +0 -0
  96. data/spec/cassettes/sub_user/_invalid_emails/should_tries_to_delete_unexisting_invalid_mail.yml +0 -0
  97. data/spec/cassettes/sub_user/_ip_management/should_return_all_ips_available.yml +0 -0
  98. data/spec/cassettes/sub_user/_ip_management/should_show_ip_subuser.yml +0 -0
  99. data/spec/cassettes/sub_user/_limits/should_decrements_credits_for_a_sub_user.yml +0 -0
  100. data/spec/cassettes/sub_user/_limits/should_delete_all_limits_for_a_sub_user.yml +0 -0
  101. data/spec/cassettes/sub_user/_limits/should_increments_credits_for_a_sub_user.yml +0 -0
  102. data/spec/cassettes/sub_user/_limits/should_list_the_limits_for_a_sub_user.yml +0 -0
  103. data/spec/cassettes/sub_user/_limits/should_reset_all_limits_for_a_sub_user.yml +0 -0
  104. data/spec/cassettes/sub_user/_limits/should_returns_limits_for_a_sub_user.yml +0 -0
  105. data/spec/cassettes/sub_user/_limits/should_set_total_credits.yml +0 -0
  106. data/spec/cassettes/sub_user/_management/should_add_new_subuser.yml +0 -0
  107. data/spec/cassettes/sub_user/_management/should_disable_sub_user_for_send_email.yml +0 -0
  108. data/spec/cassettes/sub_user/_management/should_enable_sub_user_for_access_to_website.yml +0 -0
  109. data/spec/cassettes/sub_user/_management/should_enable_sub_user_for_send_email.yml +0 -0
  110. data/spec/cassettes/sub_user/_management/should_update_sub_user.yml +0 -0
  111. data/spec/cassettes/sub_user/_monitor_records/should_add_existing_sub_user_to_monitor_record.yml +0 -0
  112. data/spec/cassettes/sub_user/_monitor_records/should_create_a_new_monitor_record.yml +0 -0
  113. data/spec/cassettes/sub_user/_monitor_records/should_delete_a_monitor_record.yml +0 -0
  114. data/spec/cassettes/sub_user/_monitor_records/should_edit_a_monitor_record.yml +0 -0
  115. data/spec/cassettes/sub_user/_monitor_records/should_remove_existing_sub_user_from_monitor_record.yml +0 -0
  116. data/spec/cassettes/sub_user/_parse_email/should_delete_parse_email.yml +0 -0
  117. data/spec/cassettes/sub_user/_parse_email/should_get_parse_email.yml +0 -0
  118. data/spec/cassettes/sub_user/_parse_email/should_set_parse_email.yml +0 -0
  119. data/spec/cassettes/sub_user/_spam/should_return_spam_mails.yml +0 -0
  120. data/spec/cassettes/sub_user/_spam/should_tries_to_delete_unexisting_spam_mail.yml +0 -0
  121. data/spec/cassettes/sub_user/_unsubscribes/should_add_bounce_email.yml +0 -0
  122. data/spec/cassettes/sub_user/_unsubscribes/should_delete_existing_bounce_email.yml +0 -0
  123. data/spec/cassettes/sub_user/_unsubscribes/should_delete_unexisting_bounce_email.yml +0 -0
  124. data/spec/cassettes/sub_user/_unsubscribes/should_returns_bounce_emails.yml +0 -0
  125. data/spec/client_spec.rb +68 -52
  126. data/spec/helper_spec.rb +2 -3
  127. data/spec/internal/config/database-standard.yml +24 -0
  128. data/spec/spec_helper.rb +0 -4
  129. data/spec/sub_user_spec.rb +0 -0
  130. data/test.rb +0 -0
  131. metadata +17 -80
  132. data/.circleci/config.yml +0 -132
  133. data/.circleci/setup-rubygems.sh +0 -5
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: get
5
- uri: https://api.sendgrid.com/api/bounces.delete.json?email=test@example.com
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/suppression/bounces/test@example.com
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.sendgrid.com/api/invalidemails.get.json
5
+ uri: https://api.sendgrid.com/v3/suppression/invalid_emails
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/invalid_emails?limit=2&offset=1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Authorization:
11
+ - Bearer apikey
12
+ User-Agent:
13
+ - Faraday v1.10.3
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 401
21
+ message: Unauthorized
22
+ headers:
23
+ Server:
24
+ - nginx
25
+ Date:
26
+ - Thu, 11 May 2023 20:57:30 GMT
27
+ Content-Type:
28
+ - application/json
29
+ Content-Length:
30
+ - '52'
31
+ Connection:
32
+ - keep-alive
33
+ body:
34
+ encoding: UTF-8
35
+ string: '{"errors":[{"field":null,"message":"unauthorized"}]}'
36
+ recorded_at: Thu, 11 May 2023 20:57:30 GMT
37
+ recorded_with: VCR 6.1.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.sendgrid.com/v3/suppression/invalid_emails?limit=3&offset=2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.8.9
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - '*/*'
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - nginx/1.4.2
23
+ Date:
24
+ - Fri, 17 Jan 2014 01:39:56 GMT
25
+ Content-Type:
26
+ - text/html
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ body:
32
+ encoding: UTF-8
33
+ string: '["test@example.com", "test2@example.com", "test3@example.com"]'
34
+ http_version:
35
+ recorded_at: Fri, 17 Jan 2014 01:39:57 GMT
36
+ recorded_with: VCR 2.8.0
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: get
5
- uri: https://api.sendgrid.com/api/invalidemails.delete.json?email=test@example.com
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/suppression/invalid_emails/test@example.com
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.sendgrid.com/api/spamreports.get.json
5
+ uri: https://api.sendgrid.com/v3/suppression/spam_reports
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: get
5
- uri: https://api.sendgrid.com/api/spamreports.delete.json?email=test@example.com
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/suppression/spam_reports/test@example.com
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: get
5
- uri: https://api.sendgrid.com/api/unsubscribes.add.json?email=test@example.com
4
+ method: post
5
+ uri: https://api.sendgrid.com/v3/asm/suppressions/global
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: get
5
- uri: https://api.sendgrid.com/api/unsubscribes.delete.json?email=test@example.com
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/asm/suppressions/global/test@example.com
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.sendgrid.com/api/unsubscribes.get.json
5
+ uri: https://api.sendgrid.com/v3/suppression/unsubscribes
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  http_interactions:
3
3
  - request:
4
- method: get
5
- uri: https://api.sendgrid.com/api/unsubscribes.delete.json?email=test@example.com
4
+ method: delete
5
+ uri: https://api.sendgrid.com/v3/asm/suppressions/global/test@example.com
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -30,7 +30,7 @@ http_interactions:
30
30
  - keep-alive
31
31
  body:
32
32
  encoding: UTF-8
33
- string: '{"message": "Email does not exist"}'
33
+ string: '{"errors":[{"field":"null","message":"resource not found"}]}'
34
34
  http_version:
35
35
  recorded_at: Fri, 17 Jan 2014 01:49:19 GMT
36
36
  recorded_with: VCR 2.8.0
data/spec/client_spec.rb CHANGED
@@ -6,128 +6,144 @@ describe "client" do
6
6
 
7
7
  describe "#base", :vcr do
8
8
  it "should return api url" do
9
- client.base_url.should eql "https://api.sendgrid.com/api/"
9
+ expect(client.base_url).to eql "https://api.sendgrid.com/api/"
10
10
  end
11
-
11
+
12
12
  it "should return request url" do
13
- client.make_request_url("blocks.get.json", {:data => 1}).
14
- should eql "blocks.get.json?data=1"
13
+ expect(client.make_request_url("blocks.get.json", {:data => 1})).
14
+ to eql "blocks.get.json?data=1"
15
15
  end
16
-
16
+
17
17
  it "should convert hash to url params" do
18
- client.to_query({:value_one => "foo_one", :value_two => "foo_two"}).
19
- should eql "value_one=foo_one&value_two=foo_two"
18
+ expect(client.to_query({:value_one => "foo_one", :value_two => "foo_two"})).
19
+ to eql "value_one=foo_one&value_two=foo_two"
20
20
  end
21
21
  end
22
22
 
23
23
  describe "#modules", :vcr do
24
24
  describe "#block" do
25
25
  it "should get block emails" do
26
- client.blocks.get.should eql []
26
+ expect(client.blocks.get).to eql []
27
27
  end
28
+
28
29
  it "should try delete not existing block email" do
29
- client.blocks.delete(:email => "test@example.com").should == {"message"=>"Email does not exist"}
30
+ expect(client.blocks.delete({email: "test@example.com"})).to eql ({"message"=>"Email does not exist"})
30
31
  end
32
+
31
33
  it "should get totals blocks" do
32
- client.blocks.count.should eql({"count"=>0})
34
+ expect(client.blocks.count).to eql({:count=>0})
33
35
  end
34
36
  end
35
37
 
36
38
  describe "#bounce", :vcr do
37
39
  it "should get bounce emails" do
38
- client.bounces.get.should eql []
40
+ expect(client.bounces.get).to eql []
39
41
  end
42
+
43
+ it "should get bounce emails using params" do
44
+ expect(client.bounces.get({limit: 2, offset: 1}).count).to eql 2
45
+ end
46
+
40
47
  it "should try delete not existing bounce email" do
41
- client.bounces.delete(:email => "test@example.com").should == {"message"=>"Email does not exist"}
48
+ expect(client.bounces.delete({email: "test@example.com"})).to eql ({"message"=>"Email does not exist"})
42
49
  end
43
50
  end
44
51
 
45
52
  describe "#invalid_email", :vcr do
46
53
  it "should get invalid emails" do
47
- client.invalid_emails.get.should eql []
54
+ expect(client.invalid_emails.get).to eql []
55
+ end
56
+
57
+ it "should get invalid emails using params" do
58
+ expect(client.invalid_emails.get({limit: 3, offset: 2}).count).to eql 3
48
59
  end
60
+
49
61
  it "should try delete not existing invalid emails" do
50
- client.invalid_emails.delete(:email => "test@example.com").should == {"message"=>"Email does not exist"}
62
+ expect(client.invalid_emails.delete(:email => "test@example.com")).to eql ({"message"=>"Email does not exist"})
51
63
  end
52
64
  end
53
65
 
54
66
  describe "#spam" do
55
67
  it "should get spam emails", :vcr do
56
- client.spam.get.should eql []
68
+ expect(client.spam.get).to eql []
57
69
  end
70
+
58
71
  it "should try delete not existing spam emails" do
59
- client.spam.delete(:email => "test@example.com").should == {"message"=>"Email does not exist"}
72
+ expect(client.spam.delete({:email => "test@example.com"})).to eql ({"message"=>"Email does not exist"})
60
73
  end
61
74
  end
62
75
 
63
76
  describe "#unsubscribe", :vcr do
64
77
  it "should add unsubscribe emails" do
65
- client.unsubscribes.add(:email => "test@example.com").
66
- should == {"message"=>"success"}
78
+ expect(client.unsubscribes.add({recipient_emails: ["test@example.com"]})).
79
+ to eql ({"message"=>"success"})
67
80
  end
81
+
68
82
  it "should get unsubscribe emails" do
69
- client.unsubscribes.get.
70
- should eql [{"email"=>"test@example.com"}]
83
+ expect(client.unsubscribes.get).
84
+ to eql [{"email"=>"test@example.com"}]
71
85
  end
86
+
72
87
  it "should delete unsubscribe email" do
73
- client.unsubscribes.delete(:email => "test@example.com").
74
- should == {"message"=>"success"}
88
+ expect(client.unsubscribes.delete(:email => "test@example.com")).
89
+ to eql ({"message"=>"success"})
75
90
  end
91
+
76
92
  it "should try delete not existing unsubscribe emails" do
77
- client.unsubscribes.delete(:email => "test@example.com").
78
- should == {"message"=>"Email does not exist"}
93
+ expect(client.unsubscribes.delete({email: "test@example.com"})).
94
+ to eql ({"errors" => [{"field"=>"null", "message"=>"resource not found"}]})
79
95
  end
80
96
  end
81
-
97
+
82
98
  describe "#parse_email", :vcr do
83
99
  it "should set parse email" do
84
- client.parse_email.set(:hostname => "www.example.com", :url => "www.mydomain.com/parse.php", :spam_check => "1").
85
- should == {"message"=>"success"}
100
+ expect(client.parse_email.set(:hostname => "www.example.com", :url => "www.mydomain.com/parse.php", :spam_check => "1")).
101
+ to eql ({"message"=>"success"})
86
102
  end
87
-
103
+
88
104
  it "should get parse email", :vcr do
89
- client.parse_email.get.
90
- should == {"parse"=>[{"hostname"=>"www.example.com", "url"=>"www.mydomain.com/parse.php", "spam_check"=>1}]}
105
+ expect(client.parse_email.get).
106
+ to eql ({"parse"=>[{"hostname"=>"www.example.com", "url"=>"www.mydomain.com/parse.php", "spam_check"=>1}]})
91
107
  end
92
-
108
+
93
109
  it "should delete parse email", :vcr do
94
- client.parse_email.delete(:hostname => "www.example.com").
95
- should == {"message"=>"success"}
96
- client.parse_email.get.
97
- should == {"parse" => []}
110
+ expect(client.parse_email.delete(:hostname => "www.example.com")).
111
+ to eql ({"message"=>"success"})
112
+ expect(client.parse_email.get).
113
+ to eql ({"parse" => []})
98
114
  end
99
115
  end
100
116
 
101
117
  describe "#event_notification", :vcr do
102
118
  it "should set event notification url" do
103
- client.event_notification.set(:url => "http://www.yourposturlhere.com").
104
- should == {"message"=>"success"}
119
+ expect(client.event_notification.set(:url => "http://www.yourposturlhere.com")).
120
+ to eql ({"message"=>"success"})
105
121
  end
106
-
122
+
107
123
  it "should get event notification url" do
108
- client.event_notification.get.
109
- should == [{"url" => "http:\/\/www.yourposturlhere.com"}]
124
+ expect(client.event_notification.get).
125
+ to eql ([{"url" => "http:\/\/www.yourposturlhere.com"}])
110
126
  end
111
-
127
+
112
128
  it "should delete event notification url" do
113
- client.event_notification.delete.
114
- should == {"message"=>"success"}
129
+ expect(client.event_notification.delete).
130
+ to eql ({"message"=>"success"})
115
131
  end
116
132
  end
117
133
 
118
134
  describe "#profile", :vcr do
119
135
  it "should get profile" do
120
- client.profile.get.
121
- should == [{"username"=>"user", "email"=>"user", "active"=>"true", "first_name"=>"Reseller", "last_name"=>"Customer", "address"=>"555 Any Street", "address2"=>"", "city"=>"City", "state"=>"State", "zip"=>"90000", "country"=>"US", "phone"=>"555-555-5555", "website"=>"http://Website", "website_access"=>"true"}]
136
+ expect(client.profile.get).
137
+ to eql ([{"username"=>"user", "email"=>"user", "active"=>"true", "first_name"=>"Reseller", "last_name"=>"Customer", "address"=>"555 Any Street", "address2"=>"", "city"=>"City", "state"=>"State", "zip"=>"90000", "country"=>"US", "phone"=>"555-555-5555", "website"=>"http://Website", "website_access"=>"true"}])
122
138
  end
123
-
139
+
124
140
  it "should set first name" do
125
- client.profile.set(:first_name => "test").
126
- should == {"message" => "success"}
127
- client.profile.get.first["first_name"].
128
- should == "test"
129
- client.profile.set(:first_name => "Reseller").
130
- should == {"message" => "success"}
141
+ expect(client.profile.set(:first_name => "test")).
142
+ to eql ({"message" => "success"})
143
+ expect(client.profile.get.first["first_name"]).
144
+ to eql "test"
145
+ expect(client.profile.set(:first_name => "Reseller")).
146
+ to eql ({"message" => "success"})
131
147
  end
132
148
  end
133
149
  end
data/spec/helper_spec.rb CHANGED
@@ -30,11 +30,10 @@ describe "helper" do
30
30
  apps = { :opentrack => {:name => "eventnotify", :processed => "0", :dropped => "1", :deferred => "1",
31
31
  :delivered => "0", :bounce => "1", :click => "1", :open => "1", :unsubscribe => "1", :spamreport => "1",
32
32
  :url => "https://example.com"},
33
- :clicktrack => {:enable_text => "1"},
34
- :opentrack => {}
33
+ :clicktrack => {}
35
34
  }
36
35
 
37
- @users = {"test-6" => {:account => user_hash, :applications => apps, :assigned_ips => ["192.254.126.178"]}}
36
+ @users = {"test-6" => {:account => user_hash, :applications => apps, :assigned_ips => []}}
38
37
 
39
38
  end
40
39
 
@@ -0,0 +1,24 @@
1
+ common: &common
2
+ adapter: postgresql
3
+ encoding: utf8
4
+ host: <%= ENV["DBHOST"] || "127.0.0.1" %>
5
+ port: <%= ENV["DBPORT"] || "5432" %>
6
+ database: <%= ENV["DBNAME"] || "has_helpers_test" %>
7
+ username: <%= ENV["DBUSER"] || "postgres" %>
8
+ password: <%= ENV["DBPASSWORD"] || "" %>
9
+ pool: 5
10
+ reconnect: true
11
+ timeout: 5000
12
+
13
+ development:
14
+ <<: *common
15
+
16
+ test:
17
+ <<: *common
18
+
19
+ staging:
20
+ <<: *common
21
+
22
+ production:
23
+ <<: *common
24
+ pool: 10
data/spec/spec_helper.rb CHANGED
@@ -7,7 +7,3 @@ VCR.configure do |c|
7
7
  c.hook_into :webmock
8
8
  c.configure_rspec_metadata!
9
9
  end
10
-
11
- RSpec.configure do |c|
12
- c.treat_symbols_as_metadata_keys_with_true_values = true
13
- end
File without changes
data/test.rb CHANGED
File without changes