short_io 0.1.7 → 0.1.8
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 +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +4 -2
- data/CHANGELOG.md +16 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +24 -1
- data/README.md +4 -2
- data/lib/short_io/short_url.rb +19 -8
- data/lib/short_io/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '01299ccaa6348aa2c516c54877e28d7c12ffd318056ba5b862c470ef87f0a7dc'
|
|
4
|
+
data.tar.gz: 619507d110ac39cb4f7930381e30a8c049449249d06bfbc291b77cb1075e5c49
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5f397a7d6bee167a5f69da748738f2abd85c052b78adc9cca1f6ace7ce88fd57bf7d77ec32770e5758dffe42d64697986e72b78a5610243fcbe733e960667b6
|
|
7
|
+
data.tar.gz: 98f790b50b2f830052ac8d6a0e7f8c2b78f9e5c9f052e5ed794abbb2eef641de75df76cb83c2cae4e31ccf387ee30c8e6ea00f167e2c5d4f23bb4db43b5f469e
|
data/.travis.yml
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
---
|
|
2
1
|
language: ruby
|
|
3
2
|
cache: bundler
|
|
4
3
|
rvm:
|
|
5
|
-
|
|
4
|
+
- 2.7.1
|
|
6
5
|
before_install: gem install bundler -v 2.1.4
|
|
6
|
+
env:
|
|
7
|
+
global:
|
|
8
|
+
secure: N+Yyasma8STO5NFjdcmCrn44Zf7x8SbNs6y4bv/FkB5PwcjHYG2sVU/aRB9u8V5F1TuPC7ZPHu74Q9oXgPq2GBnspCNcdvZKzFKLS7euMF+YOeXYSEl7slVvPSq9muuu5lu0cNJbflbTmSElHMXpshamSJxbr9joSvLZMDnJseHXJ+qPKEByB7YQEAFSThbStlgU3oZbRudbM65UBlwxAZ3PZnQ9voYkqPbPkH41SPhtwhLdIOVNR5EK84yypP8rOCCABsxXtfY7vM/ZQpyt/+Ty4cGHDjhiuxypwRFePr2vOqL/w9C2lRNsTRIDrt/krAh0XojIqeObn8d9ZXj+/59OGtAX5YGYKzfMg5Elar24dxUtgKoduD1MLbMBFhB6C8Ch7ULAGvtBDYFYE+0SaMguMr4ZdbxfsNDXIVHYsezLT27ZhSya8/ZOuHcWnveVTl7gktYaY8gdasyNm/uAP99m7/fFgyPYrSaxzLJXAx4EMFxHQtkNTpowETRYE9GFB77NI2QB4cH/5KeOjsvykm8ipmY5Uyfofqm5DV+vHW3zradgzeDogjgoByFlmtCmBpcnAlbmwygxZP303DlVy1pDjizbvITB5beb3HlHzvGbxFjgwvKvnDibjmsrY9NDz5Qzo7hOaJegenUrdgA8wZwV6JOD2Paz6UqKzi1x+2U=
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
0.1.8 (2021-02-03)
|
|
2
|
+
------------------
|
|
3
|
+
|
|
4
|
+
* add webmock gem
|
|
5
|
+
* add test for add_domain and domain list methods
|
|
6
|
+
* add `:host_name`, `:api_key`, and `:options` attr_reader
|
|
7
|
+
* update version to [0.1.8](https://rubygems.org/gems/short_io/versions/0.1.8)
|
|
8
|
+
|
|
9
|
+
0.1.7 (2021-01-25)
|
|
10
|
+
------------------
|
|
11
|
+
|
|
12
|
+
* add test
|
|
13
|
+
* add memoization
|
|
14
|
+
* add check_variables method to raise error when `nil` or `empty` on host name or api_key
|
|
15
|
+
* update version to [0.1.7](https://rubygems.org/gems/short_io/versions/0.1.7)
|
|
16
|
+
|
|
1
17
|
0.1.6 (2021-01-25)
|
|
2
18
|
------------------
|
|
3
19
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
short_io (0.1.
|
|
4
|
+
short_io (0.1.8)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
+
addressable (2.8.0)
|
|
10
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
11
|
+
codecov (0.6.0)
|
|
12
|
+
simplecov (>= 0.15, < 0.22)
|
|
13
|
+
crack (0.4.5)
|
|
14
|
+
rexml
|
|
15
|
+
docile (1.4.0)
|
|
16
|
+
hashdiff (1.0.1)
|
|
17
|
+
json (2.6.1)
|
|
9
18
|
minitest (5.15.0)
|
|
19
|
+
public_suffix (4.0.6)
|
|
10
20
|
rake (12.3.3)
|
|
21
|
+
rexml (3.2.5)
|
|
22
|
+
simplecov (0.16.1)
|
|
23
|
+
docile (~> 1.1)
|
|
24
|
+
json (>= 1.8, < 3)
|
|
25
|
+
simplecov-html (~> 0.10.0)
|
|
26
|
+
simplecov-html (0.10.2)
|
|
27
|
+
webmock (3.14.0)
|
|
28
|
+
addressable (>= 2.8.0)
|
|
29
|
+
crack (>= 0.3.2)
|
|
30
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
11
31
|
|
|
12
32
|
PLATFORMS
|
|
13
33
|
ruby
|
|
14
34
|
|
|
15
35
|
DEPENDENCIES
|
|
36
|
+
codecov
|
|
16
37
|
minitest (~> 5.0)
|
|
17
38
|
rake (~> 12.0)
|
|
18
39
|
short_io!
|
|
40
|
+
simplecov
|
|
41
|
+
webmock
|
|
19
42
|
|
|
20
43
|
BUNDLED WITH
|
|
21
44
|
2.1.4
|
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ShortIo
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://badge.fury.io/rb/short_io) | [](https://app.travis-ci.com/yosefbennywidyo/short_io) | [](https://codecov.io/gh/yosefbennywidyo/short_io)
|
|
4
|
+
|
|
5
|
+
A Ruby gem to use with [short.io](https://short.io)
|
|
4
6
|
|
|
5
7
|
[Short IO documentation](https://developers.short.io/docs/deleting-a-domain)
|
|
6
8
|
|
data/lib/short_io/short_url.rb
CHANGED
|
@@ -7,17 +7,26 @@ module ShortIo
|
|
|
7
7
|
class ShortUrl
|
|
8
8
|
REQUEST_TYPE = 'application/json'
|
|
9
9
|
SHORT_IO_BASE_URL = 'https://api.short.io/domains/'
|
|
10
|
+
|
|
11
|
+
attr_reader :host_name, :api_key, :options
|
|
10
12
|
|
|
11
13
|
def initialize(host_name, api_key, options={})
|
|
12
14
|
@host_name ||= host_name
|
|
13
15
|
@api_key ||= api_key
|
|
14
|
-
@hide_referer ||= options.key?(:hide_referer) ? options[:hide_referer] : false
|
|
15
|
-
@https_link ||= options.key?(:https_link) ? options[:https_link] : false
|
|
16
|
-
@link_type ||= options.key?(:link_type) ? options[:link_type] : 'random'
|
|
17
16
|
@short_io_base_url ||= SHORT_IO_BASE_URL
|
|
17
|
+
@options ||= options
|
|
18
|
+
options_default_value
|
|
18
19
|
check_variables
|
|
19
20
|
end
|
|
20
21
|
|
|
22
|
+
def options_default_value
|
|
23
|
+
@options = {
|
|
24
|
+
hide_referer: options.key?(:hide_referer) ? options[:hide_referer] : false,
|
|
25
|
+
https_link: options.key?(:https_link) ? options[:https_link] : false,
|
|
26
|
+
link_type: options.key?(:link_type) ? options[:link_type] : 'random'
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
21
30
|
def check_variables
|
|
22
31
|
raise ShortIo::HostNameError.new(host_name: 'Please provide a host name') if (@host_name.nil? || @host_name.empty?)
|
|
23
32
|
raise ShortIo::ApiKeyError.new(api_key: 'Please provide an API key') if (@api_key.nil? || @api_key.empty?)
|
|
@@ -38,15 +47,17 @@ module ShortIo
|
|
|
38
47
|
request["content-type"] = REQUEST_TYPE
|
|
39
48
|
request["authorization"] = @api_key
|
|
40
49
|
request.body = JSON.generate(
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
{
|
|
51
|
+
"hideReferer":"#{@options[:hide_referer]}",
|
|
52
|
+
"httpsLinks":"#{@options[:https_link]}",
|
|
53
|
+
"hostname":"#{@host_name}",
|
|
54
|
+
"linkType":"#{@options[:link_type]}"
|
|
55
|
+
}
|
|
45
56
|
)
|
|
46
57
|
response = @http.request(request)
|
|
47
58
|
return response.read_body
|
|
48
59
|
end
|
|
49
|
-
|
|
60
|
+
|
|
50
61
|
def domain_list
|
|
51
62
|
setup
|
|
52
63
|
request = Net::HTTP::Get.new(@url)
|
data/lib/short_io/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: short_io
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yosef Benny Widyokarsono
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|