mediawiki-butt 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e649c5d1963a0f3e300d04d7953735b9207c66c
4
- data.tar.gz: 6284a9046b3f8575b6c28e84695e454beb70263a
3
+ metadata.gz: 6ae51034d623d7cf169caf9f5047b7c045657efc
4
+ data.tar.gz: ff71d9958a84604227b5d97bb57f4dfe23fb28b6
5
5
  SHA512:
6
- metadata.gz: a6b021df89173e0d44ed1217dc8ca0cbf4e5b08a55b9e45844c54013dcada4f7b7187588cb9a79c0f4329021879b3218e2dffab8b3c8fafae72c95b3c3f0dafa
7
- data.tar.gz: c80b130f381f088cd43215d592a622f1c1617b868fe03d7e9f9af093045c716a4baeab574be519a6aab886a677022fb981a6a252ac0a8766c3fb073c87a5bae1
6
+ metadata.gz: 96bb531f1dec544ad84bba39dfa73a13c77b6efbaa7628fb8733972909814e834a700f400490445953f14eb0f2ac2bd3379dece7c87b9294060733bd7fcd1b0d
7
+ data.tar.gz: c7d7aaa8f0c2cbef183ac3cc79ba3ba68605e6735a59eb60584fcd24745b88c629ab2f1917dcf20123641db7fe3580ce5b1b7db97df4330b2360447b26084a12
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
  ## Version 0
3
+ ### Version 0.2.1
4
+ * Fix gemspec. You should actually have the new stuff now.
5
+
3
6
  ### Version 0.2.0
4
7
  * New get_id method to get the pageid from the title.
5
8
  * New get_random_pages method to get an array of random articles.
@@ -0,0 +1,218 @@
1
+ module MediaWiki
2
+ module Constants
3
+ # Constants Namespace IDs. Taken from https://www.mediawiki.org/wiki/Extension_default_namespaces
4
+ module Namespaces
5
+ # Core
6
+ $NS_MAIN = 0
7
+ $NS_TALK = 1
8
+ $NS_USER = 2
9
+ $NS_USER_TALK = 3
10
+ $NS_PROJECT = 4
11
+ $NS_PROJECT_TALK = 5
12
+ $NS_FILE = 6
13
+ $NS_FILE_TALK = 7
14
+ $NS_MEDIAWIKI = 8
15
+ $NS_MEDIAWIKI_TALK = 9
16
+ $NS_TEMPLATE = 10
17
+ $NS_TEMPLATE_TALK = 11
18
+ $NS_HELP = 12
19
+ $NS_HELP_TALK = 13
20
+ $NS_CATEGORY = 14
21
+ $NS_CATEGORY_TALK = 15
22
+ $NS_SPECIAL = -1
23
+ $NS_MEDIA = -2
24
+
25
+ # Extension:LiquidThreads
26
+ $NS_LQT_THREAD = 90
27
+ $NS_LQT_THREAD_TALK = 91
28
+ $NS_LQT_SUMMARY = 92
29
+ $NS_LQT_SUMMARY_TALK = 93
30
+
31
+ # Extension:Semantic MediaWiki / Extension:Semantic Forms
32
+ $NS_SMW_RELATION = 100
33
+ $NS_SMW_RELATION_TALK = 101
34
+ $NS_SMW_PROPERTY = 102
35
+ $NS_SMW_PROPERTY_TALK = 103
36
+ $NS_SMW_TYPE = 104
37
+ $NS_SMW_TYPE_TALK = 105
38
+ $NS_SMW_FORM = 106
39
+ $NS_SMW_FORM_TALK = 107
40
+ $NS_SF_CONCEPT = 108
41
+ $NS_SF_CONCEPT_TALK = 109
42
+
43
+ # Extension:DPLforum
44
+ $NS_DPLF_FORUM = 110
45
+ $NS_DPLF_FORUM_TAlK = 111
46
+
47
+ # Extension:RefHelper
48
+ $NS_RFH_CITE = 120
49
+ $NS_RFH_CITE_TALK = 121
50
+
51
+ # Extension:SemanticAccessControl
52
+ $NS_ACL_USERGROUP = 160
53
+ $NS_ACL_ACL = 162
54
+
55
+ # Extension:Semantic Drilldown
56
+ $NS_SED_FILTER = 170
57
+ $NS_SED_FILTER_TALK = 171
58
+
59
+ # Extension:SocialProfile
60
+ $NS_SCP_USERWIKI = 200
61
+ $NS_SCP_USERWIKI_TALK = 201
62
+ $NS_SCP_USERPROFILE = 202
63
+ $NS_SCP_USERPROFILE_TALK = 203
64
+
65
+ # Extension:Proofread Page
66
+ $NS_PRP_PAGE = 250
67
+ $NS_PRP_PAGE_TALK = 251
68
+ $NS_PRP_INDEX = 252
69
+ $NS_PRP_INDEX_TALK = 253
70
+
71
+ # Extension:TrustedMath
72
+ $NS_TRM_MATH = 262
73
+ $NS_TRM_MATH_TALK = 263
74
+
75
+ # Extension:Widgets
76
+ $NS_WID_WIDGET = 274
77
+ $NS_WID_WIDGET_TALK = 275
78
+
79
+ # Extension:EmbedScript
80
+ $NS_EMS_JSAPPLET = 280
81
+ $NS_EMS_JSAPPLET_TALK = 281
82
+
83
+ # Extension:PollNY
84
+ $NS_PLN_POLL = 300
85
+ $NS_PLN_POLL_TALK = 301
86
+
87
+ # Extension:Semantic Image Annotator
88
+ $NS_SIA_IMAGE_ANNOTATOR = 380
89
+
90
+ # Extension:Wiki2LaTeX
91
+ $NS_WTL_WIKI2LATEX = 400
92
+ $NS_WTL_WIKI2LATEX_TALK = 401
93
+
94
+ # Extension:Workflow
95
+ $NS_WRF_WORKFLOW = 410
96
+ $NS_WRF_WORKFLOW_TALK = 411
97
+
98
+ # Extension:Maps
99
+ $NS_MAP_LAYER = 420
100
+ $NS_MAP_LAYER_TALK = 421
101
+
102
+ # Extension:QuizTabulate
103
+ $NS_QTB_QUIZ = 430
104
+ $NS_QTB_QUIZ_TALK = 431
105
+
106
+ # Extension:Education Program
107
+ $NS_EDP_EDUCATION_PROGRAM = 446
108
+ $NS_EDP_EDUCATION_PROGRAM_TALK = 447
109
+
110
+ # Extension:BoilerRoom
111
+ $NS_BLR_BOILERPLATE = 450
112
+ $NS_BLR_BOILERPLATE_TALK = 451
113
+
114
+ # Extension:UploadWizard
115
+ $NS_UPW_CAMPAIGN = 460
116
+ $NS_UPW_CAMPAIGN_TALK = 461
117
+
118
+ # Extension:EventLogging
119
+ $NS_ELG_SCHEMA = 470
120
+ $NS_ELG_SCHEMA_TALK = 471
121
+
122
+ # Extension:ZeroBanner
123
+ $NS_ZRB_ZERO = 480
124
+ $NS_ZRB_ZERO_TALK = 481
125
+
126
+ # Extension:JsonConfig
127
+ $NS_JSC_CONFIG = 482
128
+ $NS_JSC_CONFIG_TALK = 483
129
+ $NS_JSC_DATA = 486
130
+ $NS_JSC_DATA_TALK = 487
131
+
132
+ # Extension:Graph
133
+ $NS_GRP_GRAPH = 484
134
+ $NS_GRP_GRAPH_TALK = 485
135
+
136
+ # Extension:OpenStackManager
137
+ $NS_OSM_NOVA_RESOURCE = 488
138
+ $NS_OSM_NOVA_RESOURCE_TALK = 489
139
+
140
+ # Extension:GWToolset
141
+ $NS_GWT_GWTOOLSET = 490
142
+ $NS_GWT_GWTOOLSET_TALK = 491
143
+
144
+ # Extension:BlogPage
145
+ $NS_BLP_BLOG = 500
146
+ $NS_BLP_BLOG_TALK = 501
147
+
148
+ # Extension:XMLContentExtension
149
+ $NS_XCE_XML = 580
150
+ $NS_XCE_XML_TALK = 581
151
+ $NS_XCE_SCHEMA = 582
152
+ $NS_XCE_SCHEMA_TALK = 583
153
+
154
+ # Extension:FanBoxes
155
+ $NS_FNB_USERBOX = 600
156
+ $NS_FNB_USERBOX_TALK = 601
157
+
158
+ # Extension:LinkFilter
159
+ $NS_LFT_LINK = 700
160
+ $NS_LFT_LINK_TALK = 701
161
+
162
+ # Extension:TimedMediaHandler
163
+ $NS_TMH_TIMEDTEXT = 710
164
+ $NS_TMH_TIMEDTEXT_TALK = 711
165
+
166
+ # Extension:QPoll
167
+ $NS_QPL_INTERPRETATION = 800
168
+ $NS_QPL_INTERPRETATION_TALK = 801
169
+
170
+ # Extension:SemanticMustacheFormat :3
171
+ $NS_SMF_MUSTACHE = 806
172
+ $NS_SMF_MUSTACHE_TALK = 807
173
+
174
+ # Extension:R
175
+ $NS_R_R = 814
176
+ $NS_R_R_TALK = 815
177
+
178
+ # Extension:Scribunto
179
+ $NS_SCR_MODULE = 828
180
+ $NS_SCR_MODULE_TALK = 829
181
+
182
+ # Extension:SecurePoll
183
+ $NS_SEP_SECUREPOLL = 830
184
+ $NS_SEP_SECUREPOLL_TALK = 831
185
+
186
+ # Extension:CentralNotice
187
+ $NS_CNT_CNBANNER = 866
188
+ $NS_CNT_CNBANNER_TALK = 867
189
+
190
+ # Extension:Translate
191
+ $NS_TRN_TRANSLATIONS = 1198
192
+ $NS_TRN_TRANSLATIONS_TALK = 1199
193
+
194
+ # Extension:PackageForce
195
+ $NS_PKF_PACKAGEFORCE = 1300
196
+ $NS_PKF_PACKAGEFORCE_TALK = 1301
197
+
198
+ # Extension:BlueSpice
199
+ $NS_BLS_BLOG = 1502
200
+ $NS_BLS_BLOG_TALK = 1503
201
+ $NS_BLS_BOOK = 1504
202
+ $NS_BLS_BOOK_TALK = 1505
203
+
204
+ # Extension:Gadgets
205
+ $NS_GDG_GADGET = 2300
206
+ $NS_GDG_GADGET_TALK = 2301
207
+ $NS_GDG_GADGET_DEFININTION = 2302
208
+ $NS_GDG_GADGET_DEFININTION_TALK = 2303
209
+
210
+ # Extension:VisualEditor
211
+ $NS_VSE_VISUALEDITOR = 2500
212
+ $NS_VSE_VISUALEDITOR_TALK = 2501
213
+
214
+ # Extension:Flow
215
+ $NS_FLW_TOPIC = 2600
216
+ end
217
+ end
218
+ end
@@ -0,0 +1,36 @@
1
+ module MediaWiki
2
+ module Edit
3
+ # Performs a standard edit. It cannot create pages. Please use create_page for that.
4
+ # @param title [String] The page title.
5
+ # @param text [String] The new content.
6
+ # @param summary [String] The edit summary. Optional.
7
+ # @param minor [Boolean] Will mark the edit as minor if true. Defaults to false.
8
+ # @param bot [Boolean] Will mark the edit as bot edit if true. Defualts to true, for your convenience, bot developers.
9
+ # @return [String] The new revision ID, or if it failed, the error code.
10
+ def edit(title, text, summary = nil, minor = false, bot = true)
11
+ params = {
12
+ action: 'edit',
13
+ title: title,
14
+ summary: summary,
15
+ text: text,
16
+ nocreate: 1,
17
+ format: 'json'
18
+ }
19
+
20
+ token = get_edit_token(title)
21
+ puts token
22
+
23
+ params[:minor] = '1' if minor == true
24
+ params[:bot] = '1' if bot == true
25
+ params[:token] = token
26
+
27
+ response = post(params)
28
+
29
+ if response["error"]["code"].nil?
30
+ return response["edit"]["newrevid"]
31
+ else
32
+ return response["error"]["code"]
33
+ end
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediawiki-butt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eli Foster
@@ -50,6 +50,8 @@ files:
50
50
  - lib/mediawiki-butt.rb
51
51
  - lib/mediawiki/auth.rb
52
52
  - lib/mediawiki/butt.rb
53
+ - lib/mediawiki/constants.rb
54
+ - lib/mediawiki/edit.rb
53
55
  - lib/mediawiki/exceptions.rb
54
56
  - lib/mediawiki/query.rb
55
57
  homepage: https://github.com/ftb-gamepedia/mediawiki-butt-ruby