roda-endpoints 0.1.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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.dockerignore +98 -0
  3. data/.gitignore +9 -0
  4. data/.gitlab-ci.yml +85 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +51 -0
  7. data/.ruby-version +1 -0
  8. data/.simplecov +7 -0
  9. data/.travis.yml +5 -0
  10. data/CODE_OF_CONDUCT.md +74 -0
  11. data/Dockerfile +11 -0
  12. data/Gemfile +5 -0
  13. data/LICENSE.txt +21 -0
  14. data/README.md +42 -0
  15. data/Rakefile +4 -0
  16. data/bin/bundle-audit +17 -0
  17. data/bin/console +15 -0
  18. data/bin/rspec +17 -0
  19. data/bin/rubocop +17 -0
  20. data/bin/setup +8 -0
  21. data/bin/yard +17 -0
  22. data/bin/yardoc +17 -0
  23. data/bin/yri +17 -0
  24. data/lib/roda/endpoints/endpoint/caching.rb +28 -0
  25. data/lib/roda/endpoints/endpoint/class_interface.rb +123 -0
  26. data/lib/roda/endpoints/endpoint/collection.rb +77 -0
  27. data/lib/roda/endpoints/endpoint/data.rb +29 -0
  28. data/lib/roda/endpoints/endpoint/item.rb +117 -0
  29. data/lib/roda/endpoints/endpoint/namespace.rb +48 -0
  30. data/lib/roda/endpoints/endpoint/operations.rb +28 -0
  31. data/lib/roda/endpoints/endpoint/transactions.rb +67 -0
  32. data/lib/roda/endpoints/endpoint/validations.rb +98 -0
  33. data/lib/roda/endpoints/endpoint/verbs.rb +45 -0
  34. data/lib/roda/endpoints/endpoint.rb +83 -0
  35. data/lib/roda/endpoints/functions.rb +26 -0
  36. data/lib/roda/endpoints/repository.rb +26 -0
  37. data/lib/roda/endpoints/transactions.rb +75 -0
  38. data/lib/roda/endpoints/types.rb +13 -0
  39. data/lib/roda/endpoints/version.rb +7 -0
  40. data/lib/roda/endpoints.rb +21 -0
  41. data/lib/roda/plugins/endpoints.rb +161 -0
  42. data/lib/rom/struct/to_json.rb +18 -0
  43. data/rakelib/bundle_audit.rake +4 -0
  44. data/rakelib/bundler.rake +2 -0
  45. data/rakelib/rspec.rake +6 -0
  46. data/rakelib/rubocop.rake +5 -0
  47. data/rakelib/yard.rake +5 -0
  48. data/roda-endpoints.gemspec +49 -0
  49. metadata +385 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a5d5c0b50d6405cc257a76d098dd673351ade2d4
4
+ data.tar.gz: 432c3139a367f1907a69c6310bb8188015bb247c
5
+ SHA512:
6
+ metadata.gz: ed59766efaca29ac760dc05cab86b6e979878db4895a1142803fd00e6ef022e925b9b0190208a83d722d2159aa906ef0120b26a77711cd7314e5a9d2049369d2
7
+ data.tar.gz: 29c953dea3afb2f38a06505bf3d7d54c616fb56387b8f821fcb97078e7f6f06e4641e8184062d41b8aed0acd934a799422ae3fe2a7bcdf4e4092d4e0d3f5a3e9
data/.dockerignore ADDED
@@ -0,0 +1,98 @@
1
+ ### Ruby template
2
+ *.gem
3
+ *.rbc
4
+ /.config
5
+ /coverage/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/examples.txt
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ # Used by dotenv library to load environment variables.
15
+ .env
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /rdoc/
21
+
22
+ ## Environment normalization:
23
+ /.bundle/
24
+ /vendor/bundle
25
+ /lib/bundler/man/
26
+ /.bundle
27
+
28
+ # Roda is the gem, so ignore these files since the code is intended to run
29
+ # in multiple environments:
30
+ .ruby-version
31
+ .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
35
+ ### JetBrains template
36
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
37
+ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
38
+
39
+ # User-specific stuff:
40
+ .idea/workspace.xml
41
+ .idea/tasks.xml
42
+
43
+ # Sensitive or high-churn files:
44
+ .idea/dataSources/
45
+ .idea/dataSources.ids
46
+ .idea/dataSources.xml
47
+ .idea/dataSources.local.xml
48
+ .idea/sqlDataSources.xml
49
+ .idea/dynamic.xml
50
+ .idea/uiDesigner.xml
51
+
52
+ # Gradle:
53
+ .idea/gradle.xml
54
+ .idea/libraries
55
+
56
+ # Mongo Explorer plugin:
57
+ .idea/mongoSettings.xml
58
+
59
+ ## File-based project format:
60
+ *.iws
61
+
62
+ ## Plugin-specific files:
63
+
64
+ # IntelliJ
65
+ /out/
66
+
67
+ # mpeltonen/sbt-idea plugin
68
+ .idea_modules/
69
+
70
+ # JIRA plugin
71
+ atlassian-ide-plugin.xml
72
+
73
+ # Crashlytics plugin (for Android Studio and IntelliJ)
74
+ com_crashlytics_export_strings.xml
75
+ crashlytics.properties
76
+ crashlytics-build.properties
77
+ fabric.properties
78
+ ### Rails template
79
+ capybara-*.html
80
+ .rspec
81
+ /log
82
+ /tmp
83
+ /db/*.sqlite3
84
+ /db/*.sqlite3-journal
85
+ /public/system
86
+ /spec/tmp
87
+ **.orig
88
+ rerun.txt
89
+ pickle-email-*.html
90
+
91
+ # Only include if you have production secrets in this file, which is no longer a Rails default
92
+ # config/secrets.yml
93
+
94
+ # Ignore Byebug command history file.
95
+ .byebug_history
96
+
97
+ # Ignore Git repositories
98
+ .git
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,85 @@
1
+ # See documentation at https://docs.gitlab.com/ee/ci/yaml/README.html
2
+ variables:
3
+ CI_REGISTRY_IMAGE_CURRENT: $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME
4
+ CI_REGISTRY_IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
5
+ CI_REGISTRY_IMAGE_STABLE: $CI_REGISTRY_IMAGE:stable
6
+
7
+ .docker_build: &docker
8
+ image: docker:latest
9
+ services:
10
+ - docker:dind
11
+ before_script:
12
+ - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
13
+
14
+ .ruby_build: &ruby
15
+ image: $CI_REGISTRY_IMAGE_CURRENT
16
+ # Cache gems in between builds
17
+ cache:
18
+ paths:
19
+ - /cache
20
+ # This is a basic example for a gem or script which doesn't use
21
+ # services such as redis or postgres
22
+ before_script:
23
+ - bundle install -j $(nproc) --path=/vendor/bundle # (Re)Bundle dependencies
24
+
25
+ .release_docker_image: &release_docker_image
26
+ <<: *docker
27
+ stage: deploy
28
+ script:
29
+ - echo "Releasing ${$TARGET_IMAGE} from $CI_REGISTRY_IMAGE_CURRENT"
30
+ - docker pull $CI_REGISTRY_IMAGE_CURRENT
31
+ - docker tag $CI_REGISTRY_IMAGE_CURRENT ${$TARGET_IMAGE}
32
+ - docker push ${$TARGET_IMAGE}
33
+
34
+ build:
35
+ <<: *docker
36
+ stage: build
37
+ script:
38
+ - echo "Building ${CI_REGISTRY_IMAGE_CURRENT}"
39
+ - docker build --pull -t $CI_REGISTRY_IMAGE_CURRENT .
40
+ - docker push $CI_REGISTRY_IMAGE_CURRENT
41
+
42
+ style:
43
+ <<: *ruby
44
+ script: bin/rubocop
45
+ artifacts:
46
+ paths:
47
+ - doc/rubocop.html
48
+ - tmp/ci
49
+
50
+ specification:
51
+ <<: *ruby
52
+ script: bin/rake spec
53
+ artifacts:
54
+ paths:
55
+ - doc/spec.html
56
+ - coverage
57
+ - tmp/ci
58
+
59
+ documentation:
60
+ <<: *ruby
61
+ script: bin/rake doc
62
+ artifacts:
63
+ paths:
64
+ - rdoc
65
+
66
+ gem:
67
+ <<: *ruby
68
+ script: bin/rake build
69
+ artifacts:
70
+ paths:
71
+ - pkg
72
+
73
+ release latest image:
74
+ variables:
75
+ TARGET_IMAGE: CI_REGISTRY_IMAGE_LATEST
76
+ <<: *release_docker_image
77
+ only:
78
+ - develop
79
+
80
+ release stable image:
81
+ variables:
82
+ TARGET_IMAGE: CI_REGISTRY_IMAGE_STABLE
83
+ <<: *release_docker_image
84
+ only:
85
+ - master
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format documentation
3
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,51 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ DefaultFormatter: fuubar
4
+ DisplayCopNames: true
5
+ ExtraDetails: true
6
+ Exclude:
7
+ - spec/**/*.rb
8
+ - vendor/**/*.rb
9
+
10
+ Metrics/BlockLength:
11
+ Exclude:
12
+ - rakelib/**/*.rb
13
+ - spec/**/*.rb
14
+ - vendor/**/*.rb
15
+
16
+ # It is 2017, UTF time!
17
+ Style/AsciiComments:
18
+ Enabled: false
19
+
20
+
21
+ # Offense count: 1
22
+ Lint/AmbiguousOperator:
23
+ Exclude:
24
+ - 'lib/roda/endpoints/endpoint/collection.rb'
25
+
26
+ # Offense count: 1
27
+ Lint/ShadowingOuterLocalVariable:
28
+ Exclude:
29
+ - 'lib/roda/endpoints/endpoint/item.rb'
30
+
31
+ # Offense count: 3
32
+ Metrics/AbcSize:
33
+ Max: 21
34
+
35
+ # Offense count: 1
36
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
37
+ # URISchemes: http, https
38
+ Metrics/LineLength:
39
+ Max: 81
40
+
41
+ # Offense count: 4
42
+ # Configuration parameters: CountComments.
43
+ Metrics/MethodLength:
44
+ Max: 18
45
+
46
+ # Offense count: 1
47
+ Style/Documentation:
48
+ Exclude:
49
+ - 'spec/**/*'
50
+ - 'test/**/*'
51
+ - 'lib/roda/endpoints/endpoint/class_interface.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.0
data/.simplecov ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ SimpleCov.start do
4
+ add_filter '/spec/'
5
+ add_group('Missing') { |src| src.covered_percent < 100 }
6
+ add_group('Covered') { |src| src.covered_percent == 100 }
7
+ end
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.0
5
+ before_install: gem install bundler -v 1.13.7
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at alex@semyonov.us. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Dockerfile ADDED
@@ -0,0 +1,11 @@
1
+ FROM ruby:2.4
2
+
3
+ RUN gem install bundler --no-ri --no-rdoc
4
+
5
+ RUN mkdir /gem
6
+ WORKDIR /gem
7
+
8
+ ADD lib/roda/endpoints/version.rb /gem/lib/roda/endpoints/version.rb
9
+ ADD *.gemspec /gem/
10
+ ADD Gemfile /gem/Gemfile
11
+ RUN bundle install -j $(nproc) --path=/vendor/bundle
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ # Specify your gem's dependencies in roda-endpoints.gemspec
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Alex Semyonov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Roda::Endpoints
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/roda/endpoints`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'roda-endpoints'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install roda-endpoints
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bin/rake install`. To release a new version, update the version number in `version.rb`, and then run `bin/rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://gitlab.com/alsemyonov/roda-endpoints. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
42
+ © [Alex Semyonov](https://alex.semyonov.us/), <[alex@semyonov.us](mailto:alex@semyonov.us?subject=roda-endpoints)> 2017
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ require 'bundler/gem_tasks'
3
+
4
+ task default: %i(spec cop bundle:audit doc)
data/bin/bundle-audit ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'bundle-audit' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('bundler-audit', 'bundle-audit')
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'roda/endpoints'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start
data/bin/rspec ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rspec' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/rubocop ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rubocop' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('rubocop', 'rubocop')
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/yard ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'yard' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('yard', 'yard')
data/bin/yardoc ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'yardoc' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('yard', 'yardoc')
data/bin/yri ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'yri' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('yard', 'yri')
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Roda
4
+ module Endpoints
5
+ # Generic HTTP endpoint abstraction.
6
+ class Endpoint
7
+ # Accessing data inside of endpoint.
8
+ module Caching
9
+ # @param last_modified [Symbol]
10
+ # @param attributes [{Symbol=>Object}]
11
+ def initialize(last_modified: Undefined, **attributes)
12
+ @last_modified = last_modified unless last_modified == Undefined
13
+ super(**attributes)
14
+ end
15
+
16
+ # @return [Time]
17
+ def last_modified
18
+ Time.now
19
+ end
20
+
21
+ # @return [{Symbol=>Object}]
22
+ def to_hash
23
+ @last_modified ? super.merge(last_modified: @last_modified) : super
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end