ldp 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07302d4ea3cfb46440729b6b2a0560944b3617bf44e8a95c72d301b2f0308e35
4
- data.tar.gz: 65edd6ba276a5b0090bb2bda020de89ac8418c13a1ef59f2c7d4e8d2193c1072
3
+ metadata.gz: 1292f0783e5dbbac8756e2bb231e3b807d2fc4a6362c29ad898b11406800badb
4
+ data.tar.gz: 90d6d5f39a982e5b21f845f2df181da819f7a8f16fd6dcbb7a9330745bcce87e
5
5
  SHA512:
6
- metadata.gz: af7729aad60c6bbd31e98c2dd99930a2acdbef3bab8a11a14a300bcfc3089eb729e15cf041f60b112338c36445e102ec33feeb06f29d616d5535085e1a68f592
7
- data.tar.gz: 45604e810f67b04ac822936e9e67d7dbc56db403ca5f4f7e5fa7f44d003595b63862838abf4a69ea2f63feebecc5c652b7dd14690cb54cae193af58ce42901fd
6
+ metadata.gz: a18af2e7305a8b67a7bbb5bb2f87736039fbe9177c702233f34097b68eee40725d761623786cdf54e370968f34040d89568fb28f8b1914bf72e80c79c09216e8
7
+ data.tar.gz: b1d62be49e8386ba9dd9abbc2e00cf8afc6c82f8b2b4edd36c94052bff51403d0629ebe84aef3a4ce9793e4a8ad9958658fbbee2bca28d554b0b98a0b247dd4a
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- samvera: samvera/circleci-orb@0
3
+ samvera: samvera/circleci-orb@1.0
4
4
  jobs:
5
5
  bundle_and_test:
6
6
  parameters:
@@ -22,14 +22,24 @@ jobs:
22
22
  RAILS_VERSION: << parameters.rails_version >>
23
23
  working_directory: ~/project
24
24
  steps:
25
- - run: sudo apt-get update && sudo apt-get install libgmp-dev
25
+ - run: sudo apt-get update
26
+ - run: sudo apt-get install libgmp-dev
26
27
 
27
28
  - samvera/cached_checkout
28
29
 
29
- - samvera/bundle_for_gem:
30
+ - run:
31
+ name: Check for a branch named 'master'
32
+ command: |
33
+ git fetch --all --quiet --prune --prune-tags
34
+ if [[ -n "$(git branch --all --list master */master)" ]]; then
35
+ echo "A branch named 'master' was found. Please remove it."
36
+ echo "$(git branch --all --list master */master)"
37
+ fi
38
+ [[ -z "$(git branch --all --list master */master)" ]]
39
+
40
+ - samvera/bundle:
30
41
  ruby_version: << parameters.ruby_version >>
31
42
  bundler_version: << parameters.bundler_version >>
32
- project: ldp
33
43
 
34
44
  - samvera/rubocop
35
45
 
@@ -38,47 +48,110 @@ jobs:
38
48
  workflows:
39
49
  ci:
40
50
  jobs:
51
+ # Rails 7.0
41
52
  - bundle_and_test:
42
- name: ruby2-7_rails6-0
43
- ruby_version: 2.7.0
44
- rails_version: 6.0.2
53
+ name: ruby3-1_rails7-0
54
+ ruby_version: 3.1.3
55
+ rails_version: 7.0.4
56
+ - bundle_and_test:
57
+ name: ruby3-0_rails7-0
58
+ ruby_version: 3.0.5
59
+ rails_version: 7.0.4
60
+ - bundle_and_test:
61
+ name: ruby2-7_rails7-0
62
+ ruby_version: 2.7.7
63
+ rails_version: 7.0.4
64
+ # Rails 6.1
65
+ - bundle_and_test:
66
+ name: ruby3-1_rails6-1
67
+ ruby_version: 3.1.3
68
+ rails_version: 6.1.7
45
69
  - bundle_and_test:
46
- name: ruby2-6_rails6-0
47
- ruby_version: 2.6.5
48
- rails_version: 6.0.2
70
+ name: ruby3-0_rails6-1
71
+ ruby_version: 3.0.5
72
+ rails_version: 6.1.7
73
+ - bundle_and_test:
74
+ name: ruby2-7_rails6-1
75
+ ruby_version: 2.7.7
76
+ rails_version: 6.1.7
77
+ # Rails 6.0
78
+ - bundle_and_test:
79
+ name: ruby3-1_rails6-0
80
+ ruby_version: 3.1.3
81
+ rails_version: 6.0.6
82
+ - bundle_and_test:
83
+ name: ruby3-0_rails6-0
84
+ ruby_version: 3.0.5
85
+ rails_version: 6.0.6
86
+ - bundle_and_test:
87
+ name: ruby2-7_rails6-0
88
+ ruby_version: 2.7.7
89
+ rails_version: 6.0.6
90
+ # Rails 5.2
49
91
  - bundle_and_test:
50
- name: ruby2-5_rails6-0
51
- ruby_version: 2.5.7
52
- rails_version: 6.0.2
92
+ name: ruby3-0_rails5-2
93
+ ruby_version: 3.0.5
94
+ rails_version: 5.2.8.1
53
95
  - bundle_and_test:
54
96
  name: ruby2-7_rails5-2
55
- ruby_version: 2.7.0
56
- rails_version: 5.2.4
97
+ ruby_version: 2.7.7
98
+ rails_version: 5.2.8.1
99
+
100
+ nightly:
101
+ triggers:
102
+ - schedule:
103
+ cron: "0 0 * * *"
104
+ filters:
105
+ branches:
106
+ only:
107
+ - main
108
+
109
+ jobs:
110
+ # Rails 7.0
111
+ - bundle_and_test:
112
+ name: ruby3-1_rails7-0
113
+ ruby_version: 3.1.3
114
+ rails_version: 7.0.4
115
+ - bundle_and_test:
116
+ name: ruby3-0_rails7-0
117
+ ruby_version: 3.0.5
118
+ rails_version: 7.0.4
57
119
  - bundle_and_test:
58
- name: ruby2-6_rails5-2
59
- ruby_version: 2.6.5
60
- rails_version: 5.2.4
120
+ name: ruby2-7_rails7-0
121
+ ruby_version: 2.7.7
122
+ rails_version: 7.0.4
123
+ # Rails 6.1
61
124
  - bundle_and_test:
62
- name: ruby2-5_rails5-2
63
- ruby_version: 2.5.7
64
- rails_version: 5.2.4
125
+ name: ruby3-1_rails6-1
126
+ ruby_version: 3.1.3
127
+ rails_version: 6.1.7
65
128
  - bundle_and_test:
66
- name: ruby2-4_rails5-2
67
- ruby_version: 2.4.6
68
- rails_version: 5.2.4
129
+ name: ruby3-0_rails6-1
130
+ ruby_version: 3.0.5
131
+ rails_version: 6.1.7
69
132
  - bundle_and_test:
70
- name: ruby2-7_rails5-1
71
- ruby_version: 2.7.0
72
- rails_version: 5.1.7
133
+ name: ruby2-7_rails6-1
134
+ ruby_version: 2.7.7
135
+ rails_version: 6.1.7
136
+ # Rails 6.0
73
137
  - bundle_and_test:
74
- name: ruby2-6_rails5-1
75
- ruby_version: 2.6.5
76
- rails_version: 5.1.7
138
+ name: ruby3-1_rails6-0
139
+ ruby_version: 3.1.3
140
+ rails_version: 6.0.6
77
141
  - bundle_and_test:
78
- name: ruby2-5_rails5-1
79
- ruby_version: 2.5.7
80
- rails_version: 5.1.7
142
+ name: ruby3-0_rails6-0
143
+ ruby_version: 3.0.5
144
+ rails_version: 6.0.6
81
145
  - bundle_and_test:
82
- name: ruby2-4_rails5-1
83
- ruby_version: 2.4.6
84
- rails_version: 5.1.7
146
+ name: ruby2-7_rails6-0
147
+ ruby_version: 2.7.7
148
+ rails_version: 6.0.6
149
+ # Rails 5.2
150
+ - bundle_and_test:
151
+ name: ruby3-0_rails5-2
152
+ ruby_version: 3.0.5
153
+ rails_version: 5.2.8.1
154
+ - bundle_and_test:
155
+ name: ruby2-7_rails5-2
156
+ ruby_version: 2.7.7
157
+ rails_version: 5.2.8.1
data/.rubocop.yml CHANGED
@@ -14,6 +14,10 @@ Bundler/DuplicatedGem:
14
14
  Exclude:
15
15
  - 'Gemfile'
16
16
 
17
+ Metrics/AbcSize:
18
+ Exclude:
19
+ - 'lib/ldp/client/methods.rb'
20
+
17
21
  Metrics/BlockLength:
18
22
  Exclude:
19
23
  - ldp.gemspec
data/CONTRIBUTING.md CHANGED
@@ -67,15 +67,22 @@ further details.
67
67
 
68
68
  * Fork the repository on GitHub
69
69
  * Create a topic branch from where you want to base your work.
70
- * This is usually the master branch.
71
- * To quickly create a topic branch based on master; `git branch fix/master/my_contribution master`
72
- * Then checkout the new branch with `git checkout fix/master/my_contribution`.
73
- * Please avoid working directly on the `master` branch.
70
+ * This is usually the `main` branch.
71
+ * To quickly create a topic branch based on `main`; `git branch fix/main/my_contribution main`
72
+ * Then checkout the new branch with `git checkout fix/main/my_contribution`.
73
+ * Please avoid working directly on the `main` branch.
74
+ * Please do not create a branch called `master`. (See note below.)
74
75
  * You may find the [hub suite of commands](https://github.com/defunkt/hub) helpful
75
76
  * Make sure you have added sufficient tests and documentation for your changes.
76
77
  * Test functionality with RSpec; Test features / UI with Capybara.
77
78
  * Run _all_ the tests to assure nothing else was accidentally broken.
78
79
 
80
+ NOTE: This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct)
81
+ and [language recommendations](#language).
82
+ Please ***do not*** create a branch called `master` for this repository or as part of
83
+ your pull request; the branch will either need to be removed or renamed before it can
84
+ be considered for inclusion in the code base and history of this repository.
85
+
79
86
  ### Documenting Code
80
87
 
81
88
  * All new public methods, modules, and classes should include inline documentation in [YARD](http://yardoc.org/).
@@ -131,15 +138,15 @@ further details.
131
138
  ### Submitting Changes
132
139
 
133
140
  * Read the article ["Using Pull Requests"](https://help.github.com/articles/using-pull-requests) on GitHub.
134
- * Make sure your branch is up to date with its parent branch (i.e. master)
135
- * `git checkout master`
141
+ * Make sure your branch is up to date with its parent branch (i.e. main)
142
+ * `git checkout main`
136
143
  * `git pull --rebase`
137
144
  * `git checkout <your-branch>`
138
- * `git rebase master`
145
+ * `git rebase main`
139
146
  * It is a good idea to run your tests again.
140
147
  * If you've made more than one commit take a moment to consider whether squashing commits together would help improve their logical grouping.
141
148
  * [Detailed Walkthrough of One Pull Request per Commit](http://ndlib.github.io/practices/one-commit-per-pull-request/)
142
- * `git rebase --interactive master` ([See Github help](https://help.github.com/articles/interactive-rebase))
149
+ * `git rebase --interactive main` ([See Github help](https://help.github.com/articles/interactive-rebase))
143
150
  * Squashing your branch's changes into one commit is "good form" and helps the person merging your request to see everything that is going on.
144
151
  * Push your changes to a topic branch in your fork of the repository.
145
152
  * Submit a pull request from your fork to the project.
@@ -149,12 +156,14 @@ further details.
149
156
  We adopted [Github's Pull Request Review](https://help.github.com/articles/about-pull-request-reviews/) for our repositories.
150
157
  Common checks that may occur in our repositories:
151
158
 
152
- 1. Travis CI - where our automated tests are running
153
- 2. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
159
+ 1. [CircleCI](https://circleci.com/gh/samvera) - where our automated tests are running
160
+ 2. RuboCop/Bixby - where we check for style violations
161
+ 3. Approval Required - Github enforces at least one person approve a pull request. Also, all reviewers that have chimed in must approve.
162
+ 4. CodeClimate - is our code remaining healthy (at least according to static code analysis)
154
163
 
155
164
  If one or more of the required checks failed (or are incomplete), the code should not be merged (and the UI will not allow it). If all of the checks have passed, then anyone on the project (including the pull request submitter) may merge the code.
156
165
 
157
- *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (Travis CI is usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
166
+ *Example: Carolyn submits a pull request, Justin reviews the pull request and approves. However, Justin is still waiting on other checks (CI tests are usually the culprit), so he does not merge the pull request. Eventually, all of the checks pass. At this point, Carolyn or anyone else may merge the pull request.*
158
167
 
159
168
  #### Things to Consider When Reviewing
160
169
 
@@ -171,7 +180,7 @@ This is your chance for a mentoring moment of another developer. Take time to gi
171
180
  * Do new or changed methods, modules, and classes have documentation?
172
181
  * Does the commit contain more than it should? Are two separate concerns being addressed in one commit?
173
182
  * Does the description of the new/changed specs match your understanding of what the spec is doing?
174
- * Did the Travis tests complete successfully?
183
+ * Did the Continuous Integration tests complete successfully?
175
184
 
176
185
  If you are uncertain, bring other contributors into the conversation by assigning them as a reviewer.
177
186
 
data/Gemfile CHANGED
@@ -1,13 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in ldp-client.gemspec
4
- gemspec
5
-
6
- # gem 'slop', '~> 3.6' if RUBY_PLATFORM == "java"
7
- gem 'byebug', platforms: [:mri]
8
3
  gem 'activesupport'
9
- gem 'capybara_discoball', '~> 0.0.2'
10
- gem 'derby', '~> 1.0'
4
+ gem 'byebug', platforms: [:mri]
11
5
 
12
6
  if ENV['RAILS_VERSION']
13
7
  if ENV['RAILS_VERSION'] == 'edge'
@@ -16,3 +10,6 @@ if ENV['RAILS_VERSION']
16
10
  gem 'rails', ENV['RAILS_VERSION']
17
11
  end
18
12
  end
13
+
14
+ # Specify your gem's dependencies in ldp-client.gemspec
15
+ gemspec
data/README.md CHANGED
@@ -1,29 +1,29 @@
1
- # Ldp.rb
1
+ # ldp (Linked Data Platform)
2
2
 
3
3
  Code:
4
+ [![Gem Version](https://badge.fury.io/rb/ldp.png)](http://badge.fury.io/rb/ldp)
4
5
  [![Build Status](https://circleci.com/gh/samvera/ldp.svg?style=svg)](https://circleci.com/gh/samvera/ldp)
5
- [![Version](https://badge.fury.io/rb/ldp.png)](http://badge.fury.io/rb/ldp)
6
- [![Coverage Status](https://coveralls.io/repos/github/samvera/ldp/badge.svg?branch=master)](https://coveralls.io/github/samvera/ldp?branch=master)
6
+ [![Coverage Status](https://coveralls.io/repos/github/samvera/ldp/badge.svg?branch=main)](https://coveralls.io/github/samvera/ldp?branch=main)
7
7
 
8
8
  Docs:
9
9
  [![Contribution Guidelines](http://img.shields.io/badge/CONTRIBUTING-Guidelines-blue.svg)](./CONTRIBUTING.md)
10
10
  [![Apache 2.0 License](http://img.shields.io/badge/APACHE2-license-blue.svg)](./LICENSE.txt)
11
11
 
12
- Jump In: [![Slack Status](http://slack.samvera.org/badge.svg)](http://slack.samvera.org/)
12
+ Community Support: [![Samvera Community Slack](https://img.shields.io/badge/samvera-slack-blueviolet)](http://slack.samvera.org/)
13
13
 
14
- # What is ldp?
14
+ # What is `ldp`?
15
15
 
16
- Linked Data Platform client library for Ruby
16
+ [Linked Data Platform](https://www.w3.org/TR/ldp/) client library for Ruby
17
17
 
18
18
  ## Product Owner & Maintenance
19
19
 
20
- **ldp** is a Core Component of the Samvera community. The documentation for
21
- what this means can be found
22
- [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
20
+ `ldp` was a Core Component of the Samvera Community. Given a decline in available labor required for maintenance, this project no longer has a dedicated Product Owner. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
23
21
 
24
22
  ### Product Owner
25
23
 
26
- [randalldfloyd](https://github.com/randalldfloyd)
24
+ **Vacant**
25
+
26
+ _Until a Product Owner has been identified, we ask that you please direct all requests for support, bug reports, and general questions to the [`#dev` Channel on the Samvera Slack](https://samvera.slack.com/app_redirect?channel=dev)._
27
27
 
28
28
  # Help
29
29
 
@@ -61,6 +61,12 @@ orm.graph.insert([orm.resource.subject_uri, RDF::DC11.title, 'a new title'])
61
61
  # save changes
62
62
  orm.save
63
63
  ```
64
+ ## Contributing
65
+
66
+ If you're working on PR for this project, create a feature branch off of `main`.
67
+
68
+ This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct) and [language recommendations](https://github.com/samvera/maintenance/blob/main/templates/CONTRIBUTING.md#language). Please ***do not*** create a branch called `main` for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of this repository.
69
+
64
70
  ## Testing:
65
71
 
66
72
  - Set Rails version you want to test against. For example:
@@ -80,7 +86,7 @@ orm.save
80
86
  ```
81
87
  github_changelog_generator --user samvera --project ldp --token YOUR_GITHUB_TOKEN_HERE
82
88
  ```
83
- 5. Commit these changes to the master branch
89
+ 5. Commit these changes to the main branch
84
90
  6. Run `rake release`
85
91
 
86
92
  # Acknowledgments
data/ldp.gemspec CHANGED
@@ -10,30 +10,37 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["chris@cbeer.info"]
11
11
  spec.description = %q{Linked Data Platform client library}
12
12
  spec.summary = spec.description
13
- spec.homepage = "https://github.com/projecthydra/ldp"
13
+ spec.homepage = "https://github.com/samvera/ldp"
14
14
  spec.license = "APACHE2"
15
- spec.required_ruby_version = '~> 2.0'
15
+ spec.required_ruby_version = '>= 2.4'
16
16
 
17
17
  spec.files = `git ls-files`.split($/)
18
18
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.test_files = spec.files.grep(%r{^spec/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "faraday"
23
- spec.add_dependency "rdf", ">= 1.1"
24
- spec.add_dependency "rdf-turtle"
25
- spec.add_dependency "rdf-vocab", ">= 0.8"
26
- spec.add_dependency "rdf-isomorphic"
27
- spec.add_dependency "json-ld"
28
- spec.add_dependency "http_logger"
29
22
  spec.add_dependency "deprecation"
23
+ spec.add_dependency "faraday", '>= 1'
24
+ spec.add_dependency "http_logger"
25
+ spec.add_dependency "json-ld", "~> 3.2"
26
+ spec.add_dependency "rdf", "~> 3.2"
27
+ spec.add_dependency "rdf-isomorphic"
28
+ spec.add_dependency "rdf-ldp"
29
+ spec.add_dependency "rdf-turtle"
30
+ spec.add_dependency "rdf-vocab", ">= 0.8"
30
31
  spec.add_dependency "slop"
32
+
33
+ spec.add_development_dependency 'bixby'
31
34
  spec.add_development_dependency "bundler", "~> 2.0"
35
+ spec.add_development_dependency 'capybara_discoball'
36
+ spec.add_development_dependency "coveralls_reborn"
37
+ spec.add_development_dependency 'github_changelog_generator'
38
+ spec.add_development_dependency 'pry-byebug'
32
39
  spec.add_development_dependency "rake"
33
40
  spec.add_development_dependency "rspec"
34
- spec.add_development_dependency "coveralls"
35
- spec.add_development_dependency "simplecov"
36
41
  spec.add_development_dependency "rspec_junit_formatter"
37
- spec.add_development_dependency 'bixby', '~> 3.0.0'
38
- spec.add_development_dependency 'github_changelog_generator'
42
+ spec.add_development_dependency "rubocop-rake"
43
+ spec.add_development_dependency "simplecov"
44
+ spec.add_development_dependency "webmock"
45
+ spec.add_development_dependency "webrick"
39
46
  end
@@ -10,10 +10,11 @@ module Ldp::Client::Methods
10
10
  else
11
11
  @http = Faraday.new *http_client
12
12
  end
13
+ yield @http if block_given?
13
14
  end
14
15
 
15
16
  def head url
16
- ActiveSupport::Notifications.instrument("http.ldp",
17
+ Ldp.instrument("http.ldp",
17
18
  url: url, name: "HEAD", ldp_client: object_id) do
18
19
  resp = http.head do |req|
19
20
  req.url munge_to_relative_url(url)
@@ -29,7 +30,7 @@ module Ldp::Client::Methods
29
30
 
30
31
  # Get a LDP Resource by URI
31
32
  def get url, options = {}
32
- ActiveSupport::Notifications.instrument("http.ldp",
33
+ Ldp.instrument("http.ldp",
33
34
  url: url, name: "GET", ldp_client: object_id) do
34
35
  resp = http.get do |req|
35
36
  req.url munge_to_relative_url(url)
@@ -57,7 +58,7 @@ module Ldp::Client::Methods
57
58
 
58
59
  # Delete a LDP Resource by URI
59
60
  def delete url
60
- ActiveSupport::Notifications.instrument("http.ldp",
61
+ Ldp.instrument("http.ldp",
61
62
  url: url, name: "DELETE", ldp_client: object_id) do
62
63
  resp = http.delete do |req|
63
64
  req.url munge_to_relative_url(url)
@@ -70,7 +71,7 @@ module Ldp::Client::Methods
70
71
 
71
72
  # Post TTL to an LDP Resource
72
73
  def post url, body = nil, headers = {}
73
- ActiveSupport::Notifications.instrument("http.ldp",
74
+ Ldp.instrument("http.ldp",
74
75
  url: url, name: "POST", ldp_client: object_id) do
75
76
  resp = http.post do |req|
76
77
  req.url munge_to_relative_url(url)
@@ -84,7 +85,7 @@ module Ldp::Client::Methods
84
85
 
85
86
  # Update an LDP resource with TTL by URI
86
87
  def put url, body, headers = {}
87
- ActiveSupport::Notifications.instrument("http.ldp",
88
+ Ldp.instrument("http.ldp",
88
89
  url: url, name: "PUT", ldp_client: object_id) do
89
90
  resp = http.put do |req|
90
91
  req.url munge_to_relative_url(url)
@@ -98,7 +99,7 @@ module Ldp::Client::Methods
98
99
 
99
100
  # Update an LDP resource with TTL by URI
100
101
  def patch url, body, headers = {}
101
- ActiveSupport::Notifications.instrument("http.ldp",
102
+ Ldp.instrument("http.ldp",
102
103
  url: url, name: "PATCH", ldp_client: object_id) do
103
104
  resp = http.patch do |req|
104
105
  req.url munge_to_relative_url(url)
data/lib/ldp/orm.rb CHANGED
@@ -26,7 +26,7 @@ module Ldp
26
26
  end
27
27
 
28
28
  def value predicate
29
- graph.query(:subject => subject_uri, :predicate => predicate).map do |stmt|
29
+ graph.query([subject_uri, predicate, nil]).map do |stmt|
30
30
  stmt.object
31
31
  end
32
32
  end
@@ -8,8 +8,11 @@ module Ldp
8
8
  when RDF::Enumerable
9
9
  @graph = graph_or_response
10
10
  when Ldp::Response
11
+ # no-op
12
+ nil
11
13
  when NilClass
12
- # nop
14
+ # no-op
15
+ nil
13
16
  else
14
17
  raise ArgumentError, "Third argument to #{self.class}.new should be a RDF::Enumerable or a Ldp::Response. You provided #{graph_or_response.class}"
15
18
  end
@@ -84,10 +87,10 @@ module Ldp
84
87
  # @param [RDF::Graph] original_graph The graph returned by the LDP server
85
88
  # @return [RDF::Graph] A graph stripped of any inlined resources present in the original
86
89
  def filtered_graph(original_graph)
87
- contains_statements = original_graph.query(predicate: RDF::Vocab::LDP.contains)
90
+ contains_statements = original_graph.query([nil, RDF::Vocab::LDP.contains, nil])
88
91
 
89
92
  contains_statements.each_object do |contained_uri|
90
- original_graph.delete(original_graph.query(subject: contained_uri))
93
+ original_graph.delete(original_graph.query([contained_uri, nil, nil]))
91
94
  end
92
95
 
93
96
  original_graph
data/lib/ldp/response.rb CHANGED
@@ -104,9 +104,7 @@ module Ldp
104
104
  ##
105
105
  # Get the graph for the resource (or a blank graph if there is no metadata for the resource)
106
106
  def graph
107
- @graph ||= begin
108
- RDF::Graph.new << reader
109
- end
107
+ @graph ||= RDF::Graph.new << reader
110
108
  end
111
109
 
112
110
  def reader(&block)
@@ -193,7 +191,7 @@ module Ldp
193
191
 
194
192
  def content_disposition_filename
195
193
  filename = content_disposition_attributes['filename']
196
- URI.decode(filename) if filename
194
+ CGI.unescape(filename) if filename
197
195
  end
198
196
 
199
197
  private
data/lib/ldp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ldp
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/ldp.rb CHANGED
@@ -1,11 +1,13 @@
1
1
  require 'ldp/version'
2
- require 'rdf/turtle'
2
+
3
+ require 'active_support'
4
+ require 'deprecation'
3
5
  require 'json/ld'
6
+ require 'logger'
4
7
  require 'rdf/isomorphic'
8
+ require 'rdf/turtle'
5
9
  require 'rdf/vocab/ldp'
6
- require 'logger'
7
10
  require 'singleton'
8
- require 'deprecation'
9
11
 
10
12
  module Ldp
11
13
  RDF::Graph.send(:include, RDF::Isomorphic)
@@ -1,16 +1,25 @@
1
1
  require 'spec_helper'
2
+
2
3
  require 'capybara_discoball'
3
- require 'derby/server'
4
+ require 'lamprey'
4
5
 
5
6
  describe 'Integration tests' do
6
- let!(:derby_server) do
7
- Capybara::Discoball::Runner.new(Derby::Server).boot
7
+ before(:all) do
8
+ WebMock.disable!
9
+ end
10
+
11
+ after(:all) do
12
+ WebMock.enable!
13
+ end
14
+
15
+ let!(:ldp_server) do
16
+ Capybara::Discoball::Runner.new(RDF::Lamprey).boot
8
17
  end
9
18
 
10
19
  let(:debug) { ENV.fetch('DEBUG', false) }
11
20
 
12
21
  let(:client) do
13
- Faraday.new(url: derby_server) do |faraday|
22
+ Faraday.new(url: ldp_server) do |faraday|
14
23
  faraday.response :logger if debug
15
24
  faraday.adapter Faraday.default_adapter
16
25
  end
@@ -18,6 +27,11 @@ describe 'Integration tests' do
18
27
 
19
28
  subject { Ldp::Client.new client }
20
29
 
30
+ before do
31
+ # Initialize LDP server
32
+ subject.put "/", ""
33
+ end
34
+
21
35
  it 'creates resources' do
22
36
  subject.put '/rdf_source', ''
23
37
  obj = subject.find_or_initialize('/rdf_source')
@@ -1,5 +1,13 @@
1
1
  require 'spec_helper'
2
+
2
3
  describe "Ldp::Client" do
4
+ before(:all) do
5
+ WebMock.enable!
6
+ end
7
+
8
+ after(:all) do
9
+ WebMock.disable!
10
+ end
3
11
 
4
12
  let(:simple_graph) do
5
13
  graph = RDF::Graph.new << [RDF::URI.new(""), RDF::Vocab::DC.title, "Hello, world!"]
@@ -41,13 +49,14 @@ describe "Ldp::Client" do
41
49
  builder.adapter :test, conn_stubs do |stub|
42
50
  end
43
51
  end
44
-
45
52
  end
46
53
 
47
- subject do
54
+ subject(:ldp_client) do
48
55
  Ldp::Client.new mock_conn
49
56
  end
50
57
 
58
+ let(:http) { ldp_client.http }
59
+
51
60
  describe "initialize" do
52
61
  it "should accept an existing Faraday connection" do
53
62
  conn = Faraday.new "http://example.com"
@@ -193,12 +202,21 @@ describe "Ldp::Client" do
193
202
  end
194
203
 
195
204
  it "should preserve basic auth headers" do
196
- subject.http.basic_auth('Aladdin', 'open sesame')
197
- subject.post "a_container", 'foo' do |req|
198
- expect(req.headers).to include({ "Authorization" => "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" })
205
+ stub_request(:post, "http://localhost/a_container").with(
206
+ body: "foo",
207
+ ).to_return(status: 200, body: "", headers: {})
208
+
209
+ ldp_client.initialize_http_client do |conn|
210
+ conn.request :authorization, :basic, 'Kevin Mitnick', 'hack the planet'
199
211
  end
200
- end
201
212
 
213
+ ldp_client.post "http://localhost/a_container", 'foo'
214
+
215
+ expect(a_request(:post, "http://localhost/a_container").with(body: "foo", headers: {
216
+ 'Authorization'=>'Basic S2V2aW4gTWl0bmljazpoYWNrIHRoZSBwbGFuZXQ=',
217
+ 'Content-Type'=>'text/turtle',
218
+ })).to have_been_made.once
219
+ end
202
220
  end
203
221
 
204
222
  describe "put" do
@@ -245,23 +263,41 @@ describe "Ldp::Client" do
245
263
  end
246
264
 
247
265
  it "should preserve basic auth headers" do
248
- subject.http.basic_auth('Aladdin', 'open sesame')
249
- subject.put "a_resource", "some-payload" do |req|
250
- expect(req.headers).to include({ "Authorization" => "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" })
266
+ stub_request(:put, "http://localhost/a_resource").with(
267
+ body: "some-payload",
268
+ ).to_return(status: 200, body: "", headers: {})
269
+
270
+ ldp_client.initialize_http_client do |conn|
271
+ conn.request :authorization, :basic, 'Kevin Mitnick', 'hack the planet'
251
272
  end
273
+
274
+ ldp_client.put "http://localhost/a_resource", "some-payload"
275
+
276
+ expect(a_request(:put, "http://localhost/a_resource").with(body: "some-payload", headers: {
277
+ 'Authorization'=>'Basic S2V2aW4gTWl0bmljazpoYWNrIHRoZSBwbGFuZXQ=',
278
+ 'Content-Type'=>'text/turtle',
279
+ })).to have_been_made.once
252
280
  end
253
281
 
254
282
  end
255
283
 
256
284
  describe 'patch' do
257
-
258
285
  it "should preserve basic auth headers" do
259
- subject.http.basic_auth('Aladdin', 'open sesame')
260
- subject.patch "a_container", 'foo' do |req|
261
- expect(req.headers).to include({ "Authorization" => "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==" })
286
+ stub_request(:patch, "http://localhost/a_container").with(
287
+ body: "foo",
288
+ ).to_return(status: 200, body: "", headers: {})
289
+
290
+ ldp_client.initialize_http_client do |conn|
291
+ conn.request :authorization, :basic, 'Kevin Mitnick', 'hack the planet'
262
292
  end
263
- end
264
293
 
294
+ ldp_client.patch "http://localhost/a_container", "foo"
295
+
296
+ expect(a_request(:patch, "http://localhost/a_container").with(body: "foo", headers: {
297
+ 'Authorization'=>'Basic S2V2aW4gTWl0bmljazpoYWNrIHRoZSBwbGFuZXQ=',
298
+ 'Content-Type'=>'application/sparql-update',
299
+ })).to have_been_made.once
300
+ end
265
301
  end
266
302
 
267
303
  describe "find_or_initialize" do
data/spec/spec_helper.rb CHANGED
@@ -1,13 +1,17 @@
1
1
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
 
4
- require 'simplecov'
5
4
  require 'coveralls'
5
+ require 'pry-byebug'
6
+ require 'rdf/vocab'
7
+ require 'simplecov'
8
+ require 'webmock/rspec'
9
+
10
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
11
+ SimpleCov::Formatter::HTMLFormatter,
12
+ Coveralls::SimpleCov::Formatter
13
+ ])
6
14
 
7
- SimpleCov.formatter =
8
- SimpleCov::Formatter::MultiFormatter.new([SimpleCov::Formatter::HTMLFormatter,
9
- Coveralls::SimpleCov::Formatter])
10
-
11
15
  SimpleCov.start do
12
16
  add_filter 'spec/'
13
17
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-14 00:00:00.000000000 Z
11
+ date: 2022-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: faraday
14
+ name: deprecation
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,21 +25,21 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rdf
28
+ name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.1'
33
+ version: '1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.1'
40
+ version: '1'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rdf-turtle
42
+ name: http_logger
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,19 +53,33 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rdf-vocab
56
+ name: json-ld
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.8'
61
+ version: '3.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.8'
68
+ version: '3.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdf
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.2'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rdf-isomorphic
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +95,7 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
- name: json-ld
98
+ name: rdf-ldp
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -95,7 +109,7 @@ dependencies:
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: http_logger
112
+ name: rdf-turtle
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="
@@ -109,19 +123,19 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: deprecation
126
+ name: rdf-vocab
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - ">="
116
130
  - !ruby/object:Gem::Version
117
- version: '0'
131
+ version: '0.8'
118
132
  type: :runtime
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: '0'
138
+ version: '0.8'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: slop
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +150,20 @@ dependencies:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: bixby
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: bundler
141
169
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +178,62 @@ dependencies:
150
178
  - - "~>"
151
179
  - !ruby/object:Gem::Version
152
180
  version: '2.0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: capybara_discoball
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: coveralls_reborn
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: github_changelog_generator
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: pry-byebug
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
153
237
  - !ruby/object:Gem::Dependency
154
238
  name: rake
155
239
  requirement: !ruby/object:Gem::Requirement
@@ -179,7 +263,7 @@ dependencies:
179
263
  - !ruby/object:Gem::Version
180
264
  version: '0'
181
265
  - !ruby/object:Gem::Dependency
182
- name: coveralls
266
+ name: rspec_junit_formatter
183
267
  requirement: !ruby/object:Gem::Requirement
184
268
  requirements:
185
269
  - - ">="
@@ -193,7 +277,7 @@ dependencies:
193
277
  - !ruby/object:Gem::Version
194
278
  version: '0'
195
279
  - !ruby/object:Gem::Dependency
196
- name: simplecov
280
+ name: rubocop-rake
197
281
  requirement: !ruby/object:Gem::Requirement
198
282
  requirements:
199
283
  - - ">="
@@ -207,7 +291,7 @@ dependencies:
207
291
  - !ruby/object:Gem::Version
208
292
  version: '0'
209
293
  - !ruby/object:Gem::Dependency
210
- name: rspec_junit_formatter
294
+ name: simplecov
211
295
  requirement: !ruby/object:Gem::Requirement
212
296
  requirements:
213
297
  - - ">="
@@ -221,21 +305,21 @@ dependencies:
221
305
  - !ruby/object:Gem::Version
222
306
  version: '0'
223
307
  - !ruby/object:Gem::Dependency
224
- name: bixby
308
+ name: webmock
225
309
  requirement: !ruby/object:Gem::Requirement
226
310
  requirements:
227
- - - "~>"
311
+ - - ">="
228
312
  - !ruby/object:Gem::Version
229
- version: 3.0.0
313
+ version: '0'
230
314
  type: :development
231
315
  prerelease: false
232
316
  version_requirements: !ruby/object:Gem::Requirement
233
317
  requirements:
234
- - - "~>"
318
+ - - ">="
235
319
  - !ruby/object:Gem::Version
236
- version: 3.0.0
320
+ version: '0'
237
321
  - !ruby/object:Gem::Dependency
238
- name: github_changelog_generator
322
+ name: webrick
239
323
  requirement: !ruby/object:Gem::Requirement
240
324
  requirements:
241
325
  - - ">="
@@ -296,7 +380,7 @@ files:
296
380
  - spec/lib/ldp/resource_spec.rb
297
381
  - spec/lib/ldp/response_spec.rb
298
382
  - spec/spec_helper.rb
299
- homepage: https://github.com/projecthydra/ldp
383
+ homepage: https://github.com/samvera/ldp
300
384
  licenses:
301
385
  - APACHE2
302
386
  metadata: {}
@@ -306,16 +390,16 @@ require_paths:
306
390
  - lib
307
391
  required_ruby_version: !ruby/object:Gem::Requirement
308
392
  requirements:
309
- - - "~>"
393
+ - - ">="
310
394
  - !ruby/object:Gem::Version
311
- version: '2.0'
395
+ version: '2.4'
312
396
  required_rubygems_version: !ruby/object:Gem::Requirement
313
397
  requirements:
314
398
  - - ">="
315
399
  - !ruby/object:Gem::Version
316
400
  version: '0'
317
401
  requirements: []
318
- rubygems_version: 3.1.4
402
+ rubygems_version: 3.3.26
319
403
  signing_key:
320
404
  specification_version: 4
321
405
  summary: Linked Data Platform client library