hastebin 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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/hastebin.rb +30 -0
  3. metadata +63 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f6ccfcceb6e6f58bf8f5af578d63fd59eeeddb9ab18d9bbcb84e2a91a0ce6fad
4
+ data.tar.gz: 22b0489f0d97ec7d814c6ae9ebcbd0fa52800db478d0e1863405246ea4a9c287
5
+ SHA512:
6
+ metadata.gz: cee253010c6640eea8faa03cbd95ccbc084c7df584ceec948fca146a3911d4415285a026e0f53d2287df709a7b09bd9cfd226181bdb52ad225c254094240bd0d
7
+ data.tar.gz: 7d4723a10b92b13c435068fe0ced66620c1bd48675144fa153cf22a2c720ff80620725a836226455eb120b423f74a0884f9a20cc4a647b7fc186aaa6c7fc9bb2
@@ -0,0 +1,30 @@
1
+ require "uri"
2
+ require "net/http"
3
+ require "json"
4
+
5
+ module Hastebin
6
+
7
+
8
+ def self.code(code)
9
+ url = URI("https://hasteb.in/documents")
10
+
11
+ https = Net::HTTP.new(url.host, url.port);
12
+ https.use_ssl = true
13
+
14
+ request = Net::HTTP::Post.new(url)
15
+ request["Connection"] = "keep-alive"
16
+ request["Accept"] = "application/json, text/javascript, */*; q=0.01"
17
+ request["X-Requested-With"] = "XMLHttpRequest"
18
+ request["Content-Type"] = "application/json; charset=UTF-8"
19
+ request["Origin"] = "https://hasteb.in"
20
+ request["Referer"] = "https://hasteb.in/"
21
+ request["Accept-Language"] = "pt-BR,pt;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5"
22
+ request.body = code
23
+
24
+ $res = https.request(request)
25
+
26
+ return JSON.parse($res.read_body)['key']
27
+ end
28
+
29
+
30
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hastebin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Astin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-08-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
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
+ description: ''
28
+ email:
29
+ - ''
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/hastebin.rb
35
+ homepage: https://rubygems.org/gems/discloud-status
36
+ licenses:
37
+ - MIT
38
+ metadata:
39
+ source_code_uri: https://github.com/astindev/hastebin/
40
+ homepage_uri: https://rubygems.org/gems/hastebin
41
+ changelog_uri: https://github.com/astindev/hastebin/blob/master/CHANGELOG.md
42
+ bug_tracker_uri: https://github.com/astin/hastebin/issues
43
+ documentation_uri: https://github.com/astindev/hastebin/
44
+ post_install_message:
45
+ rdoc_options: []
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubygems_version: 3.1.2
60
+ signing_key:
61
+ specification_version: 4
62
+ summary: CLI tool that uploads text to hasteb.in .
63
+ test_files: []