directlink 0.0.8.0 → 0.0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ed510f04f8bd32fadeb16a4ea27d1133dc8946e
4
- data.tar.gz: bf1afde92343fc551abbf6b10902745842dfe496
3
+ metadata.gz: a692b5ff0cc96ba9acd3383150c2db6df97cf061
4
+ data.tar.gz: ce9ee5b9edc2aafcf717ab4b3574695914a6ce9d
5
5
  SHA512:
6
- metadata.gz: a2612ddaf05fe8ea4158806d00be6209455772c004d33373bacbe00ffc1cc538aee9c4dade3d84f24c7052e0ec3ed38db0b48192c939c346c590d9d47428bcda
7
- data.tar.gz: 647f789a878dd956827ab402ebd0a8147e81c8951e8389eddc1be57c158e33a9cbdaea4d08da604249907d0a094c0966cdf34dafb0376fbcc53414efc170cd8b
6
+ metadata.gz: 965bf3f132fce53ea31ddefea4dab9c901c66d6ffc33a0f2dfe6635847750323481ad34517ee2a03118d128c3aef77f66062021bf538be32e7586cb3050dbc25
7
+ data.tar.gz: 37d541655fdb921623fe5acb88eefe35db2d7a3c637dc56231b0fb8159ff9ccc75362c8abbbbcc4a0e26c6949b5ce84b027915765f0b8b20c1b5ca2f9a529f99
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "directlink"
3
- spec.version = "0.0.8.0"
3
+ spec.version = "0.0.8.1"
4
4
  spec.summary = "converts any kind of image hyperlink to direct link, type of image and its resolution"
5
5
 
6
6
  spec.author = "Victor Maslov aka Nakilon"
@@ -242,7 +242,7 @@ module DirectLink
242
242
  end
243
243
 
244
244
  def self.vk link
245
- raise ErrorBadLink.new link unless %r{\Ahttps?://vk\.com/id(?<user_id>\d+)\?z=photo(?<id>\k<user_id>_\d+)\z} =~ link
245
+ raise ErrorBadLink.new link unless %r{\Ahttps://vk\.com/id(?<user_id>\d+)\?z=photo(?<id>\k<user_id>_\d+)(%2Falbum\k<user_id>_0)?\z} =~ link
246
246
  raise ErrorMissingEnvVar.new "define VK_ACCESS_TOKEN and VK_CLIENT_SECRET env vars" unless ENV["VK_ACCESS_TOKEN"] && ENV["VK_CLIENT_SECRET"]
247
247
  json = JSON.load NetHTTPUtils.request_data "https://api.vk.com/method/photos.getById", :POST, form: { photos: id, access_token: ENV["VK_ACCESS_TOKEN"], client_secret: ENV["VK_CLIENT_SECRET"], v: "5.101" }
248
248
  json.fetch("response").tap do |r|
data/test.rb CHANGED
@@ -396,6 +396,7 @@ describe DirectLink do
396
396
  ] ],
397
397
  [ :vk, [
398
398
  ["https://vk.com/id57030827?z=photo57030827_456241143", [1920, 1440, "https://sun9-66.userapi.com/c845322/v845322944/167836/bP9z41BybhI.jpg"]],
399
+ ["https://vk.com/id57030827?z=photo57030827_456241143%2Falbum57030827_0", [1920, 1440, "https://sun9-66.userapi.com/c845322/v845322944/167836/bP9z41BybhI.jpg"]],
399
400
  ] ],
400
401
  ].each do |method, tests|
401
402
  describe method do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: directlink
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.0
4
+ version: 0.0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov aka Nakilon