micropub-endpoint 0.1.0 → 0.2.0
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/CHANGELOG.md +9 -0
- data/README.md +2 -2
- data/lib/micropub/endpoint.rb +1 -0
- data/lib/micropub/endpoint/discover.rb +9 -14
- data/lib/micropub/endpoint/version.rb +1 -1
- data/micropub-endpoint.gemspec +2 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6241a2f87a2ed02d0aa63794793b1af4a6188a7
|
4
|
+
data.tar.gz: 403b5e14381412d58ba15e1b96a355ad573c4c76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb99051e43d51898e638e09c514e08a4b25cdc08aad828c11219c3baf50f6d2f6f94a258ea77301652853b864651b8e1257e2731a92d7d6e5c8ca2a51b2cee8a
|
7
|
+
data.tar.gz: fd405635d6f864e65aa6c72050ca6f1857bcf07844be358dc938bc7dc9239f39b198f437b3be6bd39ea0307d63e53b79640e945c3d3662afeaa824e94c9784a4
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.2.0 / 2018-07-05
|
4
|
+
|
5
|
+
- Add [Absolutely](https://github.com/jgarber623/absolutely) gem dependency for handling conversion of relative URLs to absolute URLs ([d17fe1e](https://github.com/jgarber623/micropub-endpoint-ruby/commit/d17fe1e)).
|
6
|
+
|
7
|
+
## 0.1.0 / 2018-06-30
|
8
|
+
|
9
|
+
- Initial release!
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
Before installing and using micropub-endpoint-ruby, you'll want to have [Ruby](https://www.ruby-lang.org) 2.4 (or newer) installed. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm).
|
20
20
|
|
21
|
-
micropub-endpoint-ruby is developed using Ruby 2.4.4 and is additionally tested against Ruby 2.5.1 using [Travis CI](https://travis-ci.
|
21
|
+
micropub-endpoint-ruby is developed using Ruby 2.4.4 and is additionally tested against Ruby 2.5.1 using [Travis CI](https://travis-ci.com/jgarber623/micropub-endpoint-ruby).
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
@@ -82,7 +82,7 @@ puts discoverer.response # returns HTTP::Response
|
|
82
82
|
|
83
83
|
There are several exceptions that may be raised by micropub-endpoint-ruby's underlying dependencies. These errors are raised as subclasses of `Micropub::Endpoint::Error` (which itself is a subclass of `StandardError`).
|
84
84
|
|
85
|
-
From [sporkmonger/addressable](https://github.com/sporkmonger/addressable):
|
85
|
+
From [jgarber623/absolutely](https://github.com/jgarber623/absolutely) and [sporkmonger/addressable](https://github.com/sporkmonger/addressable):
|
86
86
|
|
87
87
|
- `Micropub::Endpoint::InvalidURIError`
|
88
88
|
|
data/lib/micropub/endpoint.rb
CHANGED
@@ -30,7 +30,11 @@ module Micropub
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def endpoint
|
33
|
-
|
33
|
+
return unless endpoint_from_http_request
|
34
|
+
|
35
|
+
@endpoint ||= Absolutely.to_absolute_uri(base: url, relative: endpoint_from_http_request)
|
36
|
+
rescue Absolutely::InvalidURIError => error
|
37
|
+
raise InvalidURIError, error
|
34
38
|
end
|
35
39
|
|
36
40
|
def response
|
@@ -48,19 +52,6 @@ module Micropub
|
|
48
52
|
|
49
53
|
private
|
50
54
|
|
51
|
-
def absolutize(base:, relative:)
|
52
|
-
return unless relative
|
53
|
-
|
54
|
-
base_uri = Addressable::URI.parse(base)
|
55
|
-
relative_uri = Addressable::URI.parse(relative)
|
56
|
-
|
57
|
-
return relative if relative_uri.absolute?
|
58
|
-
|
59
|
-
(base_uri + relative_uri).to_s
|
60
|
-
rescue Addressable::URI::InvalidURIError => error
|
61
|
-
raise InvalidURIError, error
|
62
|
-
end
|
63
|
-
|
64
55
|
def endpoint_from_body
|
65
56
|
return unless response.mime_type == 'text/html'
|
66
57
|
|
@@ -88,6 +79,10 @@ module Micropub
|
|
88
79
|
|
89
80
|
return endpoint_match_data[1] if endpoint_match_data
|
90
81
|
end
|
82
|
+
|
83
|
+
def endpoint_from_http_request
|
84
|
+
@endpoint_from_http_request ||= endpoint_from_headers || endpoint_from_body || nil
|
85
|
+
end
|
91
86
|
end
|
92
87
|
end
|
93
88
|
end
|
data/micropub-endpoint.gemspec
CHANGED
@@ -29,7 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'simplecov-console', '~> 0.4.2'
|
30
30
|
spec.add_development_dependency 'webmock', '~> 3.4', '>= 3.4.2'
|
31
31
|
|
32
|
+
spec.add_runtime_dependency 'absolutely', '~> 1.0'
|
32
33
|
spec.add_runtime_dependency 'addressable', '~> 2.5', '>= 2.5.2'
|
33
34
|
spec.add_runtime_dependency 'http', '~> 3.3'
|
34
|
-
spec.add_runtime_dependency 'nokogiri', '~> 1.8', '>= 1.8.
|
35
|
+
spec.add_runtime_dependency 'nokogiri', '~> 1.8', '>= 1.8.4'
|
35
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micropub-endpoint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Garber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -140,6 +140,20 @@ dependencies:
|
|
140
140
|
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: 3.4.2
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: absolutely
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.0'
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - "~>"
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '1.0'
|
143
157
|
- !ruby/object:Gem::Dependency
|
144
158
|
name: addressable
|
145
159
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,7 +197,7 @@ dependencies:
|
|
183
197
|
version: '1.8'
|
184
198
|
- - ">="
|
185
199
|
- !ruby/object:Gem::Version
|
186
|
-
version: 1.8.
|
200
|
+
version: 1.8.4
|
187
201
|
type: :runtime
|
188
202
|
prerelease: false
|
189
203
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -193,7 +207,7 @@ dependencies:
|
|
193
207
|
version: '1.8'
|
194
208
|
- - ">="
|
195
209
|
- !ruby/object:Gem::Version
|
196
|
-
version: 1.8.
|
210
|
+
version: 1.8.4
|
197
211
|
description: Discover a URL’s Micropub endpoint.
|
198
212
|
email:
|
199
213
|
- jason@sixtwothree.org
|
@@ -209,6 +223,7 @@ files:
|
|
209
223
|
- ".ruby-version"
|
210
224
|
- ".simplecov"
|
211
225
|
- ".travis.yml"
|
226
|
+
- CHANGELOG.md
|
212
227
|
- CONTRIBUTING.md
|
213
228
|
- Gemfile
|
214
229
|
- LICENSE
|