bloodbath 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +17 -0
- data/.gitignore +56 -0
- data/.rspec +3 -0
- data/.rspec_status +8 -0
- data/.rubocop.yml +5 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +84 -0
- data/LICENSE +21 -0
- data/README.md +68 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/bloodbath.gemspec +39 -0
- data/fixtures/vcr_cassettes/Bloodbath_Event/_cancel/1_4_1.yml +37 -0
- data/fixtures/vcr_cassettes/Bloodbath_Event/_find/1_3_1.yml +42 -0
- data/fixtures/vcr_cassettes/Bloodbath_Event/_list/1_2_1.yml +71 -0
- data/fixtures/vcr_cassettes/Bloodbath_Event/_schedule/1_1_1.yml +44 -0
- data/lib/bloodbath.rb +21 -0
- data/lib/bloodbath/configuration.rb +10 -0
- data/lib/bloodbath/event.rb +97 -0
- data/lib/bloodbath/version.rb +5 -0
- metadata +196 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3e989ecd65dd717037c7686fb3c0f5af9d7f540f6dd70233d26d9b1dd4460718
|
4
|
+
data.tar.gz: 83cf920df14ba1249651050f87908ceaaa7de180d441a9729fc1bec31129ad7f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3bb63359050104afa8c2494659544e10c76402da322789508801194ef7513cbd658882448e37a25b9240542342efbee14ed3734d2ac83926df0a9c978e6cf795
|
7
|
+
data.tar.gz: bc3a3202c088b007d52e2a44ef9f752857ed8646b5a42000724d241adfed5c357d7c1c02e058a05a59fea2723ff1f88f4fc756f03b08344a5bcc604a9eab594d
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: build
|
2
|
+
|
3
|
+
on: [push,pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 3.0.0
|
14
|
+
- name: Run Rubocop
|
15
|
+
run: bundle install && bundle exec rubocop
|
16
|
+
- name: Run RSpec
|
17
|
+
run: bundle exec rspec
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
data/.rspec
ADDED
data/.rspec_status
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/bloodbath/event_spec.rb[1:1:1] | passed | 0.00539 seconds |
|
4
|
+
./spec/bloodbath/event_spec.rb[1:2:1] | passed | 0.00286 seconds |
|
5
|
+
./spec/bloodbath/event_spec.rb[1:3:1] | passed | 0.00209 seconds |
|
6
|
+
./spec/bloodbath/event_spec.rb[1:4:1] | passed | 0.00806 seconds |
|
7
|
+
./spec/bloodbath_spec.rb[1:1] | passed | 0.00122 seconds |
|
8
|
+
./spec/bloodbath_spec.rb[1:2:1] | passed | 0.05446 seconds |
|
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at laurent.schaffner.code@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bloodbath (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.7.0)
|
10
|
+
public_suffix (>= 2.0.2, < 5.0)
|
11
|
+
ast (2.4.2)
|
12
|
+
coderay (1.1.3)
|
13
|
+
crack (0.4.5)
|
14
|
+
rexml
|
15
|
+
diff-lcs (1.4.4)
|
16
|
+
hashdiff (1.0.1)
|
17
|
+
method_source (1.0.0)
|
18
|
+
parallel (1.20.1)
|
19
|
+
parser (3.0.1.1)
|
20
|
+
ast (~> 2.4.1)
|
21
|
+
pry (0.14.1)
|
22
|
+
coderay (~> 1.1)
|
23
|
+
method_source (~> 1.0)
|
24
|
+
public_suffix (4.0.6)
|
25
|
+
rainbow (3.0.0)
|
26
|
+
rake (13.0.3)
|
27
|
+
regexp_parser (2.1.1)
|
28
|
+
rexml (3.2.5)
|
29
|
+
rspec (3.10.0)
|
30
|
+
rspec-core (~> 3.10.0)
|
31
|
+
rspec-expectations (~> 3.10.0)
|
32
|
+
rspec-mocks (~> 3.10.0)
|
33
|
+
rspec-core (3.10.1)
|
34
|
+
rspec-support (~> 3.10.0)
|
35
|
+
rspec-expectations (3.10.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.10.0)
|
38
|
+
rspec-mocks (3.10.2)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.10.0)
|
41
|
+
rspec-support (3.10.2)
|
42
|
+
rubocop (1.15.0)
|
43
|
+
parallel (~> 1.10)
|
44
|
+
parser (>= 3.0.0.0)
|
45
|
+
rainbow (>= 2.2.2, < 4.0)
|
46
|
+
regexp_parser (>= 1.8, < 3.0)
|
47
|
+
rexml
|
48
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
49
|
+
ruby-progressbar (~> 1.7)
|
50
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
51
|
+
rubocop-ast (1.5.0)
|
52
|
+
parser (>= 3.0.1.1)
|
53
|
+
rubocop-rake (0.5.1)
|
54
|
+
rubocop
|
55
|
+
rubocop-rspec (2.3.0)
|
56
|
+
rubocop (~> 1.0)
|
57
|
+
rubocop-ast (>= 1.1.0)
|
58
|
+
rubocop-shopify (2.1.0)
|
59
|
+
rubocop (~> 1.13)
|
60
|
+
ruby-progressbar (1.11.0)
|
61
|
+
unicode-display_width (2.0.0)
|
62
|
+
vcr (6.0.0)
|
63
|
+
webmock (3.13.0)
|
64
|
+
addressable (>= 2.3.6)
|
65
|
+
crack (>= 0.3.2)
|
66
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
67
|
+
|
68
|
+
PLATFORMS
|
69
|
+
x86_64-darwin-19
|
70
|
+
|
71
|
+
DEPENDENCIES
|
72
|
+
bloodbath!
|
73
|
+
pry (~> 0.14)
|
74
|
+
rake (~> 13.0)
|
75
|
+
rspec (~> 3.0)
|
76
|
+
rubocop (~> 1.7)
|
77
|
+
rubocop-rake (~> 0.5.1)
|
78
|
+
rubocop-rspec (~> 2.3)
|
79
|
+
rubocop-shopify (~> 2.1.0)
|
80
|
+
vcr (~> 6.0.0)
|
81
|
+
webmock (~> 3.13.0)
|
82
|
+
|
83
|
+
BUNDLED WITH
|
84
|
+
2.2.17
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Bloodbath
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
![workflow](https://github.com/bloodbath-io/bloodbath-ruby/actions/workflows/main.yml/badge.svg)
|
2
|
+
|
3
|
+
# Bloodbath Ruby Library
|
4
|
+
|
5
|
+
The Bloodbath Ruby library provides convenient access to the Bloodbath API from applications written in the Ruby language.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'bloodbath'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install bloodbath
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Configuration
|
26
|
+
The library needs to be configured with your account's API key which is available in your [Bloodbath Dashboard](https://app.bloodbath.io/). Set `Bloodbath.api_key` to its value:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'bloodbath'
|
30
|
+
Bloodbath.api_key = 'NTI6PASMD9BQhYtRh...'
|
31
|
+
```
|
32
|
+
|
33
|
+
#### Events
|
34
|
+
```ruby
|
35
|
+
# schedule an event
|
36
|
+
Bloodbath::Event.schedule(
|
37
|
+
scheduled_for: Time.now + 60 * 60 + 5,
|
38
|
+
headers: {},
|
39
|
+
method: :post,
|
40
|
+
body: "some body content",
|
41
|
+
endpoint: 'https://api.acme.com/path'
|
42
|
+
)
|
43
|
+
|
44
|
+
# list events
|
45
|
+
Bloodbath::Event.list()
|
46
|
+
|
47
|
+
# find an event
|
48
|
+
Bloodbath::Event.find('b7ccff...')
|
49
|
+
|
50
|
+
# cancel an event
|
51
|
+
Bloodbath::Event.cancel('b7ccff...')
|
52
|
+
```
|
53
|
+
|
54
|
+
For more documentation about how to use Bloodbath, don't hesitate to check [Bloodbath Docs](https://docs.bloodbath.io/).
|
55
|
+
|
56
|
+
## Development
|
57
|
+
|
58
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
59
|
+
|
60
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/bloodbath-io/bloodbath-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/bloodbath-io/bloodbath-ruby/blob/master/CODE_OF_CONDUCT.md).
|
65
|
+
|
66
|
+
## Code of Conduct
|
67
|
+
|
68
|
+
Everyone interacting in the Bloodbath project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/bloodbath-io/bloodbath-ruby/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
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 "bloodbath"
|
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(__FILE__)
|
data/bin/setup
ADDED
data/bloodbath.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/bloodbath/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "bloodbath"
|
7
|
+
spec.version = Bloodbath::VERSION
|
8
|
+
spec.authors = ["Laurent Schaffner"]
|
9
|
+
spec.email = ["laurent.schaffner.code@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "The Bloodbath Ruby library provides convenient access to the Bloodbath API" \
|
12
|
+
"from applications written in the Ruby language."
|
13
|
+
|
14
|
+
spec.homepage = "https://bloodbath.io"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
16
|
+
|
17
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = "https://github.com/bloodbath-io/bloodbath-ruby"
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/bloodbath-io/bloodbath-ruby/blob/main/CHANGELOG.md"
|
22
|
+
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
%x(git ls-files -z).split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency("pry", "~> 0.14")
|
31
|
+
spec.add_development_dependency("rake", "~> 13.0")
|
32
|
+
spec.add_development_dependency("rspec", "~> 3.0")
|
33
|
+
spec.add_development_dependency("rubocop", "~> 1.7")
|
34
|
+
spec.add_development_dependency("rubocop-rspec", "~> 2.3")
|
35
|
+
spec.add_development_dependency("rubocop-rake", "~> 0.5.1")
|
36
|
+
spec.add_development_dependency("rubocop-shopify", "~> 2.1.0")
|
37
|
+
spec.add_development_dependency("vcr", "~> 6.0.0")
|
38
|
+
spec.add_development_dependency("webmock", "~> 3.13.0")
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: delete
|
5
|
+
uri: http://localhost:4000/rest/events/5a9b0427-0b3c-4de4-a797-70b734540a78
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: 'null'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Authorization:
|
17
|
+
- Bearer TONnZlNFWYG6CZ36v4tAwfA4UKRVX3_Ou8LNRmbkSFspd4xBl3oVaKkr_UfsAL2bgg_k39ENVzY1F90urvsBVA==
|
18
|
+
Content-Type:
|
19
|
+
- application/json
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 204
|
23
|
+
message: No Content
|
24
|
+
headers:
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=0, private, must-revalidate
|
27
|
+
Date:
|
28
|
+
- Thu, 27 May 2021 22:09:33 GMT
|
29
|
+
Server:
|
30
|
+
- Cowboy
|
31
|
+
X-Request-Id:
|
32
|
+
- FoML5kT-WIgxsQ4AAAZJ
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: ''
|
36
|
+
recorded_at: Thu, 27 May 2021 22:09:34 GMT
|
37
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:4000/rest/events/da7fe5c3-0df0-48c9-b8cd-a1e3a6ef2d48
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: 'null'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Authorization:
|
17
|
+
- Bearer TONnZlNFWYG6CZ36v4tAwfA4UKRVX3_Ou8LNRmbkSFspd4xBl3oVaKkr_UfsAL2bgg_k39ENVzY1F90urvsBVA==
|
18
|
+
Content-Type:
|
19
|
+
- application/json
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=0, private, must-revalidate
|
27
|
+
Content-Length:
|
28
|
+
- '286'
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Date:
|
32
|
+
- Thu, 27 May 2021 22:09:33 GMT
|
33
|
+
Server:
|
34
|
+
- Cowboy
|
35
|
+
X-Request-Id:
|
36
|
+
- FoML5kGdrRGxZfYAABaB
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"data":{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
40
|
+
\"very-true|\"}","id":"da7fe5c3-0df0-48c9-b8cd-a1e3a6ef2d48","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2030-05-25T22:27:23Z"}}'
|
41
|
+
recorded_at: Thu, 27 May 2021 22:09:34 GMT
|
42
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,71 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:4000/rest/events
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: 'null'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Authorization:
|
17
|
+
- Bearer TONnZlNFWYG6CZ36v4tAwfA4UKRVX3_Ou8LNRmbkSFspd4xBl3oVaKkr_UfsAL2bgg_k39ENVzY1F90urvsBVA==
|
18
|
+
Content-Type:
|
19
|
+
- application/json
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=0, private, must-revalidate
|
27
|
+
Content-Length:
|
28
|
+
- '9036'
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Date:
|
32
|
+
- Thu, 27 May 2021 22:09:33 GMT
|
33
|
+
Server:
|
34
|
+
- Cowboy
|
35
|
+
X-Request-Id:
|
36
|
+
- FoML5j3xoLluoLcAABoC
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"data":[{"body":"Random body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"1542e6eb-1ecf-48ed-b43e-692b90ce16c3","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T23:09:34Z"},{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
40
|
+
\"very-true|\"}","id":"5a9b0427-0b3c-4de4-a797-70b734540a78","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2030-05-25T22:27:23Z"},{"body":"Random
|
41
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"48e4cda8-80bf-4f3f-8d1d-486cbbd71472","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T23:09:10Z"},{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
42
|
+
\"very-true|\"}","id":"da7fe5c3-0df0-48c9-b8cd-a1e3a6ef2d48","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2030-05-25T22:27:23Z"},{"body":"Random
|
43
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"b0f601d6-2909-43fe-855a-19356ab4e9e1","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T23:08:44Z"},{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
44
|
+
\"very-true|\"}","id":"21997dc1-b260-418a-a60c-f73da8225a90","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2030-05-25T22:27:23Z"},{"body":"Random
|
45
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"64d1af07-194f-45a1-be19-e6a6785cf58b","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T23:06:37Z"},{"body":"Random
|
46
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"8f32a976-3394-411e-af87-6a45e520508d","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:42:53Z"},{"body":"Random
|
47
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"294808fc-d282-4161-9735-324cb52bb3e5","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:40:54Z"},{"body":"Random
|
48
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"8958fb63-1783-437c-b663-2479d2a2ec89","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:40:36Z"},{"body":"Random
|
49
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"ede94ef6-a30a-4951-b1b4-cae4563a37aa","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:39:31Z"},{"body":"Random
|
50
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"99a3948b-b9d4-4634-8f01-8218426b87d0","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:30:22Z"},{"body":"Random
|
51
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"8550b0d6-a9a8-4119-a658-4ceb1d039aca","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:29:58Z"},{"body":"Random
|
52
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"fad322a2-031f-4590-b3a2-cdffe62e6a21","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:28:36Z"},{"body":"Random
|
53
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"a0770f22-7cb2-4153-bc1f-f0c109e03434","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:28:26Z"},{"body":"Random
|
54
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"d3d3ea7d-bd5a-4ebb-abb6-57eab91dec1f","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:27:21Z"},{"body":"Random
|
55
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"d5e53bee-1229-4156-a3a3-d89e3b230152","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:26:53Z"},{"body":"Random
|
56
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"ea10b650-0842-4931-a0ba-db28acace938","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:26:43Z"},{"body":"Random
|
57
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"52a19459-9670-4baa-98b1-dd36a324f926","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2031-04-05T21:24:12Z"},{"body":"Random
|
58
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"96eca7ef-62c6-40b1-ab22-b766a4603898","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:23:28Z"},{"body":"Random
|
59
|
+
body","dispatched_at":"2021-05-27T22:05:48Z","endpoint":"https://api.fake-site.com","enqueued_at":"2021-05-27T22:04:48Z","headers":"{\"Random-Header\":\"Something\"}","id":"d9ab3ca6-cc9f-4ecf-b63e-f116468aa260","locked_at":"2021-05-27T22:04:48Z","method":"post","origin":"rest_api","scheduled_for":"2021-05-27T22:05:48Z"},{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
60
|
+
\"very-true|\"}","id":"3da0cbaa-99e1-432e-94ab-ec453f4da456","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2021-05-31T05:48:42Z"},{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
61
|
+
\"very-true|\"}","id":"1bbf5b4b-50e1-488f-b152-28799edb9029","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2021-05-31T05:48:42Z"},{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
62
|
+
\"very-true|\"}","id":"58bc8f8d-e846-421c-8bc8-4abd23a278d0","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2021-05-31T05:48:42Z"},{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
63
|
+
\"very-true|\"}","id":"e3dd724f-23f1-4f6c-a097-3167158f3947","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2021-05-31T05:48:42Z"},{"body":"testing","dispatched_at":null,"endpoint":"http://localhost:4000/ping","enqueued_at":null,"headers":"{\"hello\":
|
64
|
+
\"very-true|\"}","id":"2329af76-17f4-4fe7-8748-7ecb8d37026f","locked_at":null,"method":"post","origin":"graphql_api","scheduled_for":"2021-05-31T05:48:42Z"},{"body":"Random
|
65
|
+
body","dispatched_at":"2021-05-27T21:27:32Z","endpoint":"https://api.fake-site.com","enqueued_at":"2021-05-27T21:26:50Z","headers":"{\"Random-Header\":\"Something\"}","id":"ffea07bf-0f2f-43f8-b471-2c4c2ce63603","locked_at":"2021-05-27T21:26:50Z","method":"post","origin":"rest_api","scheduled_for":"2021-05-27T21:27:32Z"},{"body":"Random
|
66
|
+
body","dispatched_at":"2021-05-27T21:27:28Z","endpoint":"https://api.fake-site.com","enqueued_at":"2021-05-27T21:26:50Z","headers":"{\"Random-Header\":\"Something\"}","id":"7b8e06da-4e1d-4f95-92bc-4b13d9d710e7","locked_at":"2021-05-27T21:26:50Z","method":"post","origin":"rest_api","scheduled_for":"2021-05-27T21:27:28Z"},{"body":"Random
|
67
|
+
body","dispatched_at":"2021-05-27T21:27:25Z","endpoint":"https://api.fake-site.com","enqueued_at":"2021-05-27T21:26:50Z","headers":"{\"Random-Header\":\"Something\"}","id":"340c3437-dd1a-4e12-923b-7c014b3830a0","locked_at":"2021-05-27T21:26:50Z","method":"post","origin":"rest_api","scheduled_for":"2021-05-27T21:27:25Z"},{"body":"Random
|
68
|
+
body","dispatched_at":"2021-05-27T21:27:21Z","endpoint":"https://api.fake-site.com","enqueued_at":"2021-05-27T21:26:50Z","headers":"{\"Random-Header\":\"Something\"}","id":"d5b0534c-5ebe-4067-9260-f68a9c71f806","locked_at":"2021-05-27T21:26:50Z","method":"post","origin":"rest_api","scheduled_for":"2021-05-27T21:27:21Z"},{"body":"Random
|
69
|
+
body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"7cd87ce9-6ef6-4d55-8016-91c206089435","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2031-04-05T19:59:14Z"}]}'
|
70
|
+
recorded_at: Thu, 27 May 2021 22:09:34 GMT
|
71
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:4000/rest/events
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"scheduled_for":"2021-05-27 18:09:34 -0500","method":"post","headers":{"Random-Header":"Something"},"body":"Random
|
9
|
+
body","endpoint":"https://api.fake-site.com"}'
|
10
|
+
headers:
|
11
|
+
Accept-Encoding:
|
12
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
13
|
+
Accept:
|
14
|
+
- "*/*"
|
15
|
+
User-Agent:
|
16
|
+
- Ruby
|
17
|
+
Authorization:
|
18
|
+
- Bearer TONnZlNFWYG6CZ36v4tAwfA4UKRVX3_Ou8LNRmbkSFspd4xBl3oVaKkr_UfsAL2bgg_k39ENVzY1F90urvsBVA==
|
19
|
+
Content-Type:
|
20
|
+
- application/json
|
21
|
+
response:
|
22
|
+
status:
|
23
|
+
code: 201
|
24
|
+
message: Created
|
25
|
+
headers:
|
26
|
+
Cache-Control:
|
27
|
+
- max-age=0, private, must-revalidate
|
28
|
+
Content-Length:
|
29
|
+
- '292'
|
30
|
+
Content-Type:
|
31
|
+
- application/json; charset=utf-8
|
32
|
+
Date:
|
33
|
+
- Thu, 27 May 2021 22:09:33 GMT
|
34
|
+
Location:
|
35
|
+
- "/rest/events/1542e6eb-1ecf-48ed-b43e-692b90ce16c3"
|
36
|
+
Server:
|
37
|
+
- Cowboy
|
38
|
+
X-Request-Id:
|
39
|
+
- FoML5jm6X6osFBUAAAYJ
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"data":{"body":"Random body","dispatched_at":null,"endpoint":"https://api.fake-site.com","enqueued_at":null,"headers":"{\"Random-Header\":\"Something\"}","id":"1542e6eb-1ecf-48ed-b43e-692b90ce16c3","locked_at":null,"method":"post","origin":"rest_api","scheduled_for":"2021-05-27T23:09:34Z"}}'
|
43
|
+
recorded_at: Thu, 27 May 2021 22:09:34 GMT
|
44
|
+
recorded_with: VCR 6.0.0
|
data/lib/bloodbath.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "forwardable"
|
4
|
+
|
5
|
+
require_relative "bloodbath/version"
|
6
|
+
require_relative "bloodbath/configuration"
|
7
|
+
require_relative "bloodbath/event"
|
8
|
+
|
9
|
+
module Bloodbath
|
10
|
+
class Error < StandardError; end
|
11
|
+
@config = Bloodbath::Configuration.new
|
12
|
+
|
13
|
+
class << self
|
14
|
+
extend Forwardable
|
15
|
+
|
16
|
+
attr_reader :config
|
17
|
+
|
18
|
+
def_delegators :@config, :api_key, :api_key=
|
19
|
+
def_delegators :@config, :api_base, :api_base=
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "net/http"
|
3
|
+
require "pry"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Bloodbath
|
7
|
+
module Adapters
|
8
|
+
class Rest
|
9
|
+
attr_reader :method, :endpoint, :body, :config
|
10
|
+
|
11
|
+
def initialize(method:, endpoint:, body: nil, config: Bloodbath.config)
|
12
|
+
@method = method
|
13
|
+
@endpoint = endpoint
|
14
|
+
@body = body
|
15
|
+
@config = config
|
16
|
+
end
|
17
|
+
|
18
|
+
def perform
|
19
|
+
check_api_key
|
20
|
+
response
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def check_api_key
|
26
|
+
raise Bloodbath::Error, "Please set your API key through Bloodbath.api_key = 'my-api-key'" unless config.api_key
|
27
|
+
end
|
28
|
+
|
29
|
+
def response
|
30
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
31
|
+
http.use_ssl = true if uri.instance_of?(URI::HTTPS)
|
32
|
+
|
33
|
+
request["Authorization"] = "Bearer #{config.api_key}"
|
34
|
+
request["Content-Type"] = "application/json"
|
35
|
+
request.body = body.to_json
|
36
|
+
|
37
|
+
response = http.request(request)
|
38
|
+
serialized_response_from(response.body)
|
39
|
+
end
|
40
|
+
|
41
|
+
def serialized_response_from(body)
|
42
|
+
return {} if body.nil?
|
43
|
+
|
44
|
+
JSON.parse(body, symbolize_names: true)
|
45
|
+
rescue JSON::ParserError
|
46
|
+
{}
|
47
|
+
end
|
48
|
+
|
49
|
+
def uri
|
50
|
+
@uri ||= URI("#{config.api_base}#{endpoint}")
|
51
|
+
end
|
52
|
+
|
53
|
+
def request
|
54
|
+
@request ||= case method
|
55
|
+
when :post
|
56
|
+
Net::HTTP::Post
|
57
|
+
when :get
|
58
|
+
Net::HTTP::Get
|
59
|
+
when :delete
|
60
|
+
Net::HTTP::Delete
|
61
|
+
when :patch
|
62
|
+
Net::HTTP::Patch
|
63
|
+
when :put
|
64
|
+
Net::HTTP::Put
|
65
|
+
end.new(uri.request_uri)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
module Bloodbath
|
72
|
+
class Event
|
73
|
+
class << self
|
74
|
+
def schedule(args)
|
75
|
+
adapter.new(method: :post, endpoint: "/events", body: args).perform
|
76
|
+
end
|
77
|
+
|
78
|
+
def list
|
79
|
+
adapter.new(method: :get, endpoint: "/events").perform
|
80
|
+
end
|
81
|
+
|
82
|
+
def find(id)
|
83
|
+
adapter.new(method: :get, endpoint: "/events/#{id}").perform
|
84
|
+
end
|
85
|
+
|
86
|
+
def cancel(id)
|
87
|
+
adapter.new(method: :delete, endpoint: "/events/#{id}").perform
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def adapter
|
93
|
+
Bloodbath::Adapters::Rest
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
metadata
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bloodbath
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Laurent Schaffner
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '13.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '13.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.5.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.5.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-shopify
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 2.1.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 2.1.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: vcr
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 6.0.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 6.0.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: webmock
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.13.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 3.13.0
|
139
|
+
description:
|
140
|
+
email:
|
141
|
+
- laurent.schaffner.code@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".github/workflows/main.yml"
|
147
|
+
- ".gitignore"
|
148
|
+
- ".rspec"
|
149
|
+
- ".rspec_status"
|
150
|
+
- ".rubocop.yml"
|
151
|
+
- CHANGELOG.md
|
152
|
+
- CODE_OF_CONDUCT.md
|
153
|
+
- Gemfile
|
154
|
+
- Gemfile.lock
|
155
|
+
- LICENSE
|
156
|
+
- README.md
|
157
|
+
- Rakefile
|
158
|
+
- bin/console
|
159
|
+
- bin/setup
|
160
|
+
- bloodbath.gemspec
|
161
|
+
- fixtures/vcr_cassettes/Bloodbath_Event/_cancel/1_4_1.yml
|
162
|
+
- fixtures/vcr_cassettes/Bloodbath_Event/_find/1_3_1.yml
|
163
|
+
- fixtures/vcr_cassettes/Bloodbath_Event/_list/1_2_1.yml
|
164
|
+
- fixtures/vcr_cassettes/Bloodbath_Event/_schedule/1_1_1.yml
|
165
|
+
- lib/bloodbath.rb
|
166
|
+
- lib/bloodbath/configuration.rb
|
167
|
+
- lib/bloodbath/event.rb
|
168
|
+
- lib/bloodbath/version.rb
|
169
|
+
homepage: https://bloodbath.io
|
170
|
+
licenses: []
|
171
|
+
metadata:
|
172
|
+
allowed_push_host: https://rubygems.org
|
173
|
+
homepage_uri: https://bloodbath.io
|
174
|
+
source_code_uri: https://github.com/bloodbath-io/bloodbath-ruby
|
175
|
+
changelog_uri: https://github.com/bloodbath-io/bloodbath-ruby/blob/main/CHANGELOG.md
|
176
|
+
post_install_message:
|
177
|
+
rdoc_options: []
|
178
|
+
require_paths:
|
179
|
+
- lib
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: 2.4.0
|
185
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - ">="
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: '0'
|
190
|
+
requirements: []
|
191
|
+
rubygems_version: 3.2.3
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: The Bloodbath Ruby library provides convenient access to the Bloodbath APIfrom
|
195
|
+
applications written in the Ruby language.
|
196
|
+
test_files: []
|