Module: Pixela::Client::ProfileMethods

Included in:
Pixela::Client
Defined in:
lib/pixela/client/profile_methods.rb

Instance Method Summary collapse

Instance Method Details

#update_profile(display_name: nil, gravatar_icon_email: nil, title: nil, timezone: nil, about_url: nil, contribute_urls: [], pinned_graph_id: nil) ⇒ Pixela::Response

Updates the profile information for the user corresponding to username

Examples:

client.update_profile(display_name: "a-know", gravatar_icon_email: "[email protected]", title: "my title", timezone: "Asia/Tokyo", about_url: "https://home.a-know.me", contribute_urls: ["https://pixe.la/","https://github.com/a-know/pi","https://blog.a-know.me/archive/category/Pixela"])

Parameters:

  • display_name (String) (defaults to: nil)
  • gravatar_icon_email (String) (defaults to: nil)
  • title (String) (defaults to: nil)
  • timezone (String) (defaults to: nil)
  • about_url (String) (defaults to: nil)
  • contribute_urls (Array<String>) (defaults to: [])
  • pinned_graph_id (String) (defaults to: nil)

Returns:

Raises:

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/pixela/client/profile_methods.rb', line 20

def update_profile(display_name: nil, gravatar_icon_email: nil, title: nil, timezone: nil,
                   about_url: nil, contribute_urls: [], pinned_graph_id: nil)

  params = {
    displayName:       display_name,
    gravatarIconEmail: gravatar_icon_email,
    title:             title,
    timezone:          timezone,
    aboutURL:          about_url,
    pinnedGraphID:     pinned_graph_id
  }

  unless contribute_urls.empty?
    params[:contributeURLs] = contribute_urls
  end

  with_error_handling do
    connection(endpoint: Pixela::Client::TOP_ENDPOINT).put("@#{username}", params.compact).body
  end
end