Module: Skittles::Client::Setting

Included in:
Skittles::Client
Defined in:
lib/skittles/client/setting.rb

Overview

Define methods related to settings.

See Also:

Instance Method Summary (collapse)

Instance Method Details

- (Hashie::Mash) all_settings

Returns all settings of the active user.

Returns:

  • (Hashie::Mash)

    A setting object for the acting user.

See Also:

Requires Acting User:

  • Yes



11
12
13
# File 'lib/skittles/client/setting.rb', line 11

def all_settings
  get('settings/all').settings
end

- (Hashie::Mash) set_setting(id, value)

Change a setting for the given user.

Parameters:

  • id (String)

    Name of setting to change, sendToTwitter, sendToFacebook, receivePings, receiveCommentPings.

  • value (Integer)

    1 for true, and 0 for false.

Returns:

  • (Hashie::Mash)

    A confirmation message.

See Also:

Requires Acting User:

  • Yes



22
23
24
# File 'lib/skittles/client/setting.rb', line 22

def set_setting(id, value)
  post("settings/#{id}/set", { :value => value }).settings
end

- (Hashie::Mash) setting(id)

Returns a setting for the acting user.

Parameters:

  • id (String)

    The name of a setting.

Returns:

  • (Hashie::Mash)

    The value for this setting for the acting user.

See Also:

Requires Acting User:

  • Yes



32
33
34
# File 'lib/skittles/client/setting.rb', line 32

def setting(id)
  get("settings/#{id}").value
end