Class: MagicBell::User
- Inherits:
-
ApiResource
- Object
- ApiResource
- MagicBell::User
- Includes:
- ApiOperations
- Defined in:
- lib/magicbell/api_resources/user.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
Attributes inherited from ApiResource
Instance Method Summary collapse
- #authentication_headers ⇒ Object
-
#initialize(client, attributes) ⇒ User
constructor
A new instance of User.
- #mark_all_notifications_as_read ⇒ Object
- #mark_all_notifications_as_seen ⇒ Object
- #notification_preferences ⇒ Object
- #notifications(query_params = {}) ⇒ Object
- #path ⇒ Object
Methods included from ApiOperations
Methods inherited from ApiResource
#attribute, #attributes, create, #create, #create_path, create_path, create_url, #create_url, #name, name, #retrieve, #update, #url
Constructor Details
#initialize(client, attributes) ⇒ 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 (readonly)
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
#authentication_headers ⇒ Object
41 42 43 |
# File 'lib/magicbell/api_resources/user.rb', line 41 def authentication_headers MagicBell.authentication_headers.merge("X-MAGICBELL-USER-EMAIL" => email) end |
#mark_all_notifications_as_read ⇒ Object
18 19 20 21 |
# File 'lib/magicbell/api_resources/user.rb', line 18 def mark_all_notifications_as_read client = self MagicBell::UserNotificationsRead.new(client).create end |
#mark_all_notifications_as_seen ⇒ Object
23 24 25 26 |
# File 'lib/magicbell/api_resources/user.rb', line 23 def mark_all_notifications_as_seen client = self MagicBell::UserNotificationsSeen.new(client).create end |
#notification_preferences ⇒ Object
28 29 30 31 |
# File 'lib/magicbell/api_resources/user.rb', line 28 def notification_preferences client = self MagicBell::UserNotificationPreferences.new(client) end |
#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
33 34 35 36 37 38 39 |
# File 'lib/magicbell/api_resources/user.rb', line 33 def path if id self.class.path + "/#{id}" elsif email self.class.path + "/email:#{email}" end end |