Module: Profile

Included in:
Mints::User
Defined in:
lib/user/profile/profile.rb

Instance Method Summary collapse

Instance Method Details

#create_preferences(data) ⇒ Object

Create preferences.

Create preferences of current user logged with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  time_zone: 'GMT-5'
}
@data = @mints_user.create_preferences(data)


38
39
40
# File 'lib/user/profile/profile.rb', line 38

def create_preferences(data)
  @client.raw('post', '/profile/preferences', nil, data_transform(data))
end

#delete_notifications(data) ⇒ Object

Delete notifications.

Delete notifications by data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  ids: ['179083e3-3678-4cf6-b75e-5a8b9761245e']
}
@data = @mints_user.delete_notifications(data)


97
98
99
100
101
# File 'lib/user/profile/profile.rb', line 97

def delete_notifications(data)
  # TODO: Inform NotificationController.delete method has been modified
  # TODO: Method in controller didnt return data
  @client.raw('post', '/profile/notifications/delete', nil, data_transform(data))
end

#get_notifications(options = nil) ⇒ Object

Get notifications.

Get a collection of notifications.

Example

@data = @mints_user.get_notifications


64
65
66
# File 'lib/user/profile/profile.rb', line 64

def get_notifications(options = nil)
  @client.raw('get', '/profile/notifications', options)
end

#get_preferencesObject

Get preferences.

Get preferences of current user logged.

Example

@data = @mints_user.get_preferences


22
23
24
# File 'lib/user/profile/profile.rb', line 22

def get_preferences
  @client.raw('get', '/profile/preferences')
end

#get_preferences_by_setting_key(setting_key) ⇒ Object

Get preferences by setting key.

Get preferences using a setting key.

Parameters

setting_key

(String) – Setting key.

Example

@data = @mints_user.get_preferences_by_setting_key('time_zone')


51
52
53
# File 'lib/user/profile/profile.rb', line 51

def get_preferences_by_setting_key(setting_key)
  @client.raw('get', "/profile/preferences/#{setting_key}")
end

#me(options = nil) ⇒ Object

Me.

Get contact logged info.

Example

@data = @mints_user.me


8
9
10
# File 'lib/user/profile/profile.rb', line 8

def me(options = nil)
  @client.raw('get', '/profile/me', options)
end

#read_notifications(data) ⇒ Object

Read notifications.

Read notifications by data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  ids: %w[406e9b74-4a9d-42f2-afc6-1587bad6147c a2d9f582-1bdb-4e55-8af0-cd1962eaa88c],
  read: true
}
@data = @mints_user.read_notifications(data)


80
81
82
83
84
# File 'lib/user/profile/profile.rb', line 80

def read_notifications(data)
  # TODO: Inform NotificationController.read method has been modified
  # TODO: Method in controller didnt return data
  @client.raw('post', '/profile/notifications/read', nil, data_transform(data))
end