Method: CloudFS::Share#change_attributes

Defined in:
lib/cloudfs/share.rb

#change_attributes(values, password: nil) ⇒ Boolean

Changes, adds, or removes the share’s password or updates the name.

Parameters:

  • values (Hash)

    metadata of share.

  • password (String) (defaults to: nil)

    current password of the share.

Options Hash (values):

  • :current_password (String)
  • :password (String)
  • :name (String)

Returns:

  • (Boolean)

    based on the success or fail status of the action.



197
198
199
200
201
202
203
204
205
206
207
# File 'lib/cloudfs/share.rb', line 197

def change_attributes(values, password: nil)
  current_password = values.has_key?('current_password') ? values['current_password'] : password
  new_password = values.has_key?('password') ? values['password'] : nil
  name = values.has_key?('name') ? values['name'] : nil

  response = @rest_adapter.alter_share_info(
      @share_key, current_password: current_password, password: new_password, name: name)

  set_share_info(** response)
  response.has_key?(:share_key)
end