Class: Mailtrap::AccountsAPI

Inherits:
Object
  • Object
show all
Includes:
BaseAPI
Defined in:
lib/mailtrap/accounts_api.rb

Instance Attribute Summary collapse

Attributes included from BaseAPI

#account_id

Instance Method Summary collapse

Methods included from BaseAPI

included

Constructor Details

#initialize(client = Mailtrap::Client.new) ⇒ AccountsAPI

Returns a new instance of AccountsAPI.

Raises:

  • If account_id is nil

Parameters:

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

    The client instance



16
17
18
# File 'lib/mailtrap/accounts_api.rb', line 16

def initialize(client = Mailtrap::Client.new)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



12
13
14
# File 'lib/mailtrap/accounts_api.rb', line 12

def client
  @client
end

Instance Method Details

#listArray<Account>

Lists all accounts

Raises:

  • If the API request fails with a client or server error

  • If the API key is invalid

  • If the server refuses to process the request

  • If too many requests are made

Returns:

  • Array of accounts



23
24
25
# File 'lib/mailtrap/accounts_api.rb', line 23

def list
  base_list
end