workspace-net 1.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/workspace-net.rb +24 -0
  3. metadata +74 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 11b6c6a36bb7eb9dbedefa5940b9177c4e49143f
4
+ data.tar.gz: 1ea7e14932523b0c50255fb6a9a30c6ec7eaf703
5
+ SHA512:
6
+ metadata.gz: a48c12d07320c8038f539f9e5ba9ef54a87a06dc31e18be3e532a0f977fdbb1c99561a5bc61c074c79d03fac37626c7d3880d68458867b03c6c73a02279dccad
7
+ data.tar.gz: 187ae75ec894dc6f3eb854a764a22bd84f9876dd3557c88d3452ed4c88c022948ab390bb5559a56ff7d3df1280f2073e361e3bcc7f1c2255c62a7cc4f40748cc
data/workspace-net.rb ADDED
@@ -0,0 +1,24 @@
1
+ require "typhoeus"
2
+
3
+ module Workspace
4
+ class File
5
+ def download(url, followlocation: true, verify: false)
6
+ dir.create unless dir.exists?
7
+ queue_download(url, followlocation: followlocation, verify: verify).run
8
+ self
9
+ end
10
+
11
+ def queue_download(url, followlocation: true, verify: false, &block)
12
+ uri = URI(url)
13
+ uri.scheme ||= "http"
14
+ request = Typhoeus::Request.new(uri.to_s, followlocation: followlocation, verify: verify)
15
+ request.on_complete do |response|
16
+ if response.success?
17
+ write(response.body)
18
+ yield(self) unless block.nil?
19
+ end
20
+ end
21
+ request
22
+ end
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: workspace-net
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
5
+ platform: ruby
6
+ authors:
7
+ - Tobias Strebitzer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: workspace
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: typhoeus
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ description: Workspace makes it a breeze to work with files and directories
42
+ email:
43
+ - tobias.strebitzer@magloft.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - workspace-net.rb
49
+ homepage: https://github.com/magloft/workspace
50
+ licenses:
51
+ - BSD-3-Clause
52
+ metadata: {}
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - "."
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: '2.4'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 2.6.10
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: Workspace gem extension to allow dealing with network requests (download,
73
+ upload)
74
+ test_files: []