Class: Tomba::Flag
Overview
Flag service for managing email flags.
Provides methods to list and create flags for email addresses.
Instance Method Summary collapse
-
#create_flag(email:, reason: nil) ⇒ Hash
Create Flag.
-
#list_flags(page: nil, limit: nil) ⇒ Hash
List Flags.
Methods inherited from Service
Constructor Details
This class inherits a constructor from Tomba::Service
Instance Method Details
#create_flag(email:, reason: nil) ⇒ Hash
Create Flag
Creates a new flag for an email address.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/tomba/services/flag.rb', line 40 def create_flag(email:, reason: nil) raise Tomba::Exception, 'Missing required parameter: "email"' if email.nil? path = '/flags' params = { email: email } params[:reason] = reason unless reason.nil? @client.call('post', path, { 'content-type' => 'application/json' }, params) end |
#list_flags(page: nil, limit: nil) ⇒ Hash
List Flags
Returns all flags associated with the account.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tomba/services/flag.rb', line 19 def list_flags(page: nil, limit: nil) path = '/flags' params = {} params[:page] = page unless page.nil? params[:limit] = limit unless limit.nil? @client.call('get', path, { 'content-type' => 'application/json' }, params) end |