metakiller 0.1.0
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 +7 -0
- data/lib/metakiller.rb +29 -0
- metadata +72 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 266ddfae29e5247093e669cbf06777cd6912743c
|
4
|
+
data.tar.gz: e97cc9cf61b01398a8d985c38c1c0602363d72a2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ed3c5d97bb0e9ff33dedf4970f567cbfbfd474993086b414572cb671cda309a53d821f4737147ab0b497d3da5b6ac13b259f7caa764977baf6c4537324d54755
|
7
|
+
data.tar.gz: b7ba91675271c2ef49c81207d5cc6d644d9ac0346db01d3ca1be16a59809ac759768bdb9f6298e0755c6a79d0a4ca8e14277d1c8511cc632233bd94d1349dd27
|
data/lib/metakiller.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'net/http/post/multipart'
|
2
|
+
require 'mimemagic'
|
3
|
+
|
4
|
+
class Metakiller
|
5
|
+
|
6
|
+
@url = ""
|
7
|
+
@token = ""
|
8
|
+
|
9
|
+
def initialize(token)
|
10
|
+
@token = token
|
11
|
+
@url = URI.parse("http://192.168.1.137:3000/#{@token}/clean")
|
12
|
+
end
|
13
|
+
|
14
|
+
def clean(filepath)
|
15
|
+
File.open(filepath) do |file|
|
16
|
+
req = Net::HTTP::Post::Multipart.new @url.path,
|
17
|
+
"files[]" => UploadIO.new(file, getMime(filepath), File.basename(filepath))
|
18
|
+
res = Net::HTTP.start(@url.host, @url.port) do |http|
|
19
|
+
http.request(req)
|
20
|
+
end
|
21
|
+
return res.body
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def getMime(filepath)
|
26
|
+
return MimeMagic.by_magic(File.open(filepath))
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: metakiller
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gonzalo Garcia
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-01-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: multipart-post
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mimemagic
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Metakiller is a REST API created to make metadata cleaning easy!
|
42
|
+
email: gongarcialeon@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/metakiller.rb
|
48
|
+
homepage: http://rubygems.org/gems/metakiller
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata: {}
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options: []
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 2.6.14
|
69
|
+
signing_key:
|
70
|
+
specification_version: 4
|
71
|
+
summary: Metakiller ruby gem.
|
72
|
+
test_files: []
|