truncus 0.1.0 → 0.2.1.3

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
  SHA1:
3
- metadata.gz: 3b896e7f66991c5fb2445d4695cd88aff3ffeeb1
4
- data.tar.gz: 48c86c18067d3a477e822e660b0cd5613bf66573
3
+ metadata.gz: 1b1fba8130ef8909b62c221cd047cdf31a2c9f09
4
+ data.tar.gz: f67b9495bb4e790df1ca304846c3921f712617aa
5
5
  SHA512:
6
- metadata.gz: 7ae8bcd38b3d58d63243f3fc706457845c2f330549aea11350be0cd485580c6cf2a730ac1a1efb9d5414dfd758e63ab56128748256f2f8bd43e0aa28f5699b8b
7
- data.tar.gz: a7e592fe477f0259dc0037ebb380fe94d1725ea79b8ae48082f437c4f265f8064138e0105088e68d8f1fb1b6efaaebee0d9599eb9a1672a8e7b1bc5c12da76bb
6
+ metadata.gz: cde332cb85551ab7f02d325b05ca6d2fed19619cf4b0ecde38cb7eeb4a52a622f12082c73465df31fb4e8bc7ef72d51f16ae84b4a4472dfda9926da6f1b9e800
7
+ data.tar.gz: 96116789ca324028b5ef3f0bf42ad63813cb1ce21007ed7d3c9030cf97885eb3e3960cc8a385667accc90a02491e122a663a3c25852e21e384e1a2bddf031856
data/.rspec_status CHANGED
@@ -1,6 +1,6 @@
1
1
  example_id | status | run_time |
2
2
  ----------------------------- | ------ | --------------- |
3
- ./spec/truncus_spec.rb[1:1] | passed | 0.00089 seconds |
4
- ./spec/truncus_spec.rb[1:2:1] | passed | 0.01789 seconds |
5
- ./spec/truncus_spec.rb[1:3:1] | passed | 0.01291 seconds |
6
- ./spec/truncus_spec.rb[1:4:1] | passed | 0.00264 seconds |
3
+ ./spec/truncus_spec.rb[1:1] | passed | 0.00267 seconds |
4
+ ./spec/truncus_spec.rb[1:2:1] | passed | 0.0128 seconds |
5
+ ./spec/truncus_spec.rb[1:3:1] | passed | 0.02836 seconds |
6
+ ./spec/truncus_spec.rb[1:4:1] | passed | 0.0035 seconds |
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.1
1
+ ruby-2.0.0-p648
data/Gemfile.lock CHANGED
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- truncus (0.1.0)
5
- json
4
+ truncus (0.2.2)
5
+ json (~> 2.1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.5.2)
11
- public_suffix (>= 2.0.2, < 4.0)
10
+ addressable (2.8.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
12
  crack (0.4.3)
13
13
  safe_yaml (~> 1.0.0)
14
14
  diff-lcs (1.3)
15
15
  hashdiff (0.3.7)
16
16
  json (2.1.0)
17
- public_suffix (3.0.2)
18
- rake (10.5.0)
17
+ public_suffix (2.0.5)
18
+ rake (12.3.3)
19
19
  rspec (3.7.0)
20
20
  rspec-core (~> 3.7.0)
21
21
  rspec-expectations (~> 3.7.0)
@@ -41,11 +41,12 @@ PLATFORMS
41
41
 
42
42
  DEPENDENCIES
43
43
  bundler (~> 1.14)
44
- rake (~> 10.0)
44
+ public_suffix (~> 2.0)
45
+ rake (~> 12.3.3)
45
46
  rspec (~> 3.0)
46
47
  truncus!
47
48
  vcr (~> 3.0)
48
49
  webmock (~> 3.0)
49
50
 
50
51
  BUNDLED WITH
51
- 1.14.6
52
+ 1.17.3
@@ -1,3 +1,3 @@
1
1
  module Truncus
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.1.3"
3
3
  end
data/lib/truncus.rb CHANGED
@@ -5,7 +5,6 @@ require 'net/http'
5
5
 
6
6
 
7
7
  module Truncus
8
-
9
8
  class Client
10
9
  attr_accessor :host, :port
11
10
 
@@ -15,37 +14,40 @@ module Truncus
15
14
 
16
15
  @http ||= Net::HTTP.new(host, port)
17
16
  @http.use_ssl = use_ssl?
17
+ @http.verify_mode = options[:ssl_verify_mode] if options[:ssl_verify_mode]
18
18
  end
19
19
 
20
20
 
21
21
  # Convenience for instantiating a Client and retrieving a shortened url
22
22
  def self.expand_token(token)
23
- @client ||= new
24
- @client.expand_token(token)
23
+ new.expand_token(token)
25
24
  end
26
25
 
27
26
 
28
27
  # Convenience for instantiating a Client, shortening a url,
29
28
  # and returning the shortened token
30
29
  def self.get_token(url)
31
- @client ||= new
32
- @client.get_token(url)
30
+ new.get_token(url)
33
31
  end
34
32
 
35
33
 
36
34
  # Convenience for instantiating a Client, shortening a url,
37
35
  # and returning it as a full url to the shortened version.
38
36
  def self.get_url(url)
39
- @client ||= new
40
- token = @client.get_token(url)
41
- "http#{'s' if @client.use_ssl?}://#{@client.host}/#{token}"
37
+ new.get_url(url)
38
+ end
39
+
40
+
41
+ def get_url(url)
42
+ token = get_token(url)
43
+ "http#{'s' if use_ssl?}://#{host}/#{token}"
42
44
  end
43
45
 
44
46
 
45
47
  # Shortens a URL, returns the shortened token
46
48
  def get_token(url)
47
- req = Net::HTTP::Post.new('/', initheader = {'Content-Type': 'application/json'})
48
- req.body = {'url': url, 'format': 'json'}.to_json
49
+ req = Net::HTTP::Post.new('/', initheader = {'Content-Type' => 'application/json'})
50
+ req.body = {url: url, format: 'json'}.to_json
49
51
 
50
52
  res = @http.request(req)
51
53
  data = JSON::parse(res.body)
@@ -67,8 +69,5 @@ module Truncus
67
69
  def use_ssl?
68
70
  port.to_i == 443
69
71
  end
70
-
71
72
  end
72
-
73
-
74
73
  end
data/truncus.gemspec CHANGED
@@ -29,10 +29,13 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
+ spec.required_ruby_version = ">= 2.0"
33
+
32
34
  spec.add_dependency 'json'
33
35
 
34
36
  spec.add_development_dependency "bundler", "~> 1.14"
35
- spec.add_development_dependency "rake", "~> 10.0"
37
+ spec.add_development_dependency "rake", "~> 12.3.3"
38
+ spec.add_development_dependency "public_suffix", "~> 2.0"
36
39
  spec.add_development_dependency "rspec", "~> 3.0"
37
40
  spec.add_development_dependency "vcr", "~> 3.0"
38
41
  spec.add_development_dependency "webmock", "~> 3.0"
metadata CHANGED
@@ -1,112 +1,126 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: truncus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Emminger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-14 00:00:00.000000000 Z
11
+ date: 2021-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.14'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.14'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: 12.3.3
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: 12.3.3
55
+ - !ruby/object:Gem::Dependency
56
+ name: public_suffix
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rspec
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ~>
60
74
  - !ruby/object:Gem::Version
61
75
  version: '3.0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ~>
67
81
  - !ruby/object:Gem::Version
68
82
  version: '3.0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: vcr
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ~>
74
88
  - !ruby/object:Gem::Version
75
89
  version: '3.0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ~>
81
95
  - !ruby/object:Gem::Version
82
96
  version: '3.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: webmock
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ~>
88
102
  - !ruby/object:Gem::Version
89
103
  version: '3.0'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ~>
95
109
  - !ruby/object:Gem::Version
96
110
  version: '3.0'
97
- description:
111
+ description:
98
112
  email:
99
113
  - jeff@7compass.com
100
114
  executables: []
101
115
  extensions: []
102
116
  extra_rdoc_files: []
103
117
  files:
104
- - ".gitignore"
105
- - ".rspec"
106
- - ".rspec_status"
107
- - ".ruby-gemset"
108
- - ".ruby-version"
109
- - ".travis.yml"
118
+ - .gitignore
119
+ - .rspec
120
+ - .rspec_status
121
+ - .ruby-gemset
122
+ - .ruby-version
123
+ - .travis.yml
110
124
  - Gemfile
111
125
  - Gemfile.lock
112
126
  - LICENSE
@@ -125,24 +139,24 @@ licenses:
125
139
  - MIT
126
140
  metadata:
127
141
  allowed_push_host: https://rubygems.org
128
- post_install_message:
142
+ post_install_message:
129
143
  rdoc_options: []
130
144
  require_paths:
131
145
  - lib
132
146
  required_ruby_version: !ruby/object:Gem::Requirement
133
147
  requirements:
134
- - - ">="
148
+ - - '>='
135
149
  - !ruby/object:Gem::Version
136
- version: '0'
150
+ version: '2.0'
137
151
  required_rubygems_version: !ruby/object:Gem::Requirement
138
152
  requirements:
139
- - - ">="
153
+ - - '>='
140
154
  - !ruby/object:Gem::Version
141
155
  version: '0'
142
156
  requirements: []
143
- rubyforge_project:
144
- rubygems_version: 2.6.12
145
- signing_key:
157
+ rubyforge_project:
158
+ rubygems_version: 2.0.14.1
159
+ signing_key:
146
160
  specification_version: 4
147
161
  summary: A client for the trunc.us link shortening service
148
162
  test_files: []