linkedin_orbit 0.0.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea542477b38b242198309bfab98334aa41f4cb7c2e99998c38830e53bad0780d
4
- data.tar.gz: aa504baf8b553d0540ad0f813e74fff47166aa08d208838e53a5dedba7234764
3
+ metadata.gz: b6f4f66d8e02d0462adeb017a15fc6117c8adbec5754410dda29693920e8a3c5
4
+ data.tar.gz: d810c834be558471325109f67d73aed9be83b6bc935e060b724238d1ff4acac7
5
5
  SHA512:
6
- metadata.gz: 8495d7435f85b66d68e2016fdf243afe45edf432d048d503c41ef2d7a179ce336f9915c0863ef1ced1b7847376ca62e8abd871b1f6c39f739c36cc8eaf325c7e
7
- data.tar.gz: e99b0a4d2e1b52067306151671108b50819d7bd3f27aa70ad6867c1a3760d1f97c3f1dc9a01122b2f5a4981ac861213ca1305d0cf44b73c49f3a84a60dfd39a0
6
+ metadata.gz: a02b3848153540d2d31cf41aca5c220b03e9381ec4b411ac6e218c7163a28d8dc7b563f2b6f3b6806ea147004de4dcff7b444c13433382fe03bef25f13c7f005
7
+ data.tar.gz: d65539d673f67bb64c03229967c9345fd8a777062555bbe87688da18d10e6550de900843d3e6d9b0d81152a8227b98fd5a33af0ddd640fe6da2ea59bed12c57b
data/.env.sample CHANGED
@@ -1,5 +1,4 @@
1
1
  LINKEDIN_ORGANIZATION=
2
- LINKEDIN_CODE=
3
2
  LINKEDIN_TOKEN=
4
3
  ORBIT_API_KEY=
5
4
  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/Gemfile CHANGED
@@ -2,16 +2,12 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "byebug"
6
-
7
- gem "dotenv", "~> 2.7.6"
8
-
9
- gem "http", "~> 4.4"
10
-
11
- gem "json", "~> 2.5"
5
+ gemspec
12
6
 
13
7
  gem "rake", "~> 13.0"
14
8
 
15
9
  gem "rubocop", "~> 1.7"
16
10
 
17
- gem "linkedin", "~> 1.1"
11
+ gem "orbit_activities"
12
+
13
+ gem "byebug"
data/Gemfile.lock CHANGED
@@ -1,3 +1,15 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ linkedin_orbit (0.1.2)
5
+ dotenv (~> 2.7)
6
+ http (~> 4.4)
7
+ json (~> 2.5)
8
+ linkedin (~> 1.1)
9
+ orbit_activities (~> 0.1)
10
+ thor (~> 1.1)
11
+ zeitwerk (~> 2.4)
12
+
1
13
  GEM
2
14
  remote: https://rubygems.org/
3
15
  specs:
@@ -5,22 +17,30 @@ GEM
5
17
  public_suffix (>= 2.0.2, < 5.0)
6
18
  ast (2.4.2)
7
19
  byebug (11.1.3)
20
+ crack (0.4.5)
21
+ rexml
22
+ diff-lcs (1.4.4)
8
23
  domain_name (0.5.20190701)
9
24
  unf (>= 0.0.5, < 1.0.0)
10
25
  dotenv (2.7.6)
11
- faraday (1.4.1)
26
+ faraday (1.4.2)
27
+ faraday-em_http (~> 1.0)
28
+ faraday-em_synchrony (~> 1.0)
12
29
  faraday-excon (~> 1.1)
13
30
  faraday-net_http (~> 1.0)
14
31
  faraday-net_http_persistent (~> 1.1)
15
32
  multipart-post (>= 1.2, < 3)
16
33
  ruby2_keywords (>= 0.0.4)
34
+ faraday-em_http (1.0.0)
35
+ faraday-em_synchrony (1.0.0)
17
36
  faraday-excon (1.1.0)
18
37
  faraday-net_http (1.0.1)
19
38
  faraday-net_http_persistent (1.1.0)
20
- ffi (1.15.0)
39
+ ffi (1.15.1)
21
40
  ffi-compiler (1.0.1)
22
41
  ffi (>= 1.0.0)
23
42
  rake
43
+ hashdiff (1.0.1)
24
44
  hashie (3.6.0)
25
45
  http (4.4.1)
26
46
  addressable (~> 2.3)
@@ -47,6 +67,11 @@ GEM
47
67
  multi_json (~> 1.3)
48
68
  multi_xml (~> 0.5)
49
69
  rack (>= 1.2, < 3)
70
+ orbit_activities (0.1.0)
71
+ http (~> 4.4)
72
+ json (~> 2.5)
73
+ rake (~> 13.0)
74
+ zeitwerk (~> 2.4)
50
75
  parallel (1.20.1)
51
76
  parser (3.0.1.1)
52
77
  ast (~> 2.4.1)
@@ -56,6 +81,19 @@ GEM
56
81
  rake (13.0.3)
57
82
  regexp_parser (2.1.1)
58
83
  rexml (3.2.5)
84
+ rspec (3.10.0)
85
+ rspec-core (~> 3.10.0)
86
+ rspec-expectations (~> 3.10.0)
87
+ rspec-mocks (~> 3.10.0)
88
+ rspec-core (3.10.1)
89
+ rspec-support (~> 3.10.0)
90
+ rspec-expectations (3.10.1)
91
+ diff-lcs (>= 1.2.0, < 2.0)
92
+ rspec-support (~> 3.10.0)
93
+ rspec-mocks (3.10.2)
94
+ diff-lcs (>= 1.2.0, < 2.0)
95
+ rspec-support (~> 3.10.0)
96
+ rspec-support (3.10.2)
59
97
  rubocop (1.14.0)
60
98
  parallel (~> 1.10)
61
99
  parser (>= 3.0.0.0)
@@ -69,10 +107,16 @@ GEM
69
107
  parser (>= 3.0.1.1)
70
108
  ruby-progressbar (1.11.0)
71
109
  ruby2_keywords (0.0.4)
110
+ thor (1.1.0)
72
111
  unf (0.1.4)
73
112
  unf_ext
74
113
  unf_ext (0.0.7.7)
75
114
  unicode-display_width (2.0.0)
115
+ webmock (3.12.0)
116
+ addressable (>= 2.3.6)
117
+ crack (>= 0.3.2)
118
+ hashdiff (>= 0.4.0, < 2.0.0)
119
+ zeitwerk (2.4.2)
76
120
 
77
121
  PLATFORMS
78
122
  arm64-darwin-20
@@ -80,12 +124,12 @@ PLATFORMS
80
124
 
81
125
  DEPENDENCIES
82
126
  byebug
83
- dotenv (~> 2.7.6)
84
- http (~> 4.4)
85
- json (~> 2.5)
86
- linkedin (~> 1.1)
127
+ linkedin_orbit!
128
+ orbit_activities
87
129
  rake (~> 13.0)
130
+ rspec (~> 3.4)
88
131
  rubocop (~> 1.7)
132
+ webmock (~> 3.12)
89
133
 
90
134
  BUNDLED WITH
91
135
  2.2.16
data/README.md CHANGED
@@ -9,13 +9,23 @@ This is a Ruby app that can be used to integrate LinkedIn post comments into you
9
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
10
  |-----------------------------------------|
11
11
 
12
- <hr />
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
+ ## First Time Setup
13
14
 
14
- ## Installation
15
+ To set up this integration you will need to follow some steps required by LinkedIn. Please follow the [First Time Setup guide](docs/FIRST_TIME_INSTRUCTIONS.md) for step-by-step instructions.
15
16
 
16
- | **Are you setting up this integration for the first time? Please read the [first time setup](https://github.com/orbit-love/community-ruby-linkedin-orbit/blob/main/FIRST_TIME_INSTRUCTIONS.md) guide before proceeding. LinkedIn requires a very specific authentication procedure, and it is required, to successfully use this integration.**
17
+ ## Application Credentials
17
18
 
18
- ### As a Standalone App
19
+ The application requires the following environment variables:
20
+
21
+ | Variable | Description | More Info
22
+ |---|---|--|
23
+ | `LINKEDIN_TOKEN` | LinkedIn Token | Follow the [First Time Setup guide](docs/FIRST_TIME_INSTRUCTIONS.md) to obtain the token
24
+ | `LINKEDIN_ORGANIZATION` | LinkedIn Organization Page ID | Format: `urn:li:organization:#{id}`. ID is the set of numbers in LinkedIn page URL, i.e. `https://www.linkedin.com/company/28866695`, the ID is `28866695`.
25
+ | `ORBIT_API_KEY` | API key for Orbit | Found in `Account Settings` in your Orbit workspace
26
+ | `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`
27
+
28
+ ## Package Usage
19
29
 
20
30
  To install this integration in a standalone app, add the gem to your `Gemfile`:
21
31
 
@@ -25,25 +35,52 @@ gem "linkedin_orbit"
25
35
 
26
36
  Then, run `bundle install` from your terminal.
27
37
 
28
- ### With GitHub Actions
38
+ You can instantiate a client by either passing in the required credentials during instantiation or by providing them in your `.env` file.
39
+
40
+ ### Instantiation with credentials:
41
+
42
+ ```ruby
43
+ client = LinkedinOrbit::Client.new(
44
+ orbit_api_key: YOUR_API_KEY,
45
+ orbit_workspace_id: YOUR_ORBIT_WORKSPACE_ID,
46
+ linkedin_token: YOUR_LINKEDIN_TOKEN,
47
+ linkedin_organization: YOUR_LINKEDIN_ORGANIZATION_ID
48
+ )
49
+ ```
29
50
 
30
- This integration can be run as a daily scheduled activity within GitHub Actions! To install this integration with your GitHub account, follow the instructions in the [Orbit GitHub Actions Guide](https://github.com/orbit-love/github-actions-templates).
31
- ## Usage
51
+ ### Instantiation with credentials in dotenv file:
32
52
 
33
- ### CLI
53
+ ```ruby
54
+ client = LinkedinOrbit::Client.new
55
+ ```
34
56
 
35
- ### Standalone Client
57
+ ### Fetching LinkedIn Comments
58
+
59
+ Once, you have an instantiated client, you can fetch LinkedIn comments on your organization's posts and send them to Orbit by invoking the `#comments` instance method:
60
+
61
+ ```ruby
62
+ client.comments
63
+ ```
64
+ ## CLI Usage
65
+
66
+ 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:
67
+
68
+ ```bash
69
+ $ ORBIT_API_KEY=... ORBIT_WORKSPACE_ID=... LINKEDIN_TOKEN=... LINKEDIN_ORGANIZATION=... bundle exec linkedin_orbit --check_comments
70
+ ```
71
+ ## GitHub Actions Automation Setup
36
72
 
37
- ### GitHub Actions
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.
38
74
 
75
+ [See our guide for setting up this automation](https://github.com/orbit-love/github-actions-templates/blob/main/LinkedIn/README.md).
39
76
  ## Contributing
40
77
 
41
- Bug reports and pull requests are welcome on GitHub at https://github.com/orbit-love/community-ruby-linkedin-orbit. 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/orbit-love/community-ruby-linkedin-orbit/blob/main/CODE_OF_CONDUCT.md).
78
+ We 💜 contributions from everyone! Check out the [Contributing Guidelines](.github/CONTRIBUTING.md) for more information.
42
79
 
43
80
  ## License
44
81
 
45
- This is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
82
+ This is available as open source under the terms of the [MIT License](LICENSE).
46
83
 
47
84
  ## Code of Conduct
48
85
 
49
- Everyone interacting in the project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/orbit-live/community-ruby-linkedin-orbit/blob/main/CODE_OF_CONDUCT.md).
86
+ This project uses the [Contributor Code of Conduct](.github/CODE_OF_CONDUCT.md). We ask everyone to please adhere by its guidelines.
@@ -1,6 +1,6 @@
1
1
  # Instructions for First Time Set Up
2
2
 
3
- These instructions will walk you through authenticating to LinkedIn, and receiving your LinkedIn code, which is needed to use this integration. You will only need to do this one time.
3
+ These instructions will walk you through authenticating to LinkedIn, and receiving your LinkedIn token, which is needed to use this integration. You will only need to do this once every two months.
4
4
 
5
5
  ## Creating a LinkedIn Developers App
6
6
 
@@ -8,7 +8,7 @@ The first thing you must do is create a LinkedIn Developers app.
8
8
 
9
9
  Navigate to the [LinkedIn Developers](https://www.linkedin.com/developers/) website and click the "Create App" button.
10
10
 
11
- ![Create LinkedIn App Button](readme_images/create_app_button.png)
11
+ ![Create LinkedIn App Button](../readme_images/create_app_button.png)
12
12
 
13
13
  This will direct you to a short form where LinkedIn will ask you for a few pieces of information:
14
14
 
@@ -27,17 +27,17 @@ LinkedIn has many different types of APIs and many different types of access lev
27
27
 
28
28
  From within your LinkedIn Developers dashboard, navigate to the "Products" page and submit the access request form.
29
29
 
30
- ![Marketing Developer Platform Request](readme_images/marketing_platform_request_access.png)
30
+ ![Marketing Developer Platform Request](../readme_images/marketing_platform_request_access.png)
31
31
 
32
32
  This will take another few days for LinkedIn to verify and confirm this request. Once it is done, you will see the Marketing Developer Platform in your list of "Added Products" like shown in the next screenshot.
33
33
 
34
- ![LinkedIn Developer Products List](readme_images/products_list.png)
34
+ ![LinkedIn Developer Products List](../readme_images/products_list.png)
35
35
 
36
36
  ## LinkedIn API Credentials
37
37
 
38
38
  You will need your LinkedIn API credentials to move forward. You can copy your LinkedIn credentials, which are your Client ID and Client Secret from the "Auth" section in the LinkedIn Developers dashboard.
39
39
 
40
- ![LinkedIn Client Credentials](readme_images/client_credentials.png)
40
+ ![LinkedIn Client Credentials](../readme_images/client_credentials.png)
41
41
 
42
42
  Make sure to save those somewhere safe and where you can access them as we will need them again shortly.
43
43
 
@@ -45,9 +45,9 @@ You will also see on the "Auth" page a section called "OAuth 2.0 Settings". We w
45
45
 
46
46
  After you have finished all of the above steps, you are ready to move on to the last step in this first time setup instructions.
47
47
 
48
- ## LinkedIn Browser Code
48
+ ## LinkedIn Token
49
49
 
50
- LinkedIn uses OAuth 2.0 as its authentication format, and as such, you need to authenticate *one-time* with your browser to obtain a code that will be used for the integration from then on.
50
+ LinkedIn uses OAuth 2.0 as its authentication format, and as such, you need to authenticate *one time every two months* to obtain a token that will be used for the integration from then on.
51
51
 
52
52
  The `linkedin_orbit` integration includes an authentication application to facilitate this process for you. It requires that you have a [Heroku](https://www.heroku.com/) account. It is free to set up a Heroku account, and the one-time authentication app, is fine to run inside the free tier of the platform.
53
53
 
@@ -59,34 +59,36 @@ You will need to supply your LinkedIn Client ID and LinkedIn Client Secret as pa
59
59
 
60
60
  Once the app has been deployed on Heroku, click on the "View" button as shown below.
61
61
 
62
- ![Heroku View Button](readme_images/heroku_view_app_button.png)
62
+ ![Heroku View Button](../readme_images/heroku_view_app_button.png)
63
63
 
64
64
  This will load a new browser window with the app rendered.
65
65
 
66
66
  Copy the URL of the Heroku app in your browser address bar and return to the LinkedIn Developers dashboard. In the LinkedIn Developers dashboard click on "Auth" from the navigation menu" and then click on the pencil icon in the "Authorized redirect URLs for your app" section of the page, as shown below.
67
67
 
68
- ![LinkedIn OAuth Redirect URLS](readme_images/linkedin_oauth_redirects.png)
68
+ ![LinkedIn OAuth Redirect URLS](../readme_images/linkedin_oauth_redirects.png)
69
69
 
70
70
  You will see a link appear called "+ Add redirect URL". Click on that link. In the text box that appears above it enter your Heroku app URL with "/auth/linkedin/callback" appended at the end. For example, if your Heroku URL was "https://example-heroku-app-url.herokuapp.com" then the full address you need to enter would be: "https://example-heroku-app-url.herokuapp.com/auth/linkedin/callback". When you are finished, click on the "Update" button.
71
71
 
72
- Now, return back to your browser window with your Heroku app running. Click on the "LinkedIn" link on the app. Follow the prompts by LinkedIn to authorize your LinkedIn Developer application. When you are finished, you will be redirected back to your Heroku app and you will see a LinkedIn code. This code is very important. The code you see will be the credential used to authenticate to LinkedIn for the duration of your use of the LinkedIn Orbit community integration.
72
+ Now, return back to your browser window with your Heroku app running. Click on the "LinkedIn" link on the app. Follow the prompts by LinkedIn to authorize your LinkedIn Developer application. When you are finished, you will be redirected back to your Heroku app and you will see a LinkedIn token. This token is very important. The token you see will be the credential used to authenticate to LinkedIn.
73
73
 
74
- The last step you need to complete in this first time setup is to add the LinkedIn code you created into the LinkedIn Orbit community integration credentials, either in the context of a standalone app or in the context of running it as a GitHub Action.
74
+ The last step you need to complete in this first time setup is to add the LinkedIn token you created into the LinkedIn Orbit community integration credentials, either in the context of a standalone app or in the context of running it as a GitHub Action.
75
75
 
76
- ## Add the LinkedIn Code to the LinkedIn Orbit Community Integration
76
+ ## Add the LinkedIn Token to the LinkedIn Orbit Community Integration
77
77
  ### Within GitHub Actions
78
78
 
79
79
  *(This step assumes you have a GitHub repository created already to run the LinkedIn Orbit community integration. If you do not, please follow [this guide](https://docs.github.com/en/github/getting-started-with-github/create-a-repo) first.)*
80
80
 
81
- The LinkedIn code you created in the last step needs to be added to the GitHub repository that you are running the LinkedIn Orbit community integration from. To do so, follow the step-by-step guide in the [README](https://github.com/orbit-love/github-actions-templates/blob/main/README.md#adding-your-credentials-to-github) in the GitHub Actions instructions. The name for this secret **must** be: `LINKEDIN_CODE`.
81
+ The LinkedIn token you created in the last step needs to be added to the GitHub repository that you are running the LinkedIn Orbit community integration from. To do so, follow the step-by-step guide in the [README](https://github.com/orbit-love/github-actions-templates/blob/main/README.md#adding-your-credentials-to-github) in the GitHub Actions instructions. The name for this secret **must** be: `LINKEDIN_TOKEN`.
82
82
 
83
83
  ### Within a Standalone App
84
84
 
85
- If you are running the community integration as a standalone app, you can add the LinkedIn code as an environment variable inside the `.env` file in the root directory of the codebase.
85
+ If you are running the community integration as a standalone app, you can add the LinkedIn token as an environment variable inside the `.env` file in the root directory of the codebase.
86
86
 
87
- Open up the `.env` file and add a new line starting with `LINKEDIN_CODE=` and add the LinkedIn Code after the equal sign.
87
+ Open up the `.env` file and add a new line starting with `LINKEDIN_TOKEN=` and add the LinkedIn Code after the equal sign.
88
88
  ## Wrapping Up
89
89
 
90
- You have now successfully finished the first time setup for your LinkedIn Orbit community integration. This is a one-time process, and you can safely delete the Heroku authentication app you deployed.
90
+ You have now successfully finished the setup for your LinkedIn Orbit community integration. This steps needs to occur once every 60 days.
91
+
92
+ In between, you can safely delete the Heroku app you created and recreate a new one when you need to do this again.
91
93
 
92
94
  From within the Heroku dashboard, navigate to the "Settings" for the app and at the very bottom of the page is a button called "Delete app". Once you click on that button, Heroku will confirm you wish to delete the app. Upon confirmation, the app will be deleted and the deployment on the web will be removed.
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "zeitwerk"
4
+ require "orbit_activities"
5
+ require_relative "linkedin_orbit/version"
4
6
 
5
7
  module LinkedinOrbit
6
8
  loader = Zeitwerk::Loader.new
@@ -2,6 +2,8 @@
2
2
 
3
3
  require "linkedin"
4
4
  require "dotenv/load"
5
+ require "net/http"
6
+ require "json"
5
7
 
6
8
  # Create a client to log LinkedIn interactions in your Orbit workspace
7
9
  # Credentials can either be passed in to the instance or be loaded
@@ -16,13 +18,9 @@ require "dotenv/load"
16
18
  # @option params [String] :orbit_workspace
17
19
  # The workspace ID for the Orbit workspace
18
20
  #
19
- # @option params [String] :linkedin_client_id
20
- # The Client ID for your LinkedIn Developers Access
21
- # More details on obtaining it at https://www.linkedin.com/developers/
22
- #
23
- # @option params [String] :linkedin_client_secret
24
- # The Client Secret for your LinkedIn Developers Access
25
- # More details on obtaining it at https://www.linkedin.com/developers/
21
+ # @option params [String] :linkedin_token
22
+ # The token obtained after authenticating with LinkedIn
23
+ # Required if value not provided for LINKEDIN_TOKEN environment variable
26
24
  #
27
25
  # @option params [String] :linkedin_organization
28
26
  # The LinkedIn schema for the LinkedIn organization to log interactions from
@@ -48,12 +46,7 @@ module LinkedinOrbit
48
46
  end
49
47
 
50
48
  def token
51
- @token ||= begin
52
- return ENV["LINKEDIN_TOKEN"] if ENV["LINKEDIN_TOKEN"]
53
-
54
- linkedin = LinkedIn::Client.new(@linkedin_client_id, @linkedin_client_secret)
55
- linkedin.authorize_from_access(ENV["LINKEDIN_CODE"])
56
- end
49
+ @token ||= ENV["LINKEDIN_TOKEN"]
57
50
  end
58
51
 
59
52
  def comments
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "net/http"
4
3
  require "json"
5
4
 
6
5
  module LinkedinOrbit
@@ -16,31 +15,25 @@ module LinkedinOrbit
16
15
  end
17
16
 
18
17
  def after_initialize!
19
- url = URI("https://app.orbit.love/api/v1/#{@orbit_workspace}/activities")
20
-
21
- http = Net::HTTP.new(url.host, url.port)
22
- http.use_ssl = true
23
-
24
- request = Net::HTTP::Post.new(url)
25
- request["Accept"] = "application/json"
26
- request["Content-Type"] = "application/json"
27
- request["Authorization"] = "Bearer #{@orbit_api_key}"
28
-
29
- request.body = construct_body.to_json
30
-
31
- response = http.request(request)
32
-
33
- JSON.parse(response.body)
18
+ OrbitActivities::Request.new(
19
+ api_key: @orbit_api_key,
20
+ workspace_id: @orbit_workspace,
21
+ user_agent: "community-ruby-linkedin-orbit/#{LinkedinOrbit::VERSION}",
22
+ action: "new_activity",
23
+ body: construct_body.to_json
24
+ )
34
25
  end
35
26
 
36
27
  def construct_body
37
28
  {
38
29
  activity: {
39
30
  activity_type: "linkedin:comment",
31
+ tags: ["channel:linkedin"],
40
32
  title: "Commented on LinkedIn Post",
41
33
  description: construct_description,
42
- occurred_at: Time.at(@comment["created"]["time"] / 1000),
34
+ occurred_at: Time.at(@comment["created"]["time"] / 1000).utc,
43
35
  key: @comment["id"],
36
+ link: "https://www.linkedin.com/feed/update/#{@comment["object"]}",
44
37
  member: {
45
38
  name: name
46
39
  }
@@ -47,7 +47,7 @@ module LinkedinOrbit
47
47
  response = https.request(request)
48
48
 
49
49
  response = JSON.parse(response.body)
50
-
50
+
51
51
  response["elements"].each do |element|
52
52
  posts << {
53
53
  "id" => element["activity"],
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LinkedinOrbit
4
- VERSION = "0.0.1"
4
+ VERSION = "0.1.3"
5
5
  end
@@ -31,6 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "zeitwerk", "~> 2.4"
32
32
  spec.add_dependency "thor", "~> 1.1"
33
33
  spec.add_dependency "linkedin", "~> 1.1"
34
+ spec.add_dependency "dotenv", "~> 2.7"
35
+ spec.add_dependency "orbit_activities", "~> 0.1"
34
36
  spec.add_development_dependency "rspec", "~> 3.4"
35
37
  spec.add_development_dependency "webmock", "~> 3.12"
36
38
  end
Binary file
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "dev_orbit"
4
+ require "linkedin_orbit"
5
5
  require "thor"
6
6
 
7
7
  module LinkedinOrbit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkedin_orbit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orbit DevRel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-05-07 00:00:00.000000000 Z
12
+ date: 2021-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http
@@ -81,6 +81,34 @@ dependencies:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
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'
84
112
  - !ruby/object:Gem::Dependency
85
113
  name: rspec
86
114
  requirement: !ruby/object:Gem::Requirement
@@ -118,15 +146,17 @@ extensions: []
118
146
  extra_rdoc_files: []
119
147
  files:
120
148
  - ".env.sample"
149
+ - ".github/CODE_OF_CONDUCT.md"
150
+ - ".github/CONTRIBUTING.md"
151
+ - ".github/workflows/CI.yml"
121
152
  - ".gitignore"
122
153
  - ".rubocop.yml"
123
- - CODE_OF_CONDUCT.md
124
- - FIRST_TIME_INSTRUCTIONS.md
125
154
  - Gemfile
126
155
  - Gemfile.lock
127
156
  - LICENSE
128
157
  - README.md
129
158
  - bin/linkedin_orbit
159
+ - docs/FIRST_TIME_INSTRUCTIONS.md
130
160
  - lib/linkedin_orbit.rb
131
161
  - lib/linkedin_orbit/client.rb
132
162
  - lib/linkedin_orbit/interactions/comment.rb
@@ -142,6 +172,7 @@ files:
142
172
  - readme_images/logo.png
143
173
  - readme_images/marketing_platform_request_access.png
144
174
  - readme_images/products_list.png
175
+ - readme_images/ways-to-use.png
145
176
  - scripts/check_comments.rb
146
177
  homepage: https://github.com/orbit-love/community-ruby-linkedin-orbit
147
178
  licenses:
data/CODE_OF_CONDUCT.md DELETED
@@ -1,84 +0,0 @@
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 bengreenberg@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.