Class: MagicBell::User
Instance Attribute Summary collapse
Attributes inherited from ApiResource
#id
Instance Method Summary
collapse
#get, #post, #put
Methods inherited from ApiResource
#attribute, #attributes, #create, create, create_path, #create_path, create_url, #create_url, find, #name, name, #retrieve, #update, #url
Constructor Details
#initialize(client, attributes) ⇒ User
Returns a new instance of User.
7
8
9
10
11
|
# File 'lib/magicbell/api_resources/user.rb', line 7
def initialize(client, attributes)
@client = client
@email = attributes["email"]
super(client, attributes)
end
|
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
5
6
7
|
# File 'lib/magicbell/api_resources/user.rb', line 5
def email
@email
end
|
Instance Method Details
46
47
48
|
# File 'lib/magicbell/api_resources/user.rb', line 46
def
MagicBell..merge("X-MAGICBELL-USER-EMAIL" => email)
end
|
#find_notification(notification_id) ⇒ Object
18
19
20
21
|
# File 'lib/magicbell/api_resources/user.rb', line 18
def find_notification(notification_id)
client = self
MagicBell::UserNotification.find(client, notification_id)
end
|
#mark_all_notifications_as_read ⇒ Object
#mark_all_notifications_as_seen ⇒ Object
#notification_preferences ⇒ Object
#notifications(query_params = {}) ⇒ Object
13
14
15
16
|
# File 'lib/magicbell/api_resources/user.rb', line 13
def notifications(query_params = {})
client = self
MagicBell::UserNotifications.new(client, query_params)
end
|
#path ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/magicbell/api_resources/user.rb', line 38
def path
if id
self.class.path + "/#{id}"
elsif email
self.class.path + "/email:#{email}"
end
end
|