Class: Sendgrid::Web::Profile

Inherits:
Client
  • Object
show all
Defined in:
lib/sendgrid/web/profile.rb

Instance Method Summary collapse

Methods inherited from Client

base_uri, config, #config, configure

Instance Method Details

#getSendgrid::Web::Response

Note:

All parameters are optional

View your SendGrid profile.

Returns:



7
8
9
10
# File 'lib/sendgrid/web/profile.rb', line 7

def get
  res = connection.post('/api/profile.get.json', default_params)
  craft_response(res)
end

#set(first_name: nil, last_name: nil, address: nil, city: nil, state: nil, country: nil, zip: nil, phone: nil, website: nil) ⇒ Sendgrid::Web::Response

Note:

All parameters are optional

Update your SendGrid profile.

Parameters:

  • first_name (String) (defaults to: nil)

    Your first name.

  • last_name (String) (defaults to: nil)

    Your last name.

  • address (String) (defaults to: nil)

    Your company address.

  • city (String) (defaults to: nil)

    City where your company is located.

  • state (String) (defaults to: nil)

    State where your company is located.

  • country (String) (defaults to: nil)

    Country where your company is located.

  • zip (String) (defaults to: nil)

    Zipcode/Postcode where your company is located.

  • phone (String) (defaults to: nil)

    Valid phone number.

  • website (String) (defaults to: nil)

    Your companies website.

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sendgrid/web/profile.rb', line 26

def set(
  first_name: nil, last_name: nil, address: nil,
  city: nil, state: nil, country: nil,
  zip: nil, phone: nil, website: nil)
  res = connection.post(
    '/api/profile.set.json',
    default_params(
      first_name: first_name,
      last_name: last_name,
      address: address,
      city: city,
      state: state,
      country: country,
      zip: zip,
      phone: phone,
      website: website))
  craft_response(res)
end

#set_email(email: nil) ⇒ Sendgrid::Web::Response

Note:

Only email is required.

Note:

SendGrid send out a confirmation email to the new email account in order to be validated. Your email address changes when you click on the confirmation link.

Update your email address.

Parameters:

  • email (String) (defaults to: nil)

    This is the new email address SendGrid will be contacting you with. Changes take effect immediately.

Returns:

See Also:



100
101
102
103
104
105
106
107
108
# File 'lib/sendgrid/web/profile.rb', line 100

def set_email(email: nil)
  if email.nil?
    raise ArgumentError.new('Missing required `email` option')
  end
  res = connection.post(
    '/api/profile.setEmail.json',
    default_params(email: email))
  craft_response(res)
end

#set_password(password: nil, confirm_password: nil) ⇒ Sendgrid::Web::Response

Note:

password and confirm_password are required.

Update your password.

Parameters:

  • password (String) (defaults to: nil)

    Your new password.

  • confirm_password (String) (defaults to: nil)

    Confirm your new password.

Returns:

See Also:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/sendgrid/web/profile.rb', line 53

def set_password(password: nil, confirm_password: nil)
  if password.nil?
    raise ArgumentError.new('Missing required `password` option')
  elsif confirm_password.nil?
    raise ArgumentError.new(
      'Missing required `confirm_password` option')
  end
  res = connection.post(
    '/api/password.set.json',
    default_params(
      password: password,
      confirm_password: confirm_password))
  craft_response(res)
end

#set_username(username: nil) ⇒ Sendgrid::Web::Response

Note:

Only username is required.

Note:

Your account username is used to login to the SMTP server and the website. Changes will take effect immediately.

Update your username.

Parameters:

  • username (String) (defaults to: nil)

    This is the new username we will be authenticating with our SMTP servers and our website. Changes take effect immediately.

Returns:

See Also:



79
80
81
82
83
84
85
86
87
# File 'lib/sendgrid/web/profile.rb', line 79

def set_username(username: nil)
  if username.nil?
    raise ArgumentError.new('Missing required `username` option')
  end
  res = connection.post(
    '/api/profile.setUsername.json',
    default_params(username: username))
  craft_response(res)
end