Method: Bitly::API::User#update

Defined in:
lib/bitly/api/user.rb

#update(name: nil, default_group_guid: nil) ⇒ Bitly::API::User

Allows you to update the authorized user’s name or default group guid. If you update the default group ID and have already loaded the default group, it is nilled out so it can be reloaded with the correct ID. [‘PATCH /v4/user`](dev.bitly.com/api-reference/#updateUser).

Examples:

user.update(name: "New Name", default_group_guid: "aaabbb")

Parameters:

  • name (String) (defaults to: nil)

    A new name

  • default_group_guid (String) (defaults to: nil)

    A new default guid

Returns:



91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/bitly/api/user.rb', line 91

def update(name: nil, default_group_guid: nil)
  params = { "name" => name }
  if default_group_guid
    params["default_group_guid"] = default_group_guid
    @default_group = nil
  end
  @response = @client.request(
    path: "/user",
    method: "PATCH",
    params: params
  )
  assign_attributes(@response.body)
  self
end