short_io 0.1.8 → 0.1.9

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: '01299ccaa6348aa2c516c54877e28d7c12ffd318056ba5b862c470ef87f0a7dc'
4
- data.tar.gz: 619507d110ac39cb4f7930381e30a8c049449249d06bfbc291b77cb1075e5c49
3
+ metadata.gz: d35d4b4870871ee21159f3e60963f1ae02af40dccdb9bc0ee518a65593c2b190
4
+ data.tar.gz: f7ed37b624cebc677b3139356007818c1c654972ea0f49b83be553c6fe660736
5
5
  SHA512:
6
- metadata.gz: b5f397a7d6bee167a5f69da748738f2abd85c052b78adc9cca1f6ace7ce88fd57bf7d77ec32770e5758dffe42d64697986e72b78a5610243fcbe733e960667b6
7
- data.tar.gz: 98f790b50b2f830052ac8d6a0e7f8c2b78f9e5c9f052e5ed794abbb2eef641de75df76cb83c2cae4e31ccf387ee30c8e6ea00f167e2c5d4f23bb4db43b5f469e
6
+ metadata.gz: fc8411a577139d9341cbe90b536ce6d042da4c36621f029d2a4c4588a5406ec8c9c1d4f9e87e73dfd426d7ceeff18640f5233a07451625db73219fce3f82bd13
7
+ data.tar.gz: a4bd6d18d129e60ac8f9e50f9244e1c883d1ca411bbbd9217cc4fbbacd8ef4e50ba6def774fb3c9ff9a16a7b929cb9fe5a137e236947b9af9976cf01b2b6ba7b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ 0.1.9 (2021-02-03)
2
+ ------------------
3
+
4
+ * add documentation
5
+ * update version to [0.1.9](https://rubygems.org/gems/short_io/versions/0.1.9)
6
+
1
7
  0.1.8 (2021-02-03)
2
8
  ------------------
3
9
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- short_io (0.1.8)
4
+ short_io (0.1.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -3,7 +3,9 @@ require 'net/http'
3
3
  require 'openssl'
4
4
  require 'json'
5
5
 
6
+ # @author Yosef Benny Widyokarsono
6
7
  module ShortIo
8
+ # Add domain and list domains registerd to Short.io
7
9
  class ShortUrl
8
10
  REQUEST_TYPE = 'application/json'
9
11
  SHORT_IO_BASE_URL = 'https://api.short.io/domains/'
@@ -19,6 +21,10 @@ module ShortIo
19
21
  check_variables
20
22
  end
21
23
 
24
+ # Options Default Value
25
+ #
26
+ # @return [Hash] return default options in Hash if no value provided.
27
+
22
28
  def options_default_value
23
29
  @options = {
24
30
  hide_referer: options.key?(:hide_referer) ? options[:hide_referer] : false,
@@ -27,11 +33,18 @@ module ShortIo
27
33
  }
28
34
  end
29
35
 
36
+ # Check Variables
37
+ #
38
+ # @raise [HostNameError] if no Host Name provided.
39
+ # @raise [ApiKeyError] if no API Key provided.
40
+
30
41
  def check_variables
31
42
  raise ShortIo::HostNameError.new(host_name: 'Please provide a host name') if (@host_name.nil? || @host_name.empty?)
32
43
  raise ShortIo::ApiKeyError.new(api_key: 'Please provide an API key') if (@api_key.nil? || @api_key.empty?)
33
44
  end
34
45
 
46
+ # Prepare request
47
+
35
48
  def setup
36
49
  @url = URI(SHORT_IO_BASE_URL)
37
50
  @http = Net::HTTP.new(@url.host, @url.port)
@@ -39,6 +52,30 @@ module ShortIo
39
52
  @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
40
53
  end
41
54
 
55
+ # Add new domain
56
+ #
57
+ # @return [JSON] return in JSON format.
58
+ #
59
+ # @example
60
+ # ShortIo::ShortUrl.new('example.com', 'YOUR_API_KEY').add_domain
61
+ # {
62
+ # linkType: 'random',
63
+ # state: 'configured',
64
+ # cloaking: false,
65
+ # setupType: 'dns',
66
+ # httpsLinks: false,
67
+ # id: 91576,
68
+ # hostname: 'yourdomain.com',
69
+ # UserId: 9346,
70
+ # updatedAt: '2022-02-03T10:22:47.010Z',
71
+ # createdAt: '2022-02-03T10:22:46.649Z',
72
+ # provider: null,
73
+ # unicodeHostname: 'urdomain.com',
74
+ # clientStorage: null
75
+ # }
76
+ #
77
+ # @see https://developers.short.io/docs/adding-a-domain
78
+
42
79
  def add_domain
43
80
  setup
44
81
 
@@ -57,6 +94,12 @@ module ShortIo
57
94
  response = @http.request(request)
58
95
  return response.read_body
59
96
  end
97
+
98
+ # Domain List
99
+ #
100
+ # @return [JSON] return domain list in JSON format.
101
+ #
102
+ # @see https://developers.short.io/docs/getting-a-list-of-domains
60
103
 
61
104
  def domain_list
62
105
  setup
@@ -1,3 +1,3 @@
1
1
  module ShortIo
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
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.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yosef Benny Widyokarsono