orbit_activities 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/CONTRIBUTING.md +67 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +92 -0
- data/LICENSE +21 -0
- data/README.md +47 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/orbit_activities.rb +11 -0
- data/lib/orbit_activities/request.rb +53 -0
- data/lib/orbit_activities/utils.rb +11 -0
- data/lib/orbit_activities/version.rb +6 -0
- data/orbit_activities.gemspec +37 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c26b382df27b22b7e81b7bea5245cf76057a6be007bade8477144edb19e21347
|
4
|
+
data.tar.gz: a84f1efce2cc24565e5c7ed7b4f6aa18ee155ac483d1a8c05759df6c848fbddc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: af88365fa3a0d1ca59d0b1f54cb9204f9be397fe06394b4140f700e3b24ecc3711674cb8f4494e6bd2655dc92b6724b56e311bd577b295e64e30d40e0fb949e3
|
7
|
+
data.tar.gz: 6cd5d2bfc5d0d8eaca37c4c0af8082e0008316d6fc5e67f1712274c998e13673105d07b8b0539a70af3b3955cf9b53ffb9e70bcd0ad0892ec55d4d765ac319ab
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual identity
|
10
|
+
and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
26
|
+
overall community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
31
|
+
advances of any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email
|
35
|
+
address, without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
team@orbit.love.
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
86
|
+
of actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
93
|
+
permanent ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
113
|
+
the community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.0, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
|
126
|
+
at [https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Contributing Guidelines
|
2
|
+
|
3
|
+
We 💜 contributions from everyone! 🎉
|
4
|
+
|
5
|
+
It is a good idea to [talk to us on Discord](https://discord.orbit.love/) first if you plan to add any new functionality. Otherwise, bug reports, bug fixes and feedback on this project is always appreciated.
|
6
|
+
|
7
|
+
![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat "Contributions Welcome")
|
8
|
+
|
9
|
+
The following is a set of guidelines for contributing to this project, which are hosted on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
|
10
|
+
|
11
|
+
Please take the time to review the [Code of Conduct](CODE_OF_CONDUCT.md), which all contributors are subject to on this project.
|
12
|
+
|
13
|
+
**Table of Contents**
|
14
|
+
|
15
|
+
- [Reporting Bugs](#reporting-bugs)
|
16
|
+
- [Suggesting Enhancements](#suggesting-enhancements)
|
17
|
+
- [Pull Requests](#pull-requests)
|
18
|
+
|
19
|
+
## Reporting Bugs
|
20
|
+
|
21
|
+
This section guides you through submitting a bug report. Following these guidelines helps maintainers and the community understand your report , reproduce the behavior, and find related reports.
|
22
|
+
|
23
|
+
Before creating bug reports, please do a quick search of existing issues as you might find out that you don't need to create one.
|
24
|
+
|
25
|
+
When you are creating a bug report, please include as many details as possible. Fill out the required template, the information it asks for helps us resolve issues faster.
|
26
|
+
|
27
|
+
### How Do I Submit A (Good) Bug Report?
|
28
|
+
|
29
|
+
Bugs are tracked as GitHub issues. Create an issue and provide the following information by filling in the provided template which appears when you try and open an issue.
|
30
|
+
|
31
|
+
Explain the problem and include additional details to help maintainers reproduce the problem:
|
32
|
+
|
33
|
+
* **Use a clear and descriptive title** for the issue to identify the problem.
|
34
|
+
* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining how you started. When listing steps, **don't just say what you did, but explain how you did it**.
|
35
|
+
* **Provide specific examples to demonstrate the steps**. Include links to files or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use Markdown code blocks.
|
36
|
+
* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
|
37
|
+
* **Explain which behavior you expected to see instead and why.**
|
38
|
+
* **Include screenshots and animated GIFs** where possible. Show how you follow the described steps and clearly demonstrate the problem.
|
39
|
+
* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.
|
40
|
+
* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
|
41
|
+
Include details about your configuration and environment:
|
42
|
+
|
43
|
+
## Suggesting Enhancements
|
44
|
+
|
45
|
+
This section guides you through submitting a suggestion, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions.
|
46
|
+
|
47
|
+
Before creating a suggestion, please do a quick search of existing issues as you might find out that you don't need to create one.
|
48
|
+
|
49
|
+
### How Do I Submit A (Good) Enhancement Suggestion?
|
50
|
+
|
51
|
+
Enhancement suggestions are tracked as GitHub issues. Create an issue and provide the following information by filling in the provided template which appears when you try and open an issue.
|
52
|
+
|
53
|
+
* **Use a clear and descriptive title** for the issue to identify the suggestion.
|
54
|
+
* **Provide a step-by-step description of the suggested enhancement** in as many details as possible.
|
55
|
+
* **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as Markdown code blocks.
|
56
|
+
* **Describe the current behavior** and **explain which behavior you expected to see instead** and why.
|
57
|
+
* **Explain why this enhancement would be useful** to most users.
|
58
|
+
|
59
|
+
## Pull Requests
|
60
|
+
|
61
|
+
Please follow these steps to have your contribution considered by the maintainers:
|
62
|
+
|
63
|
+
1. Follow all instructions in the template.
|
64
|
+
2. Adhear the Code of Conduct.
|
65
|
+
3. After you submit your pull request, verify that all [status checks](https://help.github.com/articles/about-status-checks/) are passing.
|
66
|
+
|
67
|
+
While the prerequisites above must be satisfied prior to having your pull request reviewed, the reviewer(s) may ask you to complete additional design work, tests, or other changes before your pull request can be ultimately accepted.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
orbit_activities (0.0.1)
|
5
|
+
http (~> 4.4)
|
6
|
+
json (~> 2.5)
|
7
|
+
rake (~> 13.0)
|
8
|
+
zeitwerk (~> 2.4)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.7.0)
|
14
|
+
public_suffix (>= 2.0.2, < 5.0)
|
15
|
+
ast (2.4.2)
|
16
|
+
byebug (11.1.3)
|
17
|
+
crack (0.4.5)
|
18
|
+
rexml
|
19
|
+
diff-lcs (1.4.4)
|
20
|
+
domain_name (0.5.20190701)
|
21
|
+
unf (>= 0.0.5, < 1.0.0)
|
22
|
+
ffi (1.15.0)
|
23
|
+
ffi-compiler (1.0.1)
|
24
|
+
ffi (>= 1.0.0)
|
25
|
+
rake
|
26
|
+
hashdiff (1.0.1)
|
27
|
+
http (4.4.1)
|
28
|
+
addressable (~> 2.3)
|
29
|
+
http-cookie (~> 1.0)
|
30
|
+
http-form_data (~> 2.2)
|
31
|
+
http-parser (~> 1.2.0)
|
32
|
+
http-cookie (1.0.3)
|
33
|
+
domain_name (~> 0.5)
|
34
|
+
http-form_data (2.3.0)
|
35
|
+
http-parser (1.2.3)
|
36
|
+
ffi-compiler (>= 1.0, < 2.0)
|
37
|
+
json (2.5.1)
|
38
|
+
parallel (1.20.1)
|
39
|
+
parser (3.0.1.1)
|
40
|
+
ast (~> 2.4.1)
|
41
|
+
public_suffix (4.0.6)
|
42
|
+
rainbow (3.0.0)
|
43
|
+
rake (13.0.3)
|
44
|
+
regexp_parser (2.1.1)
|
45
|
+
rexml (3.2.5)
|
46
|
+
rspec (3.10.0)
|
47
|
+
rspec-core (~> 3.10.0)
|
48
|
+
rspec-expectations (~> 3.10.0)
|
49
|
+
rspec-mocks (~> 3.10.0)
|
50
|
+
rspec-core (3.10.1)
|
51
|
+
rspec-support (~> 3.10.0)
|
52
|
+
rspec-expectations (3.10.1)
|
53
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
54
|
+
rspec-support (~> 3.10.0)
|
55
|
+
rspec-mocks (3.10.2)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.10.0)
|
58
|
+
rspec-support (3.10.2)
|
59
|
+
rubocop (1.14.0)
|
60
|
+
parallel (~> 1.10)
|
61
|
+
parser (>= 3.0.0.0)
|
62
|
+
rainbow (>= 2.2.2, < 4.0)
|
63
|
+
regexp_parser (>= 1.8, < 3.0)
|
64
|
+
rexml
|
65
|
+
rubocop-ast (>= 1.5.0, < 2.0)
|
66
|
+
ruby-progressbar (~> 1.7)
|
67
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
68
|
+
rubocop-ast (1.5.0)
|
69
|
+
parser (>= 3.0.1.1)
|
70
|
+
ruby-progressbar (1.11.0)
|
71
|
+
unf (0.1.4)
|
72
|
+
unf_ext
|
73
|
+
unf_ext (0.0.7.7)
|
74
|
+
unicode-display_width (2.0.0)
|
75
|
+
webmock (3.12.2)
|
76
|
+
addressable (>= 2.3.6)
|
77
|
+
crack (>= 0.3.2)
|
78
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
79
|
+
zeitwerk (2.4.2)
|
80
|
+
|
81
|
+
PLATFORMS
|
82
|
+
arm64-darwin-20
|
83
|
+
|
84
|
+
DEPENDENCIES
|
85
|
+
byebug
|
86
|
+
orbit_activities!
|
87
|
+
rspec (~> 3.4)
|
88
|
+
rubocop (~> 1.7)
|
89
|
+
webmock (~> 3.12)
|
90
|
+
|
91
|
+
BUNDLED WITH
|
92
|
+
2.2.16
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Orbit Labs, Inc.
|
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,47 @@
|
|
1
|
+
# Orbit API Create Custom Activities Helper
|
2
|
+
|
3
|
+
![Build Status](https://github.com/orbit-love/ruby-create-activities/workflows/CI/badge.svg)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/orbit_activities.svg)](https://badge.fury.io/rb/orbit_activities)
|
5
|
+
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](code_of_conduct.md)
|
6
|
+
|
7
|
+
> This is a Ruby gem that can be included in any Ruby application to take care of the logic of interacting with the Orbit API to create custom activities.
|
8
|
+
|
9
|
+
<hr />
|
10
|
+
|
11
|
+
## Package Usage
|
12
|
+
|
13
|
+
### Installation
|
14
|
+
|
15
|
+
To install this integration in a standalone app, add the gem to your `Gemfile`:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem "orbit_activities"
|
19
|
+
```
|
20
|
+
|
21
|
+
Then, run `bundle install` from your terminal.
|
22
|
+
|
23
|
+
### Send Custom Activity
|
24
|
+
|
25
|
+
To send a custom activity to Orbit using the gem, instantiate a new instance of the `Request` class:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
OrbitActivities::Request.new(
|
29
|
+
api_key: # Your Orbit API key,
|
30
|
+
workspace_id: # Your Orbit workspace ID,
|
31
|
+
body: # The custom activity object
|
32
|
+
)
|
33
|
+
```
|
34
|
+
|
35
|
+
For details on the data structure the Orbit API expects for a custom activity object, refer to the [Orbit API Documentation](https://docs.orbit.love/reference#post_-workspace-id-activities).
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
We 💜 contributions from everyone! Check out the [Contributing Guidelines](CONTRIBUTING.md) for more information.
|
40
|
+
|
41
|
+
## License
|
42
|
+
|
43
|
+
This is available as open source under the terms of the [MIT License](LICENSE).
|
44
|
+
|
45
|
+
## Code of Conduct
|
46
|
+
|
47
|
+
This project uses the [Contributor Code of Conduct](CODE_OF_CONDUCT.md). We ask everyone to please adhere by its guidelines.
|
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 "orbit_activities"
|
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
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "net/http"
|
4
|
+
require "json"
|
5
|
+
require_relative "utils"
|
6
|
+
|
7
|
+
module OrbitActivities
|
8
|
+
class Request
|
9
|
+
attr_reader :api_key, :workspace_id, :user_agent, :body
|
10
|
+
|
11
|
+
def initialize(params = {})
|
12
|
+
@api_key = params.fetch(:api_key)
|
13
|
+
@workspace_id = params.fetch(:workspace_id)
|
14
|
+
@user_agent = params.fetch(:user_agent, "ruby-orbit-activities/#{OrbitActivities::VERSION}")
|
15
|
+
@body = params.fetch(:body)
|
16
|
+
|
17
|
+
after_initialize!
|
18
|
+
end
|
19
|
+
|
20
|
+
def after_initialize!
|
21
|
+
call
|
22
|
+
end
|
23
|
+
|
24
|
+
def call
|
25
|
+
payload = make_request
|
26
|
+
validate_payload(payload)
|
27
|
+
end
|
28
|
+
|
29
|
+
def make_request
|
30
|
+
url = URI("https://app.orbit.love/api/v1/#{@workspace_id}/activities")
|
31
|
+
|
32
|
+
http = Net::HTTP.new(url.host, url.port)
|
33
|
+
http.use_ssl = true
|
34
|
+
req = Net::HTTP::Post.new(url)
|
35
|
+
req["Accept"] = "application/json"
|
36
|
+
req["Content-Type"] = "application/json"
|
37
|
+
req["Authorization"] = "Bearer #{@api_key}"
|
38
|
+
req["User-Agent"] = @user_agent
|
39
|
+
|
40
|
+
req.body = @body
|
41
|
+
|
42
|
+
req.body = @body.to_json
|
43
|
+
|
44
|
+
response = http.request(req)
|
45
|
+
|
46
|
+
response.body
|
47
|
+
end
|
48
|
+
|
49
|
+
def validate_payload(payload)
|
50
|
+
JSON.parse(payload) if OrbitActivities::Utils.valid_json?(payload)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OrbitActivities
|
4
|
+
class Utils
|
5
|
+
def self.valid_json?(string)
|
6
|
+
!JSON.parse(string).nil?
|
7
|
+
rescue JSON::ParserError
|
8
|
+
raise ArgumentError, "Expected confirmation from the Orbit API, but received nothing. Please check your logs and try again."
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/orbit_activities/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "orbit_activities"
|
7
|
+
spec.version = OrbitActivities::VERSION
|
8
|
+
spec.authors = ["Orbit DevRel", "Ben Greenberg"]
|
9
|
+
spec.email = ["devrel@orbit.love"]
|
10
|
+
|
11
|
+
spec.summary = "A helper library to build custom activities for Orbit"
|
12
|
+
spec.description = "This gem helps you build custom activities for Orbit workspaces using the Orbit API"
|
13
|
+
spec.homepage = "https://github.com/orbit-love/ruby-orbit-activities"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.2")
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/orbit-love/ruby-orbit-activities/blob/main/CHANGELOG.md"
|
20
|
+
|
21
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.bindir = "bin"
|
26
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency "http", "~> 4.4"
|
30
|
+
spec.add_dependency "json", "~> 2.5"
|
31
|
+
spec.add_dependency "zeitwerk", "~> 2.4"
|
32
|
+
spec.add_dependency "rake", "~> 13.0"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
34
|
+
spec.add_development_dependency "webmock", "~> 3.12"
|
35
|
+
spec.add_development_dependency "rubocop", "~> 1.7"
|
36
|
+
spec.add_development_dependency "byebug"
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: orbit_activities
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Orbit DevRel
|
8
|
+
- Ben Greenberg
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2021-05-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: http
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '4.4'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '4.4'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: json
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2.5'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '2.5'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: zeitwerk
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '2.4'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '2.4'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '13.0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '13.0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.4'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.4'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: webmock
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '3.12'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '3.12'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rubocop
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1.7'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.7'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: byebug
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: This gem helps you build custom activities for Orbit workspaces using
|
127
|
+
the Orbit API
|
128
|
+
email:
|
129
|
+
- devrel@orbit.love
|
130
|
+
executables:
|
131
|
+
- console
|
132
|
+
- setup
|
133
|
+
extensions: []
|
134
|
+
extra_rdoc_files: []
|
135
|
+
files:
|
136
|
+
- ".gitignore"
|
137
|
+
- CODE_OF_CONDUCT.md
|
138
|
+
- CONTRIBUTING.md
|
139
|
+
- Gemfile
|
140
|
+
- Gemfile.lock
|
141
|
+
- LICENSE
|
142
|
+
- README.md
|
143
|
+
- bin/console
|
144
|
+
- bin/setup
|
145
|
+
- lib/orbit_activities.rb
|
146
|
+
- lib/orbit_activities/request.rb
|
147
|
+
- lib/orbit_activities/utils.rb
|
148
|
+
- lib/orbit_activities/version.rb
|
149
|
+
- orbit_activities.gemspec
|
150
|
+
homepage: https://github.com/orbit-love/ruby-orbit-activities
|
151
|
+
licenses:
|
152
|
+
- MIT
|
153
|
+
metadata:
|
154
|
+
homepage_uri: https://github.com/orbit-love/ruby-orbit-activities
|
155
|
+
source_code_uri: https://github.com/orbit-love/ruby-orbit-activities
|
156
|
+
changelog_uri: https://github.com/orbit-love/ruby-orbit-activities/blob/main/CHANGELOG.md
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options: []
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: 2.7.2
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubygems_version: 3.2.15
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: A helper library to build custom activities for Orbit
|
176
|
+
test_files: []
|