Module: MediaWiktory::Wikipedia::Modules::Notifications
- Defined in:
- lib/mediawiktory/wikipedia/modules/notifications.rb
Overview
Get notifications waiting for the current user.
The "submodule" (MediaWiki API term) is included in action after setting some param, providing additional tweaking for this param. Example (for Actions::Query and its submodules):
api.query # returns Actions::Query
.prop(:revisions) # adds prop=revisions to action URL, and includes Modules::Revisions into action
.limit(10) # method of Modules::Revisions, adds rvlimit=10 to URL
All submodule's parameters are documented as its public methods, see below.
Instance Method Summary collapse
-
#alertcontinue(value) ⇒ self
When more alert results are available, use this to continue.
-
#alertunreadfirst ⇒ self
Whether to show unread message notifications first (only used if groupbysection is set).
-
#bundle ⇒ self
Whether to show bundle compatible unread notifications according to notification types bundling rules.
-
#continue(value) ⇒ self
When more results are available, use this to continue.
-
#crosswikisummary ⇒ self
True to opt in to a summary notification of notifications on foreign wikis.
-
#filter(*values) ⇒ self
Filter notifications returned.
-
#format(value) ⇒ self
If specified, notifications will be returned formatted this way.
-
#groupbysection ⇒ self
Whether to group the result by section.
-
#limit(value) ⇒ self
The maximum number of notifications to return.
-
#messagecontinue(value) ⇒ self
When more message results are available, use this to continue.
-
#messageunreadfirst ⇒ self
Whether to show unread alert notifications first (only used if groupbysection is set).
-
#prop(*values) ⇒ self
Details to request.
-
#sections(*values) ⇒ self
The notification sections to query (i.e. some combination of 'alert' and 'message').
-
#titles(*values) ⇒ self
Only return notifications for these pages.
-
#unreadfirst ⇒ self
Whether to show unread notifications first (only used if groupbysection is not set).
-
#wikis(*values) ⇒ self
List of wikis to fetch notifications from (defaults to only current wiki).
Instance Method Details
#alertcontinue(value) ⇒ self
When more alert results are available, use this to continue.
140 141 142 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 140 def alertcontinue(value) merge(notalertcontinue: value.to_s) end |
#alertunreadfirst ⇒ self
Whether to show unread message notifications first (only used if groupbysection is set).
147 148 149 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 147 def alertunreadfirst() merge(notalertunreadfirst: 'true') end |
#bundle ⇒ self
Whether to show bundle compatible unread notifications according to notification types bundling rules.
132 133 134 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 132 def bundle() merge(notbundle: 'true') end |
#continue(value) ⇒ self
When more results are available, use this to continue.
105 106 107 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 105 def continue(value) merge(notcontinue: value.to_s) end |
#crosswikisummary ⇒ self
True to opt in to a summary notification of notifications on foreign wikis.
169 170 171 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 169 def crosswikisummary() merge(notcrosswikisummary: 'true') end |
#filter(*values) ⇒ self
Filter notifications returned.
38 39 40 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 38 def filter(*values) values.inject(self) { |res, val| res._filter(val) or fail ArgumentError, "Unknown value for filter: #{val}" } end |
#format(value) ⇒ self
If specified, notifications will be returned formatted this way.
84 85 86 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 84 def format(value) _format(value) or fail ArgumentError, "Unknown value for format: #{value}" end |
#groupbysection ⇒ self
Whether to group the result by section. Each section is fetched separately if set.
76 77 78 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 76 def groupbysection() merge(notgroupbysection: 'true') end |
#limit(value) ⇒ self
The maximum number of notifications to return.
97 98 99 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 97 def limit(value) merge(notlimit: value.to_s) end |
#messagecontinue(value) ⇒ self
When more message results are available, use this to continue.
155 156 157 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 155 def (value) merge(notmessagecontinue: value.to_s) end |
#messageunreadfirst ⇒ self
Whether to show unread alert notifications first (only used if groupbysection is set).
162 163 164 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 162 def () merge(notmessageunreadfirst: 'true') end |
#prop(*values) ⇒ self
Details to request.
51 52 53 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 51 def prop(*values) values.inject(self) { |res, val| res._prop(val) or fail ArgumentError, "Unknown value for prop: #{val}" } end |
#sections(*values) ⇒ self
The notification sections to query (i.e. some combination of 'alert' and 'message').
64 65 66 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 64 def sections(*values) values.inject(self) { |res, val| res._sections(val) or fail ArgumentError, "Unknown value for sections: #{val}" } end |
#titles(*values) ⇒ self
Only return notifications for these pages. To get notifications not associated with any page, use [] as a title.
120 121 122 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 120 def titles(*values) values.inject(self) { |res, val| res._titles(val) } end |
#unreadfirst ⇒ self
Whether to show unread notifications first (only used if groupbysection is not set).
112 113 114 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 112 def unreadfirst() merge(notunreadfirst: 'true') end |
#wikis(*values) ⇒ self
List of wikis to fetch notifications from (defaults to only current wiki).
25 26 27 |
# File 'lib/mediawiktory/wikipedia/modules/notifications.rb', line 25 def wikis(*values) values.inject(self) { |res, val| res._wikis(val) or fail ArgumentError, "Unknown value for wikis: #{val}" } end |