emailguard_sdk 1.0.5 → 1.2.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 +4 -4
- data/LICENSE +21 -0
- data/README.md +16 -2
- data/examples/detect-email.rb +5 -0
- data/examples/get-billing-usage.rb +5 -0
- data/examples/get-team.rb +5 -0
- data/examples/list-notification-channels.rb +5 -0
- data/examples/list-pending-team-invites.rb +5 -0
- data/lib/emailguard_sdk/api/billing_api.rb +7 -7
- data/lib/emailguard_sdk/api/channels_api.rb +105 -105
- data/lib/emailguard_sdk/api/email_api.rb +11 -11
- data/lib/emailguard_sdk/api/events_api.rb +7 -7
- data/lib/emailguard_sdk/api/invites_api.rb +60 -60
- data/lib/emailguard_sdk/api/members_api.rb +27 -27
- data/lib/emailguard_sdk/api/rules_api.rb +71 -71
- data/lib/emailguard_sdk/api/teams_api.rb +14 -14
- data/lib/emailguard_sdk/api_client.rb +1 -1
- data/lib/emailguard_sdk/api_error.rb +1 -1
- data/lib/emailguard_sdk/api_model_base.rb +1 -1
- data/lib/emailguard_sdk/configuration.rb +3 -3
- data/lib/emailguard_sdk/facade.rb +191 -0
- data/lib/emailguard_sdk/models/base_response.rb +3 -3
- data/lib/emailguard_sdk/models/billing_usage_event.rb +1 -1
- data/lib/emailguard_sdk/models/billing_usage_item.rb +1 -1
- data/lib/emailguard_sdk/models/billing_usage_response.rb +3 -3
- data/lib/emailguard_sdk/models/create_notification_channel_input.rb +1 -1
- data/lib/emailguard_sdk/models/create_notification_rule_input.rb +1 -1
- data/lib/emailguard_sdk/models/email_detect_data.rb +68 -6
- data/lib/emailguard_sdk/models/email_detect_evidence.rb +1 -1
- data/lib/emailguard_sdk/models/email_detect_matched_rule.rb +165 -0
- data/lib/emailguard_sdk/models/email_detect_response.rb +3 -3
- data/lib/emailguard_sdk/models/get_notification_channel_response.rb +3 -3
- data/lib/emailguard_sdk/models/get_notification_channels_response.rb +3 -3
- data/lib/emailguard_sdk/models/get_notification_events_response.rb +3 -3
- data/lib/emailguard_sdk/models/get_notification_rules_response.rb +3 -3
- data/lib/emailguard_sdk/models/get_public_team_response.rb +3 -3
- data/lib/emailguard_sdk/models/id_data_response.rb +3 -3
- data/lib/emailguard_sdk/models/id_data_struct.rb +1 -1
- data/lib/emailguard_sdk/models/invite_team_member_input.rb +1 -1
- data/lib/emailguard_sdk/models/list_public_team_invites_response.rb +3 -3
- data/lib/emailguard_sdk/models/list_public_team_members_response.rb +3 -3
- data/lib/emailguard_sdk/models/message_response.rb +3 -3
- data/lib/emailguard_sdk/models/notification_channel_response.rb +1 -1
- data/lib/emailguard_sdk/models/notification_rule_channel_input.rb +1 -1
- data/lib/emailguard_sdk/models/notification_rule_channel_response.rb +1 -1
- data/lib/emailguard_sdk/models/notification_rule_response.rb +1 -1
- data/lib/emailguard_sdk/models/public_team_invite_response.rb +1 -1
- data/lib/emailguard_sdk/models/public_team_member_response.rb +1 -1
- data/lib/emailguard_sdk/models/public_team_response.rb +1 -1
- data/lib/emailguard_sdk/models/{update_team_member_input.rb → public_update_team_member_input.rb} +5 -32
- data/lib/emailguard_sdk/models/update_notification_channel_input.rb +1 -1
- data/lib/emailguard_sdk/models/update_notification_rule_input.rb +1 -1
- data/lib/emailguard_sdk/models/update_team_input.rb +1 -1
- data/lib/emailguard_sdk/version.rb +2 -2
- data/lib/emailguard_sdk.rb +4 -2
- data/spec/facade_contract_spec.rb +340 -0
- data/spec/spec_helper.rb +1 -111
- metadata +15 -126
- data/Gemfile +0 -9
- data/Rakefile +0 -10
- data/docs/BaseResponse.md +0 -20
- data/docs/BillingApi.md +0 -85
- data/docs/BillingUsageEvent.md +0 -26
- data/docs/BillingUsageItem.md +0 -28
- data/docs/BillingUsageResponse.md +0 -22
- data/docs/ChannelsApi.md +0 -366
- data/docs/CreateNotificationChannelInput.md +0 -22
- data/docs/CreateNotificationRuleInput.md +0 -28
- data/docs/EmailApi.md +0 -72
- data/docs/EmailDetectData.md +0 -48
- data/docs/EmailDetectEvidence.md +0 -22
- data/docs/EmailDetectResponse.md +0 -22
- data/docs/EventsApi.md +0 -76
- data/docs/GetNotificationChannelResponse.md +0 -22
- data/docs/GetNotificationChannelsResponse.md +0 -22
- data/docs/GetNotificationEventsResponse.md +0 -22
- data/docs/GetNotificationRulesResponse.md +0 -22
- data/docs/GetPublicTeamResponse.md +0 -22
- data/docs/IdDataResponse.md +0 -22
- data/docs/IdDataStruct.md +0 -18
- data/docs/InviteTeamMemberInput.md +0 -20
- data/docs/InvitesApi.md +0 -220
- data/docs/ListPublicTeamInvitesResponse.md +0 -22
- data/docs/ListPublicTeamMembersResponse.md +0 -22
- data/docs/MembersApi.md +0 -222
- data/docs/MessageResponse.md +0 -20
- data/docs/NotificationChannelResponse.md +0 -28
- data/docs/NotificationRuleChannelInput.md +0 -22
- data/docs/NotificationRuleChannelResponse.md +0 -28
- data/docs/NotificationRuleResponse.md +0 -32
- data/docs/PublicTeamInviteResponse.md +0 -24
- data/docs/PublicTeamMemberResponse.md +0 -34
- data/docs/PublicTeamResponse.md +0 -28
- data/docs/RulesApi.md +0 -294
- data/docs/TeamsApi.md +0 -148
- data/docs/UpdateNotificationChannelInput.md +0 -20
- data/docs/UpdateNotificationRuleInput.md +0 -28
- data/docs/UpdateTeamInput.md +0 -24
- data/docs/UpdateTeamMemberInput.md +0 -22
- data/emailguard_sdk.gemspec +0 -44
- data/git_push.sh +0 -57
- data/spec/api/billing_api_spec.rb +0 -49
- data/spec/api/channels_api_spec.rb +0 -95
- data/spec/api/email_api_spec.rb +0 -47
- data/spec/api/events_api_spec.rb +0 -46
- data/spec/api/invites_api_spec.rb +0 -70
- data/spec/api/members_api_spec.rb +0 -71
- data/spec/api/rules_api_spec.rb +0 -83
- data/spec/api/teams_api_spec.rb +0 -58
- data/spec/models/base_response_spec.rb +0 -42
- data/spec/models/billing_usage_event_spec.rb +0 -60
- data/spec/models/billing_usage_item_spec.rb +0 -66
- data/spec/models/billing_usage_response_spec.rb +0 -48
- data/spec/models/create_notification_channel_input_spec.rb +0 -48
- data/spec/models/create_notification_rule_input_spec.rb +0 -66
- data/spec/models/email_detect_data_spec.rb +0 -126
- data/spec/models/email_detect_evidence_spec.rb +0 -48
- data/spec/models/email_detect_response_spec.rb +0 -48
- data/spec/models/get_notification_channel_response_spec.rb +0 -48
- data/spec/models/get_notification_channels_response_spec.rb +0 -48
- data/spec/models/get_notification_events_response_spec.rb +0 -48
- data/spec/models/get_notification_rules_response_spec.rb +0 -48
- data/spec/models/get_public_team_response_spec.rb +0 -48
- data/spec/models/id_data_response_spec.rb +0 -48
- data/spec/models/id_data_struct_spec.rb +0 -36
- data/spec/models/invite_team_member_input_spec.rb +0 -42
- data/spec/models/list_public_team_invites_response_spec.rb +0 -48
- data/spec/models/list_public_team_members_response_spec.rb +0 -48
- data/spec/models/message_response_spec.rb +0 -42
- data/spec/models/notification_channel_response_spec.rb +0 -66
- data/spec/models/notification_rule_channel_input_spec.rb +0 -48
- data/spec/models/notification_rule_channel_response_spec.rb +0 -66
- data/spec/models/notification_rule_response_spec.rb +0 -78
- data/spec/models/public_team_invite_response_spec.rb +0 -54
- data/spec/models/public_team_member_response_spec.rb +0 -84
- data/spec/models/public_team_response_spec.rb +0 -66
- data/spec/models/update_notification_channel_input_spec.rb +0 -42
- data/spec/models/update_notification_rule_input_spec.rb +0 -66
- data/spec/models/update_team_input_spec.rb +0 -54
- data/spec/models/update_team_member_input_spec.rb +0 -48
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -15,10 +15,10 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module Emailguard
|
|
17
17
|
class MessageResponse < ApiModelBase
|
|
18
|
-
# Machine-readable status code (for example
|
|
18
|
+
# Machine-readable status code (for example SUCCESS or INVALID_BODY).
|
|
19
19
|
attr_accessor :code
|
|
20
20
|
|
|
21
|
-
# Human-readable detail when the code is not
|
|
21
|
+
# Human-readable detail when the code is not SUCCESS.
|
|
22
22
|
attr_accessor :message
|
|
23
23
|
|
|
24
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
data/lib/emailguard_sdk/models/{update_team_member_input.rb → public_update_team_member_input.rb}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -14,10 +14,7 @@ require 'date'
|
|
|
14
14
|
require 'time'
|
|
15
15
|
|
|
16
16
|
module Emailguard
|
|
17
|
-
class
|
|
18
|
-
# Internal team member record ID. When calling the public API, this is set from the path userId.
|
|
19
|
-
attr_accessor :id
|
|
20
|
-
|
|
17
|
+
class PublicUpdateTeamMemberInput < ApiModelBase
|
|
21
18
|
# Internal notes about the member. Omit to leave unchanged.
|
|
22
19
|
attr_accessor :notes
|
|
23
20
|
|
|
@@ -27,7 +24,6 @@ module Emailguard
|
|
|
27
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
28
25
|
def self.attribute_map
|
|
29
26
|
{
|
|
30
|
-
:'id' => :'id',
|
|
31
27
|
:'notes' => :'notes',
|
|
32
28
|
:'role' => :'role'
|
|
33
29
|
}
|
|
@@ -46,7 +42,6 @@ module Emailguard
|
|
|
46
42
|
# Attribute type mapping.
|
|
47
43
|
def self.openapi_types
|
|
48
44
|
{
|
|
49
|
-
:'id' => :'String',
|
|
50
45
|
:'notes' => :'String',
|
|
51
46
|
:'role' => :'String'
|
|
52
47
|
}
|
|
@@ -62,24 +57,18 @@ module Emailguard
|
|
|
62
57
|
# @param [Hash] attributes Model attributes in the form of hash
|
|
63
58
|
def initialize(attributes = {})
|
|
64
59
|
if (!attributes.is_a?(Hash))
|
|
65
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `Emailguard::
|
|
60
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Emailguard::PublicUpdateTeamMemberInput` initialize method"
|
|
66
61
|
end
|
|
67
62
|
|
|
68
63
|
# check to see if the attribute exists and convert string to symbol for hash key
|
|
69
64
|
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
70
65
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
71
66
|
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
72
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `Emailguard::
|
|
67
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Emailguard::PublicUpdateTeamMemberInput`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
73
68
|
end
|
|
74
69
|
h[k.to_sym] = v
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
if attributes.key?(:'id')
|
|
78
|
-
self.id = attributes[:'id']
|
|
79
|
-
else
|
|
80
|
-
self.id = nil
|
|
81
|
-
end
|
|
82
|
-
|
|
83
72
|
if attributes.key?(:'notes')
|
|
84
73
|
self.notes = attributes[:'notes']
|
|
85
74
|
end
|
|
@@ -94,10 +83,6 @@ module Emailguard
|
|
|
94
83
|
def list_invalid_properties
|
|
95
84
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
96
85
|
invalid_properties = Array.new
|
|
97
|
-
if @id.nil?
|
|
98
|
-
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
|
99
|
-
end
|
|
100
|
-
|
|
101
86
|
invalid_properties
|
|
102
87
|
end
|
|
103
88
|
|
|
@@ -105,26 +90,14 @@ module Emailguard
|
|
|
105
90
|
# @return true if the model is valid
|
|
106
91
|
def valid?
|
|
107
92
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
108
|
-
return false if @id.nil?
|
|
109
93
|
true
|
|
110
94
|
end
|
|
111
95
|
|
|
112
|
-
# Custom attribute writer method with validation
|
|
113
|
-
# @param [Object] id Value to be assigned
|
|
114
|
-
def id=(id)
|
|
115
|
-
if id.nil?
|
|
116
|
-
fail ArgumentError, 'id cannot be nil'
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
@id = id
|
|
120
|
-
end
|
|
121
|
-
|
|
122
96
|
# Checks equality by comparing each attribute.
|
|
123
97
|
# @param [Object] Object to be compared
|
|
124
98
|
def ==(o)
|
|
125
99
|
return true if self.equal?(o)
|
|
126
100
|
self.class == o.class &&
|
|
127
|
-
id == o.id &&
|
|
128
101
|
notes == o.notes &&
|
|
129
102
|
role == o.role
|
|
130
103
|
end
|
|
@@ -138,7 +111,7 @@ module Emailguard
|
|
|
138
111
|
# Calculates hash code according to all attributes.
|
|
139
112
|
# @return [Integer] Hash code
|
|
140
113
|
def hash
|
|
141
|
-
[
|
|
114
|
+
[notes, role].hash
|
|
142
115
|
end
|
|
143
116
|
|
|
144
117
|
# Builds the object from hash
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -11,5 +11,5 @@ Generator version: 7.23.0
|
|
|
11
11
|
=end
|
|
12
12
|
|
|
13
13
|
module Emailguard
|
|
14
|
-
VERSION = '1.0
|
|
14
|
+
VERSION = '1.2.0'
|
|
15
15
|
end
|
data/lib/emailguard_sdk.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#Team-scoped REST API at /api/v1. Authenticate with `Authorization: Bearer egsk_live_...` or `X-API-Key`. Forks may register custom routes under /api/v1/tools/* (requires `tools:read` / `tools:write` scopes). Async tool jobs return a `job_id` — poll `GET .../{jobId}/results` until complete. See /docs/api-reference.
|
|
5
5
|
|
|
6
|
-
The version of the OpenAPI document: 1.
|
|
6
|
+
The version of the OpenAPI document: 1.3
|
|
7
7
|
Contact: dev@emailguard.co
|
|
8
8
|
Generated by: https://openapi-generator.tech
|
|
9
9
|
Generator version: 7.23.0
|
|
@@ -26,6 +26,7 @@ require 'emailguard_sdk/models/create_notification_channel_input'
|
|
|
26
26
|
require 'emailguard_sdk/models/create_notification_rule_input'
|
|
27
27
|
require 'emailguard_sdk/models/email_detect_data'
|
|
28
28
|
require 'emailguard_sdk/models/email_detect_evidence'
|
|
29
|
+
require 'emailguard_sdk/models/email_detect_matched_rule'
|
|
29
30
|
require 'emailguard_sdk/models/email_detect_response'
|
|
30
31
|
require 'emailguard_sdk/models/get_notification_channel_response'
|
|
31
32
|
require 'emailguard_sdk/models/get_notification_channels_response'
|
|
@@ -45,10 +46,10 @@ require 'emailguard_sdk/models/notification_rule_response'
|
|
|
45
46
|
require 'emailguard_sdk/models/public_team_invite_response'
|
|
46
47
|
require 'emailguard_sdk/models/public_team_member_response'
|
|
47
48
|
require 'emailguard_sdk/models/public_team_response'
|
|
49
|
+
require 'emailguard_sdk/models/public_update_team_member_input'
|
|
48
50
|
require 'emailguard_sdk/models/update_notification_channel_input'
|
|
49
51
|
require 'emailguard_sdk/models/update_notification_rule_input'
|
|
50
52
|
require 'emailguard_sdk/models/update_team_input'
|
|
51
|
-
require 'emailguard_sdk/models/update_team_member_input'
|
|
52
53
|
|
|
53
54
|
# APIs
|
|
54
55
|
require 'emailguard_sdk/api/billing_api'
|
|
@@ -77,3 +78,4 @@ module Emailguard
|
|
|
77
78
|
end
|
|
78
79
|
end
|
|
79
80
|
end
|
|
81
|
+
require 'emailguard_sdk/facade'
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
require 'emailguard_sdk'
|
|
2
|
+
|
|
3
|
+
RSpec.describe Emailguard::Client do
|
|
4
|
+
let(:client) { described_class.new(api_key: "test-key", base_url: "https://api.example.test") }
|
|
5
|
+
|
|
6
|
+
it "cancelPendingInvite" do
|
|
7
|
+
response = Typhoeus::Response.new(
|
|
8
|
+
code: 200,
|
|
9
|
+
headers: { "Content-Type" => "application/json" },
|
|
10
|
+
body: "{\"code\":\"SUCCESS\",\"message\":\"ok\"}"
|
|
11
|
+
)
|
|
12
|
+
Typhoeus.stub(
|
|
13
|
+
"https://api.example.test/api/v1/team/members/invites/example",
|
|
14
|
+
method: :delete
|
|
15
|
+
).and_return(response)
|
|
16
|
+
result = client.invites.cancel_pending_invite(invite_id: "example")
|
|
17
|
+
expect(result).to be_nil
|
|
18
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "createNotificationChannel" do
|
|
22
|
+
response = Typhoeus::Response.new(
|
|
23
|
+
code: 200,
|
|
24
|
+
headers: { "Content-Type" => "application/json" },
|
|
25
|
+
body: "{\"code\":\"SUCCESS\",\"data\":{\"config\":{},\"created_at\":\"example\",\"id\":\"example\",\"is_verified\":false,\"name\":\"example\",\"type\":\"example\"},\"message\":\"ok\"}"
|
|
26
|
+
)
|
|
27
|
+
Typhoeus.stub(
|
|
28
|
+
"https://api.example.test/api/v1/team/notifications/channels",
|
|
29
|
+
method: :post
|
|
30
|
+
).and_return(response)
|
|
31
|
+
result = client.channels.create_notification_channel(input: Emailguard::CreateNotificationChannelInput.new({ name: "example", type: "example" }))
|
|
32
|
+
expect(result).to be_a(Emailguard::NotificationChannelResponse)
|
|
33
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "createNotificationRule" do
|
|
37
|
+
response = Typhoeus::Response.new(
|
|
38
|
+
code: 200,
|
|
39
|
+
headers: { "Content-Type" => "application/json" },
|
|
40
|
+
body: "{\"code\":\"SUCCESS\",\"data\":{\"id\":\"example\"},\"message\":\"ok\"}"
|
|
41
|
+
)
|
|
42
|
+
Typhoeus.stub(
|
|
43
|
+
"https://api.example.test/api/v1/team/notifications/rules",
|
|
44
|
+
method: :post
|
|
45
|
+
).and_return(response)
|
|
46
|
+
result = client.rules.create_notification_rule(input: Emailguard::CreateNotificationRuleInput.new({ channels: [Emailguard::NotificationRuleChannelInput.new({ })], event_types: ["example"], name: "example" }))
|
|
47
|
+
expect(result).to be_a(Emailguard::IdDataStruct)
|
|
48
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "deleteNotificationChannel" do
|
|
52
|
+
response = Typhoeus::Response.new(
|
|
53
|
+
code: 200,
|
|
54
|
+
headers: { "Content-Type" => "application/json" },
|
|
55
|
+
body: "{\"code\":\"SUCCESS\",\"message\":\"ok\"}"
|
|
56
|
+
)
|
|
57
|
+
Typhoeus.stub(
|
|
58
|
+
"https://api.example.test/api/v1/team/notifications/channels/example",
|
|
59
|
+
method: :delete
|
|
60
|
+
).and_return(response)
|
|
61
|
+
result = client.channels.delete_notification_channel(channel_id: "example")
|
|
62
|
+
expect(result).to be_nil
|
|
63
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "deleteNotificationRule" do
|
|
67
|
+
response = Typhoeus::Response.new(
|
|
68
|
+
code: 200,
|
|
69
|
+
headers: { "Content-Type" => "application/json" },
|
|
70
|
+
body: "{\"code\":\"SUCCESS\",\"message\":\"ok\"}"
|
|
71
|
+
)
|
|
72
|
+
Typhoeus.stub(
|
|
73
|
+
"https://api.example.test/api/v1/team/notifications/rules/example",
|
|
74
|
+
method: :delete
|
|
75
|
+
).and_return(response)
|
|
76
|
+
result = client.rules.delete_notification_rule(rule_id: "example")
|
|
77
|
+
expect(result).to be_nil
|
|
78
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it "detectEmail" do
|
|
82
|
+
response = Typhoeus::Response.new(
|
|
83
|
+
code: 200,
|
|
84
|
+
headers: { "Content-Type" => "application/json" },
|
|
85
|
+
body: "{\"code\":\"SUCCESS\",\"data\":{\"confidence\":\"example\",\"detection_source\":\"example\",\"disposable\":false,\"disposable_provider\":\"example\",\"domain\":\"example\",\"email\":\"example\",\"evidence\":{\"cluster_provider\":\"example\",\"detection_layer\":\"example\",\"source_count\":0},\"infra_cluster_match\":false,\"matched_rules\":[],\"mx_present\":false,\"normalized\":\"example\",\"policy_action\":\"example\",\"public_domain\":false,\"relay_domain\":false,\"relay_provider\":\"example\",\"role_address\":false,\"subaddressing\":false,\"suggested_action\":\"example\",\"suggested_domain\":\"example\",\"suggested_email\":\"example\",\"syntax_validation\":false,\"wildcard_dns\":false},\"message\":\"ok\"}"
|
|
86
|
+
)
|
|
87
|
+
Typhoeus.stub(
|
|
88
|
+
"https://api.example.test/api/v1/emails/detect",
|
|
89
|
+
method: :get
|
|
90
|
+
).and_return(response)
|
|
91
|
+
result = client.email.detect_email(email: "example")
|
|
92
|
+
expect(result).to be_a(Emailguard::EmailDetectData)
|
|
93
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "getBillingUsage" do
|
|
97
|
+
response = Typhoeus::Response.new(
|
|
98
|
+
code: 200,
|
|
99
|
+
headers: { "Content-Type" => "application/json" },
|
|
100
|
+
body: "{\"code\":\"SUCCESS\",\"data\":[],\"message\":\"ok\"}"
|
|
101
|
+
)
|
|
102
|
+
Typhoeus.stub(
|
|
103
|
+
"https://api.example.test/api/v1/team/billing/usage",
|
|
104
|
+
method: :get
|
|
105
|
+
).and_return(response)
|
|
106
|
+
result = client.billing.get_billing_usage()
|
|
107
|
+
expect(result).not_to be_nil
|
|
108
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "getTeam" do
|
|
112
|
+
response = Typhoeus::Response.new(
|
|
113
|
+
code: 200,
|
|
114
|
+
headers: { "Content-Type" => "application/json" },
|
|
115
|
+
body: "{\"code\":\"SUCCESS\",\"data\":{\"email\":\"example\",\"emoji\":\"example\",\"id\":\"example\",\"name\":\"example\",\"type\":\"example\",\"url\":\"example\"},\"message\":\"ok\"}"
|
|
116
|
+
)
|
|
117
|
+
Typhoeus.stub(
|
|
118
|
+
"https://api.example.test/api/v1/team",
|
|
119
|
+
method: :get
|
|
120
|
+
).and_return(response)
|
|
121
|
+
result = client.teams.get_team()
|
|
122
|
+
expect(result).to be_a(Emailguard::PublicTeamResponse)
|
|
123
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it "inviteTeamMember" do
|
|
127
|
+
response = Typhoeus::Response.new(
|
|
128
|
+
code: 200,
|
|
129
|
+
headers: { "Content-Type" => "application/json" },
|
|
130
|
+
body: "{\"code\":\"SUCCESS\",\"message\":\"ok\"}"
|
|
131
|
+
)
|
|
132
|
+
Typhoeus.stub(
|
|
133
|
+
"https://api.example.test/api/v1/team/members/invites",
|
|
134
|
+
method: :post
|
|
135
|
+
).and_return(response)
|
|
136
|
+
result = client.invites.invite_team_member(input: Emailguard::InviteTeamMemberInput.new({ email: "example", role: "example" }))
|
|
137
|
+
expect(result).to be_nil
|
|
138
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "listNotificationChannels" do
|
|
142
|
+
response = Typhoeus::Response.new(
|
|
143
|
+
code: 200,
|
|
144
|
+
headers: { "Content-Type" => "application/json" },
|
|
145
|
+
body: "{\"code\":\"SUCCESS\",\"data\":[],\"message\":\"ok\"}"
|
|
146
|
+
)
|
|
147
|
+
Typhoeus.stub(
|
|
148
|
+
"https://api.example.test/api/v1/team/notifications/channels",
|
|
149
|
+
method: :get
|
|
150
|
+
).and_return(response)
|
|
151
|
+
result = client.channels.list_notification_channels()
|
|
152
|
+
expect(result).not_to be_nil
|
|
153
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
it "listNotificationEvents" do
|
|
157
|
+
response = Typhoeus::Response.new(
|
|
158
|
+
code: 200,
|
|
159
|
+
headers: { "Content-Type" => "application/json" },
|
|
160
|
+
body: "{\"code\":\"SUCCESS\",\"data\":[],\"message\":\"ok\"}"
|
|
161
|
+
)
|
|
162
|
+
Typhoeus.stub(
|
|
163
|
+
"https://api.example.test/api/v1/team/notifications/events",
|
|
164
|
+
method: :get
|
|
165
|
+
).and_return(response)
|
|
166
|
+
result = client.events.list_notification_events()
|
|
167
|
+
expect(result).not_to be_nil
|
|
168
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it "listNotificationRules" do
|
|
172
|
+
response = Typhoeus::Response.new(
|
|
173
|
+
code: 200,
|
|
174
|
+
headers: { "Content-Type" => "application/json" },
|
|
175
|
+
body: "{\"code\":\"SUCCESS\",\"data\":[],\"message\":\"ok\"}"
|
|
176
|
+
)
|
|
177
|
+
Typhoeus.stub(
|
|
178
|
+
"https://api.example.test/api/v1/team/notifications/rules",
|
|
179
|
+
method: :get
|
|
180
|
+
).and_return(response)
|
|
181
|
+
result = client.rules.list_notification_rules()
|
|
182
|
+
expect(result).not_to be_nil
|
|
183
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
it "listPendingTeamInvites" do
|
|
187
|
+
response = Typhoeus::Response.new(
|
|
188
|
+
code: 200,
|
|
189
|
+
headers: { "Content-Type" => "application/json" },
|
|
190
|
+
body: "{\"code\":\"SUCCESS\",\"data\":[],\"message\":\"ok\"}"
|
|
191
|
+
)
|
|
192
|
+
Typhoeus.stub(
|
|
193
|
+
"https://api.example.test/api/v1/team/members/invites",
|
|
194
|
+
method: :get
|
|
195
|
+
).and_return(response)
|
|
196
|
+
result = client.invites.list_pending_team_invites()
|
|
197
|
+
expect(result).not_to be_nil
|
|
198
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
it "listTeamMembers" do
|
|
202
|
+
response = Typhoeus::Response.new(
|
|
203
|
+
code: 200,
|
|
204
|
+
headers: { "Content-Type" => "application/json" },
|
|
205
|
+
body: "{\"code\":\"SUCCESS\",\"data\":[],\"message\":\"ok\"}"
|
|
206
|
+
)
|
|
207
|
+
Typhoeus.stub(
|
|
208
|
+
"https://api.example.test/api/v1/team/members",
|
|
209
|
+
method: :get
|
|
210
|
+
).and_return(response)
|
|
211
|
+
result = client.members.list_team_members()
|
|
212
|
+
expect(result).not_to be_nil
|
|
213
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
it "removeTeamMember" do
|
|
217
|
+
response = Typhoeus::Response.new(
|
|
218
|
+
code: 200,
|
|
219
|
+
headers: { "Content-Type" => "application/json" },
|
|
220
|
+
body: "{\"code\":\"SUCCESS\",\"message\":\"ok\"}"
|
|
221
|
+
)
|
|
222
|
+
Typhoeus.stub(
|
|
223
|
+
"https://api.example.test/api/v1/team/members/example",
|
|
224
|
+
method: :delete
|
|
225
|
+
).and_return(response)
|
|
226
|
+
result = client.members.remove_team_member(user_id: "example")
|
|
227
|
+
expect(result).to be_nil
|
|
228
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
it "testNotificationChannel" do
|
|
232
|
+
response = Typhoeus::Response.new(
|
|
233
|
+
code: 200,
|
|
234
|
+
headers: { "Content-Type" => "application/json" },
|
|
235
|
+
body: "{\"code\":\"SUCCESS\",\"message\":\"ok\"}"
|
|
236
|
+
)
|
|
237
|
+
Typhoeus.stub(
|
|
238
|
+
"https://api.example.test/api/v1/team/notifications/channels/example/test",
|
|
239
|
+
method: :post
|
|
240
|
+
).and_return(response)
|
|
241
|
+
result = client.channels.test_notification_channel(channel_id: "example")
|
|
242
|
+
expect(result).to be_nil
|
|
243
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
it "updateNotificationChannel" do
|
|
247
|
+
response = Typhoeus::Response.new(
|
|
248
|
+
code: 200,
|
|
249
|
+
headers: { "Content-Type" => "application/json" },
|
|
250
|
+
body: "{\"code\":\"SUCCESS\",\"data\":{\"config\":{},\"created_at\":\"example\",\"id\":\"example\",\"is_verified\":false,\"name\":\"example\",\"type\":\"example\"},\"message\":\"ok\"}"
|
|
251
|
+
)
|
|
252
|
+
Typhoeus.stub(
|
|
253
|
+
"https://api.example.test/api/v1/team/notifications/channels/example",
|
|
254
|
+
method: :put
|
|
255
|
+
).and_return(response)
|
|
256
|
+
result = client.channels.update_notification_channel(channel_id: "example", input: Emailguard::UpdateNotificationChannelInput.new({ }))
|
|
257
|
+
expect(result).to be_a(Emailguard::NotificationChannelResponse)
|
|
258
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
it "updateNotificationRule" do
|
|
262
|
+
response = Typhoeus::Response.new(
|
|
263
|
+
code: 200,
|
|
264
|
+
headers: { "Content-Type" => "application/json" },
|
|
265
|
+
body: "{\"code\":\"SUCCESS\",\"message\":\"ok\"}"
|
|
266
|
+
)
|
|
267
|
+
Typhoeus.stub(
|
|
268
|
+
"https://api.example.test/api/v1/team/notifications/rules/example",
|
|
269
|
+
method: :put
|
|
270
|
+
).and_return(response)
|
|
271
|
+
result = client.rules.update_notification_rule(rule_id: "example", input: Emailguard::UpdateNotificationRuleInput.new({ }))
|
|
272
|
+
expect(result).to be_nil
|
|
273
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
it "updateTeam" do
|
|
277
|
+
response = Typhoeus::Response.new(
|
|
278
|
+
code: 200,
|
|
279
|
+
headers: { "Content-Type" => "application/json" },
|
|
280
|
+
body: "{\"code\":\"SUCCESS\",\"data\":{\"email\":\"example\",\"emoji\":\"example\",\"id\":\"example\",\"name\":\"example\",\"type\":\"example\",\"url\":\"example\"},\"message\":\"ok\"}"
|
|
281
|
+
)
|
|
282
|
+
Typhoeus.stub(
|
|
283
|
+
"https://api.example.test/api/v1/team",
|
|
284
|
+
method: :patch
|
|
285
|
+
).and_return(response)
|
|
286
|
+
result = client.teams.update_team(input: Emailguard::UpdateTeamInput.new({ name: "example" }))
|
|
287
|
+
expect(result).to be_a(Emailguard::PublicTeamResponse)
|
|
288
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
it "updateTeamMember" do
|
|
292
|
+
response = Typhoeus::Response.new(
|
|
293
|
+
code: 200,
|
|
294
|
+
headers: { "Content-Type" => "application/json" },
|
|
295
|
+
body: "{\"code\":\"SUCCESS\",\"message\":\"ok\"}"
|
|
296
|
+
)
|
|
297
|
+
Typhoeus.stub(
|
|
298
|
+
"https://api.example.test/api/v1/team/members/example",
|
|
299
|
+
method: :patch
|
|
300
|
+
).and_return(response)
|
|
301
|
+
result = client.members.update_team_member(user_id: "example", input: Emailguard::PublicUpdateTeamMemberInput.new({ }))
|
|
302
|
+
expect(result).to be_nil
|
|
303
|
+
expect(response.request.options[:headers]["Authorization"]).to eq("Bearer test-key")
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
it "normalizes response errors" do
|
|
307
|
+
url = "https://api.example.test/api/v1/emails/detect"
|
|
308
|
+
|
|
309
|
+
Typhoeus.stub(url, method: :get).and_return(
|
|
310
|
+
Typhoeus::Response.new(code: 429, headers: { "Content-Type" => "application/json" }, body: '{"code":"RATE_LIMITED","message":"Slow down"}')
|
|
311
|
+
)
|
|
312
|
+
expect { client.email.detect_email(email: "example") }.to raise_error(Emailguard::APIError) { |error| expect(error.status).to eq(429) }
|
|
313
|
+
|
|
314
|
+
Typhoeus.stub(url, method: :get).and_return(
|
|
315
|
+
Typhoeus::Response.new(code: 200, headers: { "Content-Type" => "application/json" }, body: "{\"code\":\"DENIED\",\"message\":\"Not allowed\",\"data\":{\"confidence\":\"example\",\"detection_source\":\"example\",\"disposable\":false,\"disposable_provider\":\"example\",\"domain\":\"example\",\"email\":\"example\",\"evidence\":{\"cluster_provider\":\"example\",\"detection_layer\":\"example\",\"source_count\":0},\"infra_cluster_match\":false,\"matched_rules\":[],\"mx_present\":false,\"normalized\":\"example\",\"policy_action\":\"example\",\"public_domain\":false,\"relay_domain\":false,\"relay_provider\":\"example\",\"role_address\":false,\"subaddressing\":false,\"suggested_action\":\"example\",\"suggested_domain\":\"example\",\"suggested_email\":\"example\",\"syntax_validation\":false,\"wildcard_dns\":false}}")
|
|
316
|
+
)
|
|
317
|
+
expect { client.email.detect_email(email: "example") }.to raise_error(Emailguard::APIError) { |error| expect(error.code).to eq("DENIED") }
|
|
318
|
+
|
|
319
|
+
Typhoeus.stub(url, method: :get).and_return(
|
|
320
|
+
Typhoeus::Response.new(code: 200, headers: { "Content-Type" => "application/json" }, body: "{")
|
|
321
|
+
)
|
|
322
|
+
expect { client.email.detect_email(email: "example") }.to raise_error(Emailguard::APIError) { |error| expect(error.code).to eq("INVALID_RESPONSE") }
|
|
323
|
+
|
|
324
|
+
Typhoeus.stub(url, method: :get).and_return(
|
|
325
|
+
Typhoeus::Response.new(code: 200, headers: { "Content-Type" => "application/json" }, body: '{"code":"SUCCESS","message":"ok"}')
|
|
326
|
+
)
|
|
327
|
+
expect { client.email.detect_email(email: "example") }.to raise_error(Emailguard::APIError) { |error| expect(error.code).to eq("INVALID_RESPONSE") }
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
it "returns nil for message-only success" do
|
|
331
|
+
Typhoeus.stub(
|
|
332
|
+
"https://api.example.test/api/v1/team/members/invites/example",
|
|
333
|
+
method: :delete
|
|
334
|
+
).and_return(
|
|
335
|
+
Typhoeus::Response.new(code: 200, headers: { "Content-Type" => "application/json" }, body: '{"code":"SUCCESS","message":"ok"}')
|
|
336
|
+
)
|
|
337
|
+
expect(client.invites.cancel_pending_invite(invite_id: "example")).to be_nil
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
end
|