short_io 0.1.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcfd6e8dec7255a49dcb6d470d5720a8fd7ecd2f8c3beace223b8eddf95b1fd3
4
- data.tar.gz: b196ea60c99c0c9d52b4197dc727fb5237eb162a597a30a029e6bb23c2f6d250
3
+ metadata.gz: 66e27baedf7c15353601fd2bc71baff3643f7f585fb25d03c742beccc0bd8f4d
4
+ data.tar.gz: 9eb89a4c0779cdbe553b43889e9768b4f6bbd55605606b28cf2184cbee53a36c
5
5
  SHA512:
6
- metadata.gz: 22d26a82876f6c20936d61113b806cc35b8bcbaeb6f4d3c676c12490e1dbdbe6caff63f1651ba47f67eb0c47b388d09537f8a0182a1cde215f2d6a02ec8b23de
7
- data.tar.gz: 51f3dd63b47e9786396e038f7275e6aaa1158c3a6e2f7d2dbeab22ff24587703973dc0a431a6f123c7620fa610cf5fc20b9e139ece2e23c0c3392f1e9486df1e
6
+ metadata.gz: 7ef024ad351002d6a489ff210968c81413ef313fbdc804993bb3bfe7825f00083a4c4abef9092543b54f7bbd0de0d4267baa3cb698b307e4cac4f752c14beb32
7
+ data.tar.gz: 7384f591050e9add6c7bcd4b59d8802b304de97763f20a629af5cfc122cea86f6f205c7015a910d05a7180a9ff584bb92e3d5780476c3d3b477ae98c70946aa3
data/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ 0.1.6 (2021-01-25)
2
+ ------------------
3
+
4
+ * fix version on CHANGELOG.md
5
+ * update version to [0.1.6](https://rubygems.org/gems/short_io/versions/0.1.6)
6
+
7
+ 0.1.5 (2021-01-25)
8
+ ------------------
9
+
10
+ * fix CHANGELOG.md path
11
+ * update version to [0.1.5](https://rubygems.org/gems/short_io/versions/0.1.5)
12
+
13
+ 0.1.4 (2021-01-25)
14
+ ------------------
15
+
16
+ * add CHANGELOG.md
17
+ * update version to [0.1.4](https://rubygems.org/gems/short_io/versions/0.1.4)
18
+
19
+ 0.1.3 (2021-01-25)
20
+ ------------------
21
+
22
+ * add Gemfile.lock
23
+ * update version to [0.1.3](https://rubygems.org/gems/short_io/versions/0.1.3)
24
+
25
+ 0.1.2 (2021-01-25)
26
+ ------------------
27
+
28
+ * fix sample usage on README.md
29
+ * update version to [0.1.2](https://rubygems.org/gems/short_io/versions/0.1.2)
30
+
31
+ 0.1.1 (2021-01-25)
32
+ ------------------
33
+
34
+ * update version to [0.1.1](https://rubygems.org/gems/short_io/versions/0.1.1) (no changes)
35
+
36
+ 0.1.0 (2021-01-25)
37
+ ------------------
38
+
39
+ * [YANKED](https://rubygems.org/gems/short_io/versions/0.1.0) Start create `short_io` gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- short_io (0.1.3)
4
+ short_io (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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 = 'example.com', api_key = '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 = 'https://api.short.io/domains/'
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
@@ -1,3 +1,3 @@
1
1
  module ShortIo
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/short_io.rb CHANGED
@@ -3,5 +3,7 @@ require "short_io/short_url"
3
3
 
4
4
  module ShortIo
5
5
  class Error < StandardError; end
6
+ class HostNameError < Error; end
7
+ class ApiKeyError < Error; end
6
8
  # Your code goes here...
7
9
  end
data/short_io.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/yosefbennywidyo/short_io"
19
- spec.metadata["changelog_uri"] = "https://github.com/yosefbennywidyo/short_io/CHANGELOG.md"
19
+ spec.metadata["changelog_uri"] = "https://github.com/yosefbennywidyo/short_io/blob/main/CHANGELOG.md"
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
22
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: short_io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yosef Benny Widyokarsono
@@ -19,6 +19,7 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - ".gitignore"
21
21
  - ".travis.yml"
22
+ - CHANGELOG.md
22
23
  - CODE_OF_CONDUCT.md
23
24
  - Gemfile
24
25
  - Gemfile.lock
@@ -37,7 +38,7 @@ licenses:
37
38
  metadata:
38
39
  homepage_uri: https://github.com/yosefbennywidyo/short_io
39
40
  source_code_uri: https://github.com/yosefbennywidyo/short_io
40
- changelog_uri: https://github.com/yosefbennywidyo/short_io/CHANGELOG.md
41
+ changelog_uri: https://github.com/yosefbennywidyo/short_io/blob/main/CHANGELOG.md
41
42
  post_install_message:
42
43
  rdoc_options: []
43
44
  require_paths: