Class: Mailchimp::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/mailchimp/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Users

Returns a new instance of Users.



166
167
168
# File 'lib/mailchimp/api.rb', line 166

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



164
165
166
# File 'lib/mailchimp/api.rb', line 164

def master
  @master
end

Instance Method Details

#invite(email, role = 'viewer', msg = '') ⇒ Hash

Invite a user to your account

Parameters:

  • email (String)

    A valid email address to send the invitation to

  • role (String) (defaults to: 'viewer')

    the role to assign to the user - one of viewer, author, manager, admin. defaults to viewer. More details <a href=“kb.mailchimp.com/article/can-we-have-multiple-users-on-our-account-with-limited-access” target=“_blank”>here</a>

  • msg (String) (defaults to: '')

    an optional message to include. Plain text any HTML tags will be stripped.

Returns:

  • (Hash)

    the method completion status

    • String

      status The status (success) of the call if it completed. Otherwise an error is thrown.



176
177
178
179
# File 'lib/mailchimp/api.rb', line 176

def invite(email, role='viewer', msg='')
    _params = {:email => email, :role => role, :msg => msg}
    return @master.call 'users/invite', _params
end

#invite_resend(email) ⇒ Hash

Resend an invite a user to your account. Note, if the same address has been invited multiple times, this will simpy re-send the most recent invite

Parameters:

  • email (String)

    A valid email address to resend an invitation to

Returns:

  • (Hash)

    the method completion status

    • String

      status The status (success) of the call if it completed. Otherwise an error is thrown.



185
186
187
188
# File 'lib/mailchimp/api.rb', line 185

def invite_resend(email)
    _params = {:email => email}
    return @master.call 'users/invite-resend', _params
end

#invite_revoke(email) ⇒ Hash

Revoke an invitation sent to a user to your account. Note, if the same address has been invited multiple times, this will simpy revoke the most recent invite

Parameters:

  • email (String)

    A valid email address to send the invitation to

Returns:

  • (Hash)

    the method completion status

    • String

      status The status (success) of the call if it completed. Otherwise an error is thrown.



194
195
196
197
# File 'lib/mailchimp/api.rb', line 194

def invite_revoke(email)
    _params = {:email => email}
    return @master.call 'users/invite-revoke', _params
end

#invitesArray

Retrieve the list of pending users invitations have been sent for.

Returns:

  • (Array)

    structs for each invitation, including:

    • String

      email the email address the invitation was sent to

    • String

      role the role that will be assigned if they accept

    • String

      sent_at the time the invitation was sent. this will change if it’s resent.

    • String

      expiration the expiration time for the invitation. this will change if it’s resent.

    • String

      msg the welcome message included with the invitation



206
207
208
209
# File 'lib/mailchimp/api.rb', line 206

def invites()
    _params = {}
    return @master.call 'users/invites', _params
end

#login_revoke(username) ⇒ Hash

Revoke access for a specified login

Parameters:

  • username (String)

    The username of the login to revoke access of

Returns:

  • (Hash)

    the method completion status

    • String

      status The status (success) of the call if it completed. Otherwise an error is thrown.



215
216
217
218
# File 'lib/mailchimp/api.rb', line 215

def (username)
    _params = {:username => username}
    return @master.call 'users/login-revoke', _params
end

#loginsArray

Retrieve the list of active logins.

Returns:

  • (Array)

    structs for each user, including:

    • Int

      id the login id for this login

    • String

      username the username used to log in

    • String

      name a display name for the account - empty first/last names will return the username

    • String

      email the email tied to the account used for passwords resets and the ilk

    • String

      role the role assigned to the account

    • String

      avatar if available, the url for the login’s avatar



228
229
230
231
# File 'lib/mailchimp/api.rb', line 228

def logins()
    _params = {}
    return @master.call 'users/logins', _params
end

#profileHash

Retrieve the profile for the login owning the provided API Key

Returns:

  • (Hash)

    the current user’s details, including:

    • Int

      id the login id for this login

    • String

      username the username used to log in

    • String

      name a display name for the account - empty first/last names will return the username

    • String

      email the email tied to the account used for passwords resets and the ilk

    • String

      role the role assigned to the account

    • String

      avatar if available, the url for the login’s avatar



241
242
243
244
# File 'lib/mailchimp/api.rb', line 241

def profile()
    _params = {}
    return @master.call 'users/profile', _params
end