sendgrid_webapi 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/.ruby-version +0 -0
- data/.tekton/Chart.lock +6 -0
- data/.tekton/Chart.yaml +14 -0
- data/.tekton/templates/pipelinerun.yaml +53 -0
- data/.tekton/values-main.yaml +14 -0
- data/.tekton/values-pr.yaml +8 -0
- data/.tekton/values.yaml +19 -0
- data/.tool-versions +0 -0
- data/Gemfile +0 -1
- data/MIT-LICENSE +20 -0
- data/README.rdoc +69 -18
- data/Rakefile +0 -0
- data/lib/api_key/management.rb +0 -0
- data/lib/api_key/modules.rb +0 -0
- data/lib/apikey_client.rb +0 -0
- data/lib/base.rb +7 -0
- data/lib/helper.rb +0 -0
- data/lib/middlewares/sendgrid_response.rb +0 -0
- data/lib/sendgrid_webapi.rb +0 -0
- data/lib/sub_user/apps.rb +0 -0
- data/lib/sub_user/auth.rb +0 -0
- data/lib/sub_user/bounces.rb +0 -0
- data/lib/sub_user/event_notification.rb +0 -0
- data/lib/sub_user/iframe.rb +0 -0
- data/lib/sub_user/invalid_emails.rb +0 -0
- data/lib/sub_user/ip_management.rb +0 -0
- data/lib/sub_user/limits.rb +0 -0
- data/lib/sub_user/management.rb +0 -0
- data/lib/sub_user/modules.rb +0 -0
- data/lib/sub_user/monitor_records.rb +0 -0
- data/lib/sub_user/parse.rb +0 -0
- data/lib/sub_user/spam.rb +0 -0
- data/lib/sub_user/stats.rb +0 -0
- data/lib/sub_user/unsubscribes.rb +0 -0
- data/lib/sub_user/white_label.rb +0 -0
- data/lib/subuser_client.rb +0 -0
- data/lib/version.rb +1 -1
- data/lib/web_api/blocks.rb +20 -7
- data/lib/web_api/bounces.rb +19 -6
- data/lib/web_api/event_notification.rb +0 -0
- data/lib/web_api/invalid_emails.rb +15 -5
- data/lib/web_api/mail.rb +0 -0
- data/lib/web_api/modules.rb +0 -0
- data/lib/web_api/parse.rb +0 -0
- data/lib/web_api/profile.rb +0 -0
- data/lib/web_api/spam.rb +14 -4
- data/lib/web_api/stats.rb +0 -0
- data/lib/web_api/unsubscribes.rb +19 -6
- data/lib/web_api/version.rb +0 -0
- data/lib/webapi_client.rb +0 -0
- data/sendgrid_webapi.gemspec +7 -1
- data/spec/cassettes/client/_modules/_block/should_get_block_emails.yml +1 -1
- data/spec/cassettes/client/_modules/_block/should_get_totals_blocks.yml +2 -2
- data/spec/cassettes/client/_modules/_block/should_try_delete_not_existing_block_email.yml +2 -2
- data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails.yml +1 -1
- data/spec/cassettes/client/_modules/_bounce/should_get_bounce_emails_using_params.yml +36 -0
- data/spec/cassettes/client/_modules/_bounce/should_get_totals_bounces.yml +0 -0
- data/spec/cassettes/client/_modules/_bounce/should_try_delete_not_existing_bounce_email.yml +2 -2
- data/spec/cassettes/client/_modules/_event_notification/should_delete_event_notification_url.yml +0 -0
- data/spec/cassettes/client/_modules/_event_notification/should_get_event_notification_url.yml +0 -0
- data/spec/cassettes/client/_modules/_event_notification/should_set_event_notification_url.yml +0 -0
- data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails.yml +1 -1
- data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails_emails_using_params.yml +37 -0
- data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails_using_params.yml +36 -0
- data/spec/cassettes/client/_modules/_invalid_email/should_try_delete_not_existing_invalid_emails.yml +2 -2
- data/spec/cassettes/client/_modules/_parse_email/should_delete_parse_email.yml +0 -0
- data/spec/cassettes/client/_modules/_parse_email/should_get_parse_email.yml +0 -0
- data/spec/cassettes/client/_modules/_parse_email/should_set_parse_email.yml +0 -0
- data/spec/cassettes/client/_modules/_profile/should_get_profile.yml +0 -0
- data/spec/cassettes/client/_modules/_profile/should_set_first_name.yml +0 -0
- data/spec/cassettes/client/_modules/_spam/should_get_spam_emails.yml +1 -1
- data/spec/cassettes/client/_modules/_spam/should_try_delete_not_existing_spam_emails.yml +2 -2
- data/spec/cassettes/client/_modules/_unsubscribe/should_add_unsubscribe_emails.yml +2 -2
- data/spec/cassettes/client/_modules/_unsubscribe/should_delete_unsubscribe_email.yml +2 -2
- data/spec/cassettes/client/_modules/_unsubscribe/should_get_unsubscribe_emails.yml +1 -1
- data/spec/cassettes/client/_modules/_unsubscribe/should_try_delete_not_existing_unsubscribe_emails.yml +3 -3
- data/spec/cassettes/helper/_create_sub_user_account/should_create_sub_user_account.yml +0 -0
- data/spec/cassettes/helper/_run_sendgrid_query/should_raise_with_unsucessfull_request.yml +0 -0
- data/spec/cassettes/helper/_run_sendgrid_query/should_run_sendgrid_request.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_activate_app.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_deactivate_app.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_get_current_setting_from_one_app.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_return_available_apps.yml +0 -0
- data/spec/cassettes/sub_user/_apps/should_set_current_app.yml +0 -0
- data/spec/cassettes/sub_user/_authentication/should_auth_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_authentication/should_return_error_with_a_bad_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_bounces/should_returns_bounce_emails.yml +0 -0
- data/spec/cassettes/sub_user/_bounces/should_tries_to_delete_unexisting_bounce_emails.yml +0 -0
- data/spec/cassettes/sub_user/_event_notification/should_add_event_notification_url.yml +0 -0
- data/spec/cassettes/sub_user/_event_notification/should_delete_event_notification_url.yml +0 -0
- data/spec/cassettes/sub_user/_event_notification/should_get_event_notification_url.yml +0 -0
- data/spec/cassettes/sub_user/_invalid_emails/should_return_invalid_emails.yml +0 -0
- data/spec/cassettes/sub_user/_invalid_emails/should_tries_to_delete_unexisting_invalid_mail.yml +0 -0
- data/spec/cassettes/sub_user/_ip_management/should_return_all_ips_available.yml +0 -0
- data/spec/cassettes/sub_user/_ip_management/should_show_ip_subuser.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_decrements_credits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_delete_all_limits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_increments_credits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_list_the_limits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_reset_all_limits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_returns_limits_for_a_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_limits/should_set_total_credits.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_add_new_subuser.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_disable_sub_user_for_send_email.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_enable_sub_user_for_access_to_website.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_enable_sub_user_for_send_email.yml +0 -0
- data/spec/cassettes/sub_user/_management/should_update_sub_user.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_add_existing_sub_user_to_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_create_a_new_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_delete_a_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_edit_a_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_monitor_records/should_remove_existing_sub_user_from_monitor_record.yml +0 -0
- data/spec/cassettes/sub_user/_parse_email/should_delete_parse_email.yml +0 -0
- data/spec/cassettes/sub_user/_parse_email/should_get_parse_email.yml +0 -0
- data/spec/cassettes/sub_user/_parse_email/should_set_parse_email.yml +0 -0
- data/spec/cassettes/sub_user/_spam/should_return_spam_mails.yml +0 -0
- data/spec/cassettes/sub_user/_spam/should_tries_to_delete_unexisting_spam_mail.yml +0 -0
- data/spec/cassettes/sub_user/_unsubscribes/should_add_bounce_email.yml +0 -0
- data/spec/cassettes/sub_user/_unsubscribes/should_delete_existing_bounce_email.yml +0 -0
- data/spec/cassettes/sub_user/_unsubscribes/should_delete_unexisting_bounce_email.yml +0 -0
- data/spec/cassettes/sub_user/_unsubscribes/should_returns_bounce_emails.yml +0 -0
- data/spec/client_spec.rb +68 -52
- data/spec/helper_spec.rb +2 -3
- data/spec/internal/config/database-standard.yml +24 -0
- data/spec/spec_helper.rb +0 -4
- data/spec/sub_user_spec.rb +0 -0
- data/test.rb +0 -0
- metadata +20 -81
- data/.circleci/config.yml +0 -132
- data/.circleci/setup-rubygems.sh +0 -5
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.sendgrid.com/v3/suppression/bounces?limit=2&offset=1
|
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:31 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: '["email1@test.com", "email2@test.com"]'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Fri, 17 Jan 2014 01:39:31 GMT
|
36
|
+
recorded_with: VCR 2.8.0
|
File without changes
|
data/spec/cassettes/client/_modules/_event_notification/should_delete_event_notification_url.yml
CHANGED
File without changes
|
data/spec/cassettes/client/_modules/_event_notification/should_get_event_notification_url.yml
CHANGED
File without changes
|
data/spec/cassettes/client/_modules/_event_notification/should_set_event_notification_url.yml
CHANGED
File without changes
|
data/spec/cassettes/client/_modules/_invalid_email/should_get_invalid_emails_emails_using_params.yml
ADDED
@@ -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
|
data/spec/cassettes/client/_modules/_invalid_email/should_try_delete_not_existing_invalid_emails.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri: https://api.sendgrid.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: ''
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,8 +1,8 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri: https://api.sendgrid.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:
|
5
|
-
uri: https://api.sendgrid.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: ''
|
@@ -1,8 +1,8 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
|
-
method:
|
5
|
-
uri: https://api.sendgrid.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":
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/cassettes/sub_user/_invalid_emails/should_tries_to_delete_unexisting_invalid_mail.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/cassettes/sub_user/_monitor_records/should_add_existing_sub_user_to_monitor_record.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
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.
|
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
|
-
|
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
|
-
|
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.
|
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(:
|
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.
|
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.
|
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(:
|
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.
|
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").
|
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.
|
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").
|
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(:
|
66
|
-
|
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
|
-
|
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
|
-
|
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(:
|
78
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
96
|
-
client.parse_email.get.
|
97
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
127
|
-
client.profile.get.first["first_name"].
|
128
|
-
|
129
|
-
client.profile.set(:first_name => "Reseller").
|
130
|
-
|
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 => {
|
34
|
-
:opentrack => {}
|
33
|
+
:clicktrack => {}
|
35
34
|
}
|
36
35
|
|
37
|
-
@users = {"test-6" => {:account => user_hash, :applications => apps, :assigned_ips => [
|
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
data/spec/sub_user_spec.rb
CHANGED
File without changes
|
data/test.rb
CHANGED
File without changes
|