Module: Mailtrap::BaseAPI

Included in:
ContactFieldsAPI, ContactImportsAPI, ContactListsAPI, ContactsAPI, EmailTemplatesAPI, SuppressionsAPI
Defined in:
lib/mailtrap/base_api.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



5
6
7
# File 'lib/mailtrap/base_api.rb', line 5

def 
  @account_id
end

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/mailtrap/base_api.rb', line 5

def client
  @client
end

Class Method Details

.included(base) ⇒ Object



7
8
9
# File 'lib/mailtrap/base_api.rb', line 7

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#initialize(account_id = ENV.fetch('MAILTRAP_ACCOUNT_ID'), client = Mailtrap::Client.new) ⇒ Object

Parameters:

  • account_id (Integer) (defaults to: ENV.fetch('MAILTRAP_ACCOUNT_ID'))

    The account ID

  • client (Mailtrap::Client) (defaults to: Mailtrap::Client.new)

    The client instance

Raises:

  • (ArgumentError)

    If account_id is nil



18
19
20
21
22
23
# File 'lib/mailtrap/base_api.rb', line 18

def initialize( = ENV.fetch('MAILTRAP_ACCOUNT_ID'), client = Mailtrap::Client.new)
  raise ArgumentError, 'account_id is required' if .nil?

  @account_id = 
  @client = client
end