meetup_orbit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bbc753203183aaba02954bca4c979f8b6d82a146dc2e538f55faa00c7b9a90fd
4
+ data.tar.gz: 5e55cd5d2c4af97c24188bbcc4166946a6fdfacd849f487d8a9bddea4936661d
5
+ SHA512:
6
+ metadata.gz: 68d7c11ecc2a9bad11b415cda11d77d45afcccdf8374370eca3c80c95807b1e03890803091276b99e6eae278881a67d2eee0798794dd0a22908c5dcae86fee36
7
+ data.tar.gz: 0421e61aa08e40b720f8be0a677984cbc965e2f1e363f24b2becdf34967ce61d67e066a5e7c5dcf1cde9afae7a2baeac978ad0a5ed3c2643267115dcf22e3d24
data/.env.sample ADDED
@@ -0,0 +1,3 @@
1
+ MEETUP_URLNAME=
2
+ ORBIT_API_KEY=
3
+ ORBIT_WORKSPACE_ID=
@@ -0,0 +1,134 @@
1
+ <small><a href="../README.md">Back to README</a></small>
2
+
3
+ # Code of Conduct
4
+
5
+ ## Our Pledge
6
+
7
+ We as members, contributors, and leaders pledge to make participation in our
8
+ community a harassment-free experience for everyone, regardless of age, body
9
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
10
+ identity and expression, level of experience, education, socio-economic status,
11
+ nationality, personal appearance, race, caste, color, religion, or sexual identity
12
+ and orientation.
13
+
14
+ We pledge to act and interact in ways that contribute to an open, welcoming,
15
+ diverse, inclusive, and healthy community.
16
+
17
+ ## Our Standards
18
+
19
+ Examples of behavior that contributes to a positive environment for our
20
+ community include:
21
+
22
+ * Demonstrating empathy and kindness toward other people
23
+ * Being respectful of differing opinions, viewpoints, and experiences
24
+ * Giving and gracefully accepting constructive feedback
25
+ * Accepting responsibility and apologizing to those affected by our mistakes,
26
+ and learning from the experience
27
+ * Focusing on what is best not just for us as individuals, but for the
28
+ overall community
29
+
30
+ Examples of unacceptable behavior include:
31
+
32
+ * The use of sexualized language or imagery, and sexual attention or
33
+ advances of any kind
34
+ * Trolling, insulting or derogatory comments, and personal or political attacks
35
+ * Public or private harassment
36
+ * Publishing others' private information, such as a physical or email
37
+ address, without their explicit permission
38
+ * Other conduct which could reasonably be considered inappropriate in a
39
+ professional setting
40
+
41
+ ## Enforcement Responsibilities
42
+
43
+ Community leaders are responsible for clarifying and enforcing our standards of
44
+ acceptable behavior and will take appropriate and fair corrective action in
45
+ response to any behavior that they deem inappropriate, threatening, offensive,
46
+ or harmful.
47
+
48
+ Community leaders have the right and responsibility to remove, edit, or reject
49
+ comments, commits, code, wiki edits, issues, and other contributions that are
50
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
51
+ decisions when appropriate.
52
+
53
+ ## Scope
54
+
55
+ This Code of Conduct applies within all community spaces, and also applies when
56
+ an individual is officially representing the community in public spaces.
57
+ Examples of representing our community include using an official e-mail address,
58
+ posting via an official social media account, or acting as an appointed
59
+ representative at an online or offline event.
60
+
61
+ ## Enforcement
62
+
63
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
64
+ reported to the community leaders responsible for enforcement at
65
+ team@orbit.love.
66
+ All complaints will be reviewed and investigated promptly and fairly.
67
+
68
+ All community leaders are obligated to respect the privacy and security of the
69
+ reporter of any incident.
70
+
71
+ ## Enforcement Guidelines
72
+
73
+ Community leaders will follow these Community Impact Guidelines in determining
74
+ the consequences for any action they deem in violation of this Code of Conduct:
75
+
76
+ ### 1. Correction
77
+
78
+ **Community Impact**: Use of inappropriate language or other behavior deemed
79
+ unprofessional or unwelcome in the community.
80
+
81
+ **Consequence**: A private, written warning from community leaders, providing
82
+ clarity around the nature of the violation and an explanation of why the
83
+ behavior was inappropriate. A public apology may be requested.
84
+
85
+ ### 2. Warning
86
+
87
+ **Community Impact**: A violation through a single incident or series
88
+ of actions.
89
+
90
+ **Consequence**: A warning with consequences for continued behavior. No
91
+ interaction with the people involved, including unsolicited interaction with
92
+ those enforcing the Code of Conduct, for a specified period of time. This
93
+ includes avoiding interactions in community spaces as well as external channels
94
+ like social media. Violating these terms may lead to a temporary or
95
+ permanent ban.
96
+
97
+ ### 3. Temporary Ban
98
+
99
+ **Community Impact**: A serious violation of community standards, including
100
+ sustained inappropriate behavior.
101
+
102
+ **Consequence**: A temporary ban from any sort of interaction or public
103
+ communication with the community for a specified period of time. No public or
104
+ private interaction with the people involved, including unsolicited interaction
105
+ with those enforcing the Code of Conduct, is allowed during this period.
106
+ Violating these terms may lead to a permanent ban.
107
+
108
+ ### 4. Permanent Ban
109
+
110
+ **Community Impact**: Demonstrating a pattern of violation of community
111
+ standards, including sustained inappropriate behavior, harassment of an
112
+ individual, or aggression toward or disparagement of classes of individuals.
113
+
114
+ **Consequence**: A permanent ban from any sort of public interaction within
115
+ the community.
116
+
117
+ ## Attribution
118
+
119
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
120
+ version 2.0, available at
121
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
122
+
123
+ Community Impact Guidelines were inspired by
124
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
128
+ at [https://www.contributor-covenant.org/translations][translations].
129
+
130
+ [homepage]: https://www.contributor-covenant.org
131
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
132
+ [Mozilla CoC]: https://github.com/mozilla/diversity
133
+ [FAQ]: https://www.contributor-covenant.org/faq
134
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,69 @@
1
+ <small><a href="../README.md">Back to README</a></small>
2
+
3
+ # Contributing Guidelines
4
+
5
+ We 💜 contributions from everyone! 🎉
6
+
7
+ 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.
8
+
9
+ ![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat "Contributions Welcome")
10
+
11
+ 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.
12
+
13
+ Please take the time to review the [Code of Conduct](CODE_OF_CONDUCT.md), which all contributors are subject to on this project.
14
+
15
+ **Table of Contents**
16
+
17
+ - [Reporting Bugs](#reporting-bugs)
18
+ - [Suggesting Enhancements](#suggesting-enhancements)
19
+ - [Pull Requests](#pull-requests)
20
+
21
+ ## Reporting Bugs
22
+
23
+ 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.
24
+
25
+ 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.
26
+
27
+ 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.
28
+
29
+ ### How Do I Submit A (Good) Bug Report?
30
+
31
+ 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.
32
+
33
+ Explain the problem and include additional details to help maintainers reproduce the problem:
34
+
35
+ * **Use a clear and descriptive title** for the issue to identify the problem.
36
+ * **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**.
37
+ * **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.
38
+ * **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
39
+ * **Explain which behavior you expected to see instead and why.**
40
+ * **Include screenshots and animated GIFs** where possible. Show how you follow the described steps and clearly demonstrate the problem.
41
+ * **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.
42
+ * **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
43
+ Include details about your configuration and environment:
44
+
45
+ ## Suggesting Enhancements
46
+
47
+ 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.
48
+
49
+ 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.
50
+
51
+ ### How Do I Submit A (Good) Enhancement Suggestion?
52
+
53
+ 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.
54
+
55
+ * **Use a clear and descriptive title** for the issue to identify the suggestion.
56
+ * **Provide a step-by-step description of the suggested enhancement** in as many details as possible.
57
+ * **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as Markdown code blocks.
58
+ * **Describe the current behavior** and **explain which behavior you expected to see instead** and why.
59
+ * **Explain why this enhancement would be useful** to most users.
60
+
61
+ ## Pull Requests
62
+
63
+ Please follow these steps to have your contribution considered by the maintainers:
64
+
65
+ 1. Follow all instructions in the template.
66
+ 2. Adhear the Code of Conduct.
67
+ 3. After you submit your pull request, verify that all [status checks](https://help.github.com/articles/about-status-checks/) are passing.
68
+
69
+ 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.
@@ -0,0 +1,25 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ matrix:
13
+ os: [ubuntu-latest, macos-latest]
14
+ ruby: [2.7, 3.0]
15
+ runs-on: ${{ matrix.os }}
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - name: Set up Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ - name: Install dependencies
23
+ run: bundle install
24
+ - name: Run tests
25
+ run: bundle exec rspec
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ .env
2
+ *.db
3
+ .DS_Store
4
+ node_modules
5
+ *.gem
6
+ *.rbc
7
+ *.sassc
8
+ .bundle
9
+ .config
10
+ .yardoc
11
+ .rvmrc
12
+ .rspec
13
+ .sass-cache
14
+ .DS_Store
15
+ Gemfile.lock # gem projects only!
16
+ InstalledFiles
17
+ _yardoc
18
+ coverage
19
+ lib/bundler/man
20
+ capybara-*.html
21
+ pkg
22
+ rdoc
23
+ spec/reports
24
+ spec/tmp
25
+ test/tmp
26
+ test/version_tmp
27
+ tmp
28
+ logs
29
+ *.log
30
+ npm-debug.log*
31
+ yarn-debug.log*
32
+ yarn-error.log*
33
+ .npm
34
+ .byebug_history
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ gem "rake", "~> 13.0"
8
+
9
+ gem "rubocop", "~> 1.7"
10
+
11
+ gem "orbit_activities"
12
+
13
+ gem "byebug"
data/Gemfile.lock ADDED
@@ -0,0 +1,116 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ meetup_orbit (0.0.1)
5
+ activesupport (~> 6.1)
6
+ dotenv (~> 2.7)
7
+ http (~> 4.4)
8
+ json (~> 2.5)
9
+ orbit_activities (~> 0.1)
10
+ thor (~> 1.1)
11
+ zeitwerk (~> 2.4)
12
+
13
+ GEM
14
+ remote: https://rubygems.org/
15
+ specs:
16
+ activesupport (6.1.3.2)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ zeitwerk (~> 2.3)
22
+ addressable (2.7.0)
23
+ public_suffix (>= 2.0.2, < 5.0)
24
+ ast (2.4.2)
25
+ byebug (11.1.3)
26
+ concurrent-ruby (1.1.8)
27
+ crack (0.4.5)
28
+ rexml
29
+ diff-lcs (1.4.4)
30
+ domain_name (0.5.20190701)
31
+ unf (>= 0.0.5, < 1.0.0)
32
+ dotenv (2.7.6)
33
+ ffi (1.15.1)
34
+ ffi-compiler (1.0.1)
35
+ ffi (>= 1.0.0)
36
+ rake
37
+ hashdiff (1.0.1)
38
+ http (4.4.1)
39
+ addressable (~> 2.3)
40
+ http-cookie (~> 1.0)
41
+ http-form_data (~> 2.2)
42
+ http-parser (~> 1.2.0)
43
+ http-cookie (1.0.3)
44
+ domain_name (~> 0.5)
45
+ http-form_data (2.3.0)
46
+ http-parser (1.2.3)
47
+ ffi-compiler (>= 1.0, < 2.0)
48
+ i18n (1.8.10)
49
+ concurrent-ruby (~> 1.0)
50
+ json (2.5.1)
51
+ minitest (5.14.4)
52
+ orbit_activities (0.1.0)
53
+ http (~> 4.4)
54
+ json (~> 2.5)
55
+ rake (~> 13.0)
56
+ zeitwerk (~> 2.4)
57
+ parallel (1.20.1)
58
+ parser (3.0.1.1)
59
+ ast (~> 2.4.1)
60
+ public_suffix (4.0.6)
61
+ rainbow (3.0.0)
62
+ rake (13.0.3)
63
+ regexp_parser (2.1.1)
64
+ rexml (3.2.5)
65
+ rspec (3.10.0)
66
+ rspec-core (~> 3.10.0)
67
+ rspec-expectations (~> 3.10.0)
68
+ rspec-mocks (~> 3.10.0)
69
+ rspec-core (3.10.1)
70
+ rspec-support (~> 3.10.0)
71
+ rspec-expectations (3.10.1)
72
+ diff-lcs (>= 1.2.0, < 2.0)
73
+ rspec-support (~> 3.10.0)
74
+ rspec-mocks (3.10.2)
75
+ diff-lcs (>= 1.2.0, < 2.0)
76
+ rspec-support (~> 3.10.0)
77
+ rspec-support (3.10.2)
78
+ rubocop (1.15.0)
79
+ parallel (~> 1.10)
80
+ parser (>= 3.0.0.0)
81
+ rainbow (>= 2.2.2, < 4.0)
82
+ regexp_parser (>= 1.8, < 3.0)
83
+ rexml
84
+ rubocop-ast (>= 1.5.0, < 2.0)
85
+ ruby-progressbar (~> 1.7)
86
+ unicode-display_width (>= 1.4.0, < 3.0)
87
+ rubocop-ast (1.5.0)
88
+ parser (>= 3.0.1.1)
89
+ ruby-progressbar (1.11.0)
90
+ thor (1.1.0)
91
+ tzinfo (2.0.4)
92
+ concurrent-ruby (~> 1.0)
93
+ unf (0.1.4)
94
+ unf_ext
95
+ unf_ext (0.0.7.7)
96
+ unicode-display_width (2.0.0)
97
+ webmock (3.13.0)
98
+ addressable (>= 2.3.6)
99
+ crack (>= 0.3.2)
100
+ hashdiff (>= 0.4.0, < 2.0.0)
101
+ zeitwerk (2.4.2)
102
+
103
+ PLATFORMS
104
+ arm64-darwin-20
105
+
106
+ DEPENDENCIES
107
+ byebug
108
+ meetup_orbit!
109
+ orbit_activities
110
+ rake (~> 13.0)
111
+ rspec (~> 3.4)
112
+ rubocop (~> 1.7)
113
+ webmock (~> 3.12)
114
+
115
+ BUNDLED WITH
116
+ 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,87 @@
1
+ # Meetup Interactions to Orbit Workspace
2
+
3
+ ![Build Status](https://github.com/orbit-love/community-ruby-meetup-orbit/workflows/CI/badge.svg)
4
+ [![Gem Version](https://badge.fury.io/rb/meetup_orbit.svg)](https://badge.fury.io/rb/meetup_orbit)
5
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](.github/CODE_OF_CONDUCT.md)
6
+
7
+ Add your Meetup interactions into your Orbit workspace with this community-built integration.
8
+
9
+ |<p align="left">:sparkles:</p> This is a *community project*. The Orbit team does its best to maintain it and keep it up to date with any recent API changes.<br/><br/>We welcome community contributions to make sure that it stays current. <p align="right">:sparkles:</p>|
10
+ |-----------------------------------------|
11
+
12
+ ![There are three ways to use this integration. Install package - build and run your own applications. Run the CLI - run on-demand directly from your terminal. Schedule an automation with GitHub - get started in minutes - no coding required](readme-images/ways-to-use.png)
13
+
14
+ ## First Time Setup
15
+
16
+ To set up this integration you will need your Meetup group's URL identifier. See the below table for instructions on where to find it, along with your Orbit API credentials.
17
+ ## Application Credentials
18
+
19
+ The application requires the following environment variables:
20
+
21
+ | Variable | Description | More Info
22
+ |---|---|--|
23
+ | `MEETUP_URLNAME` | Meetup group URL identifier | The part of your Meetup group URL immediately after `meetup.com`, i.e. `https://www.meetup.com/meetup-group-example-123/`, the URL ID is `meetup-group-example-123`
24
+ | `ORBIT_API_KEY` | API key for Orbit | Found in `Account Settings` in your Orbit workspace
25
+ | `ORBIT_WORKSPACE_ID` | ID for your Orbit workspace | Last part of the Orbit workspace URL, i.e. `https://app.orbit.love/my-workspace`, the ID is `my-workspace`
26
+
27
+ ## Package Usage
28
+
29
+ Install the package with the following command
30
+
31
+ ```
32
+ $ gem install meetup_orbit
33
+ ```
34
+
35
+ Then, run `bundle install` from your terminal.
36
+
37
+ You can instantiate a client by either passing in the required credentials during instantiation or by providing them in your `.env` file.
38
+
39
+ ### Instantiation with credentials:
40
+
41
+ ```ruby
42
+ client = MeetupOrbit::Client.new(
43
+ orbit_api_key: YOUR_API_KEY,
44
+ orbit_workspace_id: YOUR_ORBIT_WORKSPACE_ID,
45
+ meetup_urlname: YOUR_MEETUP_URLNAME
46
+ )
47
+ ```
48
+
49
+ ### Instantiation with credentials in dotenv file:
50
+
51
+ ```ruby
52
+ client = MeetupOrbit::Client.new
53
+ ```
54
+ ### Fetching New Event RSVPs
55
+
56
+ Once, you have an instantiated client, you can fetch new Meetup event RSVPs and add them to your Orbit workspace by invoking the `#event_rsvps` method on the client:
57
+
58
+ ```ruby
59
+ client.event_rsvps
60
+ ```
61
+ ## CLI Usage
62
+
63
+ You can also use this package with the included CLI. To use the CLI pass in the required environment variables on the command line before invoking the CLI.
64
+
65
+ To check for new event RSVPs:
66
+
67
+ ```bash
68
+ $ ORBIT_API_KEY=... ORBIT_WORKSPACE_ID=... MEETUP_URLNAME=... bundle exec meetup_orbit --check-rsvps
69
+ ```
70
+
71
+ ## GitHub Actions Automation Setup
72
+
73
+ ⚡ You can set up this integration in a matter of minutes using our GitHub Actions template. It will run regularly to add new activities to your Orbit workspace. All you need is a GitHub account.
74
+
75
+ [See our guide for setting up this automation](https://github.com/orbit-love/github-actions-templates/blob/main/Meetup/README.md)
76
+
77
+ ## Contributing
78
+
79
+ We 💜 contributions from everyone! Check out the [Contributing Guidelines](.github/CONTRIBUTING.md) for more information.
80
+
81
+ ## License
82
+
83
+ This project is under the [MIT License](./LICENSE).
84
+
85
+ ## Code of Conduct
86
+
87
+ This project uses the [Contributor Code of Conduct](.github/CODE_OF_CONDUCT.md). We ask everyone to please adhere by its guidelines.
data/bin/meetup_orbit ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+
4
+ check_rsvps = false
5
+
6
+ options = {}
7
+ choices = OptionParser.new do |opts|
8
+ opts.banner = "Usage: meetup_orbit --check-rsvps"
9
+ opts.on("-h", "--help", "Prints help instructions") do
10
+ puts opts
11
+ exit
12
+ end
13
+ opts.on("--check-rsvps", "Check for new Meetup event RSVPs") do
14
+ check_notes = true
15
+ end
16
+ end.parse!
17
+
18
+ $LOAD_PATH.unshift(File.expand_path('../lib/meetup_orbit', __dir__))
19
+
20
+ require_relative '../lib/meetup_orbit'
21
+ require_relative '../scripts/check_rsvps'
22
+
23
+ if check_rsvps
24
+ puts "Checking for new Meetup event RSVPs and posting them to your Orbit workspace..."
25
+ ARGV[0] = 'render'
26
+ MeetupOrbit::Scripts::CheckRsvps.start(ARGV)
27
+ end
data/docs/setup.md ADDED
@@ -0,0 +1,11 @@
1
+ <small><a href="../README.md">Back to README</a></small>
2
+
3
+ # First Time Setup
4
+
5
+ <!-- This is a summary section. Explain what we need to do at a high-level. For example... -->
6
+
7
+ During the setup, we will need to create a new application on Stack Apps which will allow this integration to interact with the platform. The application will contain a Key which we should take note of for later.
8
+
9
+ 1. Head to [Stack Apps](https://stackapps.com) and login in to your account.
10
+ 2. [Register a new Stack Apps application](https://stackapps.com/apps/oauth/register). The oauth domain can be anything, as can the application website.
11
+ 3. In your application settings, take note of your `Key` value.
Binary file
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "zeitwerk"
4
+ require "orbit_activities"
5
+ require_relative "meetup_orbit/version"
6
+
7
+ module MeetupOrbit
8
+ loader = Zeitwerk::Loader.new
9
+ loader.tag = File.basename(__FILE__, ".rb")
10
+ loader.push_dir(__dir__)
11
+ loader.setup
12
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dotenv/load"
4
+ require "net/http"
5
+ require "json"
6
+
7
+ # Create a client to log Meetup activities in your Orbit workspace
8
+ # Credentials can either be passed in to the instance or be loaded
9
+ # from environment variables
10
+ #
11
+ # @example
12
+ # client = MeetupOrbit::Client.new
13
+ #
14
+ # @option params [String] :orbit_api_key
15
+ # The API key for the Orbit API
16
+ #
17
+ # @option params [String] :orbit_workspace
18
+ # The workspace ID for the Orbit workspace
19
+ #
20
+ # @option params [String] :meetup_urlname
21
+ # The URL identifier of your Meetup
22
+ #
23
+ # @param [Hash] params
24
+ #
25
+ # @return [MeetupOrbit::Client]
26
+ #
27
+ module MeetupOrbit
28
+ class Client
29
+ attr_accessor :orbit_api_key, :orbit_workspace, :meetup_urlname
30
+
31
+ def initialize(params = {})
32
+ @orbit_api_key = params.fetch(:orbit_api_key, ENV["ORBIT_API_KEY"])
33
+ @orbit_workspace = params.fetch(:orbit_workspace, ENV["ORBIT_WORKSPACE_ID"])
34
+ @meetup_urlname = params.fetch(:meetup_urlname, ENV["MEETUP_URLNAME"])
35
+ end
36
+
37
+ def event_rsvps
38
+ MeetupOrbit::Meetup.new(
39
+ meetup_urlname: @meetup_urlname,
40
+ orbit_api_key: @orbit_api_key,
41
+ orbit_workspace: @orbit_workspace
42
+ ).process_event_rsvps
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module MeetupOrbit
6
+ module Interactions::Events
7
+ class Rsvp
8
+ def initialize(rsvp:, orbit_workspace:, orbit_api_key:)
9
+ @rsvp = rsvp
10
+ @orbit_workspace = orbit_workspace
11
+ @orbit_api_key = orbit_api_key
12
+
13
+ after_initialize!
14
+ end
15
+
16
+ def after_initialize!
17
+ OrbitActivities::Request.new(
18
+ api_key: @orbit_api_key,
19
+ workspace_id: @orbit_workspace,
20
+ user_agent: "community-ruby-meetup-orbit/#{MeetupOrbit::VERSION}",
21
+ action: "new_activity",
22
+ body: construct_body.to_json
23
+ )
24
+ end
25
+
26
+ def construct_body
27
+ hash = {
28
+ activity: {
29
+ activity_type: "meetup:rsvp",
30
+ tags: ["channel:meetup"],
31
+ title: "New RSVP for #{@rsvp[:event]}",
32
+ description: construct_description,
33
+ occurred_at: @rsvp[:occurred_at],
34
+ key: @rsvp[:id],
35
+ link: @rsvp[:link],
36
+ member: {
37
+ name: @rsvp[:member_name]
38
+ }
39
+ },
40
+ identity: {
41
+ source: "meetup",
42
+ name: @rsvp[:member_name],
43
+ uid: @rsvp[:member_id]
44
+ }
45
+ }
46
+ end
47
+
48
+ def construct_description
49
+ <<~HEREDOC
50
+ #{@rsvp[:member_name]} has registered for #{@rsvp[:event]} in the #{@rsvp[:group]} Meetup group
51
+ HEREDOC
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MeetupOrbit
4
+ class Meetup
5
+ def initialize(params = {})
6
+ @meetup_urlname = params.fetch(:meetup_urlname)
7
+ @orbit_api_key = params.fetch(:orbit_api_key)
8
+ @orbit_workspace = params.fetch(:orbit_workspace)
9
+ end
10
+
11
+ def process_event_rsvps
12
+ events = get_events
13
+
14
+ events.each do |event|
15
+ next if event["yes_rsvp_count"] <= 1 || event["yes_rsvp_count"].nil?
16
+
17
+ rsvps = get_rsvps(event["id"])
18
+
19
+ rsvps.drop(1).each do |rsvp| # skip first item which is event owner
20
+ MeetupOrbit::Orbit.call(
21
+ type: "event_rsvp",
22
+ data: {
23
+ rsvp: {
24
+ event: rsvp["event"]["name"],
25
+ group: rsvp["group"]["name"],
26
+ member_id: rsvp["member"]["id"],
27
+ member_name: rsvp["member"]["name"],
28
+ occurred_at: Time.at(rsvp["created"] / 1000).utc,
29
+ id: "#{rsvp["member"]["id"]}-#{rsvp["event"]["id"]}",
30
+ link: "https://meetup.com/#{@meetup_urlname}/events/#{rsvp["event"]["id"]}",
31
+ response: rsvp["response"]
32
+ }
33
+ },
34
+ orbit_api_key: @orbit_api_key,
35
+ orbit_workspace: @orbit_workspace
36
+ )
37
+ end
38
+ end
39
+ end
40
+
41
+ def get_events
42
+ url = URI("https://api.meetup.com/#{@meetup_urlname}/events")
43
+
44
+ https = Net::HTTP.new(url.host, url.port)
45
+ https.use_ssl = true
46
+
47
+ request = Net::HTTP::Get.new(url)
48
+
49
+ response = https.request(request)
50
+
51
+ response = JSON.parse(response.body)
52
+ end
53
+
54
+ def get_rsvps(event)
55
+ url = URI("https://api.meetup.com/#{@meetup_urlname}/events/#{event}/rsvps")
56
+
57
+ https = Net::HTTP.new(url.host, url.port)
58
+ https.use_ssl = true
59
+
60
+ request = Net::HTTP::Get.new(url)
61
+
62
+ response = https.request(request)
63
+
64
+ response = JSON.parse(response.body)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module MeetupOrbit
4
+ class Orbit
5
+ def self.call(type:, data:, orbit_workspace:, orbit_api_key:)
6
+ if type == "event_rsvp"
7
+ MeetupOrbit::Interactions::Events::Rsvp.new(
8
+ rsvp: data[:rsvp],
9
+ orbit_workspace: orbit_workspace,
10
+ orbit_api_key: orbit_api_key
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal = true
2
+
3
+ module MeetupOrbit
4
+ VERSION = "0.0.1"
5
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/meetup_orbit/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "meetup_orbit"
7
+ spec.version = MeetupOrbit::VERSION
8
+ spec.authors = ["Orbit DevRel", "Ben Greenberg"]
9
+ spec.email = ["devrel@orbit.love"]
10
+
11
+ spec.summary = "Integrate Meetup interactions into Orbit"
12
+ spec.description = "This gem brings in Meetup activities to your Orbit workspace"
13
+ spec.homepage = "https://github.com/orbit-love/community-ruby-meetup-orbit"
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/community-ruby-meetup-orbit/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 "activesupport", "~> 6.1"
30
+ spec.add_dependency "http", "~> 4.4"
31
+ spec.add_dependency "json", "~> 2.5"
32
+ spec.add_dependency "zeitwerk", "~> 2.4"
33
+ spec.add_dependency "thor", "~> 1.1"
34
+ spec.add_dependency "dotenv", "~> 2.7"
35
+ spec.add_dependency "orbit_activities", "~> 0.1"
36
+ spec.add_development_dependency "rspec", "~> 3.4"
37
+ spec.add_development_dependency "webmock", "~> 3.12"
38
+ end
Binary file
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "meetup_orbit"
5
+ require "thor"
6
+
7
+ module MeetupOrbit
8
+ module Scripts
9
+ class CheckRsvps < Thor
10
+ desc "render", "check for new Meetup event RSVPs and push them to Orbit"
11
+ def render
12
+ client = MeetupOrbit::Client.new
13
+ client.event_rsvps
14
+ end
15
+ end
16
+ end
17
+ end
metadata ADDED
@@ -0,0 +1,195 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: meetup_orbit
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-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '6.1'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '6.1'
28
+ - !ruby/object:Gem::Dependency
29
+ name: http
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '4.4'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '4.4'
42
+ - !ruby/object:Gem::Dependency
43
+ name: json
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '2.5'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '2.5'
56
+ - !ruby/object:Gem::Dependency
57
+ name: zeitwerk
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.4'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '2.4'
70
+ - !ruby/object:Gem::Dependency
71
+ name: thor
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.1'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.1'
84
+ - !ruby/object:Gem::Dependency
85
+ name: dotenv
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '2.7'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '2.7'
98
+ - !ruby/object:Gem::Dependency
99
+ name: orbit_activities
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '0.1'
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.1'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rspec
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '3.4'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '3.4'
126
+ - !ruby/object:Gem::Dependency
127
+ name: webmock
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '3.12'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '3.12'
140
+ description: This gem brings in Meetup activities to your Orbit workspace
141
+ email:
142
+ - devrel@orbit.love
143
+ executables:
144
+ - meetup_orbit
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - ".env.sample"
149
+ - ".github/CODE_OF_CONDUCT.md"
150
+ - ".github/CONTRIBUTING.md"
151
+ - ".github/workflows/CI.yml"
152
+ - ".gitignore"
153
+ - Gemfile
154
+ - Gemfile.lock
155
+ - LICENSE
156
+ - README.md
157
+ - bin/meetup_orbit
158
+ - docs/setup.md
159
+ - docs/ways-to-use.png
160
+ - lib/meetup_orbit.rb
161
+ - lib/meetup_orbit/client.rb
162
+ - lib/meetup_orbit/interactions/events/rsvp.rb
163
+ - lib/meetup_orbit/meetup.rb
164
+ - lib/meetup_orbit/orbit.rb
165
+ - lib/meetup_orbit/version.rb
166
+ - meetup_orbit.gemspec
167
+ - readme-images/ways-to-use.png
168
+ - scripts/check_rsvps.rb
169
+ homepage: https://github.com/orbit-love/community-ruby-meetup-orbit
170
+ licenses:
171
+ - MIT
172
+ metadata:
173
+ homepage_uri: https://github.com/orbit-love/community-ruby-meetup-orbit
174
+ source_code_uri: https://github.com/orbit-love/community-ruby-meetup-orbit
175
+ changelog_uri: https://github.com/orbit-love/community-ruby-meetup-orbit/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.7.2
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.15
192
+ signing_key:
193
+ specification_version: 4
194
+ summary: Integrate Meetup interactions into Orbit
195
+ test_files: []