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
12
13
|
# File 'lib/magicbell/api_resources/user.rb', line 7
def initialize(client, attributes)
@client = client
@email = attributes["email"]
@external_id = attributes["external_id"]
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
|
#external_id ⇒ Object
Returns the value of attribute external_id.
5
6
7
|
# File 'lib/magicbell/api_resources/user.rb', line 5
def external_id
@external_id
end
|
Instance Method Details
50
51
52
53
54
55
56
|
# File 'lib/magicbell/api_resources/user.rb', line 50
def
if external_id
MagicBell..merge("X-MAGICBELL-USER-EXTERNAL-ID" => external_id)
elsif email
MagicBell..merge("X-MAGICBELL-USER-EMAIL" => email)
end
end
|
#find_notification(notification_id) ⇒ Object
20
21
22
23
|
# File 'lib/magicbell/api_resources/user.rb', line 20
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
15
16
17
18
|
# File 'lib/magicbell/api_resources/user.rb', line 15
def notifications(query_params = {})
client = self
MagicBell::UserNotifications.new(client, query_params)
end
|
#path ⇒ Object
40
41
42
43
44
45
46
47
48
|
# File 'lib/magicbell/api_resources/user.rb', line 40
def path
if id
self.class.path + "/#{id}"
elsif external_id
self.class.path + "/external_id:#{external_id}"
elsif email
self.class.path + "/email:#{email}"
end
end
|