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)

40
41
42
# File 'lib/user/profile/profile.rb', line 40

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)

99
100
101
102
103
# File 'lib/user/profile/profile.rb', line 99

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

66
67
68
# File 'lib/user/profile/profile.rb', line 66

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

24
25
26
# File 'lib/user/profile/profile.rb', line 24

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')

53
54
55
# File 'lib/user/profile/profile.rb', line 53

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

10
11
12
# File 'lib/user/profile/profile.rb', line 10

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)

82
83
84
85
86
# File 'lib/user/profile/profile.rb', line 82

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