sunflower 0.5.12 → 0.5.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sunflower/core.rb +6 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c409437f8526db32f7aab67a939cfb3df8d5a8c8
4
- data.tar.gz: 71735430b60c4ca4c745beeb2125e0a277b81a1d
3
+ metadata.gz: 2c752777781c61e50c735dc2ede810bb1d934f25
4
+ data.tar.gz: aa45d4aac33d32c148cd454fff5a2222e089a7ca
5
5
  SHA512:
6
- metadata.gz: 9e34e6752bb4aafe84fd4307ba12f355f866ca6c56b7aefbd34d40c5ffc4e5f6ed47af708fd0f64d2d30a52dadc532e107b6a4b8763143691d1f74d1f4dc7bf8
7
- data.tar.gz: abc9031eadbc2e58dc5559adf0a3afbb1e8c3cd07aa78d15321fecfa7d7c691e2fae42d99c38cb746dba9b63d5fbb82faaea1a7c59c2aa46ba786adcdeb7ea87
6
+ metadata.gz: 8ce1e2507d1e3c6c2d82025f6d21d9b9ebabc4e60dec6752f72d2dba6b72e71eacf2b5983cf67acdafd966c6f1639d137a759bd6ef53940d4b347627c828d818
7
+ data.tar.gz: 9c506546f272aaaf26c16ec49c39793844443ca91f925f68e46be3cf7614c494be3696b8fc85d1f4cb2ac62c1742ab9e31edced683b91a40debe55604bd72c67
@@ -40,7 +40,8 @@ end
40
40
  #
41
41
  # You can use multiple Sunflowers at once, to work on multiple wikis.
42
42
  class Sunflower
43
- VERSION = '0.5.12'
43
+ VERSION = '0.5.13'
44
+ USER_AGENT = "Sunflower #{VERSION} alpha <https://github.com/MatmaRex/Sunflower>"
44
45
 
45
46
  INVALID_CHARS = %w(# < > [ ] | { })
46
47
  INVALID_CHARS_REGEX = Regexp.union *INVALID_CHARS
@@ -225,7 +226,7 @@ class Sunflower
225
226
  resp = RestClient.post(
226
227
  @api_endpoint,
227
228
  request,
228
- {:user_agent => "Sunflower #{VERSION} alpha", :cookies => @cookies}
229
+ {:user_agent => USER_AGENT, :cookies => @cookies}
229
230
  )
230
231
  JSON.parse resp.to_str
231
232
  end
@@ -296,20 +297,20 @@ class Sunflower
296
297
  response = RestClient.post(
297
298
  @api_endpoint,
298
299
  "action=login&lgname=#{CGI.escape user}&lgpassword=#{CGI.escape password}&format=json",
299
- {:user_agent => "Sunflower #{VERSION} alpha"}
300
+ {:user_agent => USER_AGENT}
300
301
  )
301
302
 
302
303
  @cookies = response.cookies
303
304
  raise Sunflower::Error, 'unable to log in (no cookies received)!' if !@cookies or @cookies.empty?
304
305
 
305
306
  json = JSON.parse response.to_str
306
- token, prefix = (json['login']['lgtoken']||json['login']['token']), json['login']['cookieprefix']
307
+ token = json['login']['lgtoken'] || json['login']['token']
307
308
 
308
309
  # 2. actually log in
309
310
  response = RestClient.post(
310
311
  @api_endpoint,
311
312
  "action=login&lgname=#{CGI.escape user}&lgpassword=#{CGI.escape password}&lgtoken=#{CGI.escape token}&format=json",
312
- {:user_agent => "Sunflower #{VERSION} alpha", :cookies => @cookies}
313
+ {:user_agent => USER_AGENT, :cookies => @cookies}
313
314
  )
314
315
 
315
316
  json = JSON.parse response.to_str
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunflower
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matma Rex