short_io 0.1.6 → 0.1.7
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/Gemfile.lock +1 -1
- data/lib/short_io/short_url.rb +13 -7
- data/lib/short_io/version.rb +1 -1
- data/lib/short_io.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66e27baedf7c15353601fd2bc71baff3643f7f585fb25d03c742beccc0bd8f4d
|
4
|
+
data.tar.gz: 9eb89a4c0779cdbe553b43889e9768b4f6bbd55605606b28cf2184cbee53a36c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ef024ad351002d6a489ff210968c81413ef313fbdc804993bb3bfe7825f00083a4c4abef9092543b54f7bbd0de0d4267baa3cb698b307e4cac4f752c14beb32
|
7
|
+
data.tar.gz: 7384f591050e9add6c7bcd4b59d8802b304de97763f20a629af5cfc122cea86f6f205c7015a910d05a7180a9ff584bb92e3d5780476c3d3b477ae98c70946aa3
|
data/Gemfile.lock
CHANGED
data/lib/short_io/short_url.rb
CHANGED
@@ -8,13 +8,19 @@ module ShortIo
|
|
8
8
|
REQUEST_TYPE = 'application/json'
|
9
9
|
SHORT_IO_BASE_URL = 'https://api.short.io/domains/'
|
10
10
|
|
11
|
-
def initialize(host_name
|
12
|
-
@host_name
|
13
|
-
@api_key
|
14
|
-
@hide_referer
|
15
|
-
@https_link
|
16
|
-
@link_type
|
17
|
-
@short_io_base_url
|
11
|
+
def initialize(host_name, api_key, options={})
|
12
|
+
@host_name ||= host_name
|
13
|
+
@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
|
+
@short_io_base_url ||= SHORT_IO_BASE_URL
|
18
|
+
check_variables
|
19
|
+
end
|
20
|
+
|
21
|
+
def check_variables
|
22
|
+
raise ShortIo::HostNameError.new(host_name: 'Please provide a host name') if (@host_name.nil? || @host_name.empty?)
|
23
|
+
raise ShortIo::ApiKeyError.new(api_key: 'Please provide an API key') if (@api_key.nil? || @api_key.empty?)
|
18
24
|
end
|
19
25
|
|
20
26
|
def setup
|
data/lib/short_io/version.rb
CHANGED
data/lib/short_io.rb
CHANGED