Class: MailUp::Console::User

Inherits:
Object
  • Object
show all
Defined in:
lib/mailup/console/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ User

Returns a new instance of User.



6
7
8
# File 'lib/mailup/console/user.rb', line 6

def initialize(api)
    @api = api
end

Instance Attribute Details

#apiObject

Returns the value of attribute api.



4
5
6
# File 'lib/mailup/console/user.rb', line 4

def api
  @api
end

Instance Method Details

#emails(params = {}) ⇒ JSON

Retrieve the email messages (cloned and not cloned) for the current user.

Examples:


emails = mailup.console.user.emails
emails['TotalElementsCount']
=> 10
emails['Items'].first['Subject']
=> "Test Subject"

emails = mailup.console.user.emails(pageNumber: 0, pageSize: 1)

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



71
72
73
# File 'lib/mailup/console/user.rb', line 71

def emails(params={})
  @api.get("#{@api.path}/User/Emails", params: params)
end

#lists(params = {}) ⇒ JSON

Retrieve the admin console lists for the current user.

Examples:


lists = mailup.console.user.lists
lists = mailup.console.user.lists
lists['TotalElementsCount']
=> 10
lists['Items'].first['Name']
=> "Test List"

lists = mailup.console.user.lists(pageNumber: 0, pageSize: 250)

Parameters:

  • params (Hash) (defaults to: {})

    Optional params or filters:

Options Hash (params):

  • :pageNumber (Integer)

    The page number to return.

  • :pageSize (Integer)

    The number of results to per page.

  • :filterby (String)

    A filtering expression.

  • :orderby (String)

    The sorting condition for the results.

Returns:

  • (JSON)

    Results and data including:

    • IsPaginated [Boolean]

    • Items [Array<Hash>]

    • PageNumber [Integer]

    • PageSize [Integer]

    • Skipped [Integer]

    • TotalElementsCount [Integer]

See Also:



39
40
41
# File 'lib/mailup/console/user.rb', line 39

def lists(params = {})
  @api.get("#{@api.path}/User/Lists", params: params)
end