omniauth-teamwork 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c794bffd4ee256ed8ef34e6ec5871c600306d8ca137a22411591228ae5667d5b
4
- data.tar.gz: ace126d606b9aa0ab738376b9a58b5fe0ce1a61cb03ce263f16bab7f4cfd6fac
3
+ metadata.gz: 0d65ad4001846e7a7511b9f9ff27f68b7a67d9a17917ef9458b31b62c940f8ee
4
+ data.tar.gz: '095d9bdb5c95adb6f566ebe2af53246723a6a447635343a002d1779cd7efe305'
5
5
  SHA512:
6
- metadata.gz: 8e0ee15cee3947e00ff4e211134ef2c11d8ebbc235926bffbaeb8c86b1070d300fc9f9b4cd4b29179250475b7e8a251d70f23ed3343825a3d34f4f7065019e6d
7
- data.tar.gz: 193495e99ed2e2dcf4b18c4d5c3ffcb599f74e9e857d0b806409322b1195b7cb2a3631f4913a749fa20fc0f3ae993a9e49753d746e1c8270b5d657ab12ed23e0
6
+ metadata.gz: 9ad926b6fe78de6e9c3204b5b29a5516dd23b99499e82a0766dcdf2decf7bc34da073d37d5d6bec8b8107472cf0a16a4ea4c4803b53ffb584d1a93d98814abd8
7
+ data.tar.gz: 5059f7093eb473934a74fb5a39fd78c3f89b5c68ec1a9f05add361771f0629217e260a5b58f51615c598d73eb01c608a776bb666d32bb694561674377a7fcc84
@@ -18,7 +18,7 @@ jobs:
18
18
  - "3.1"
19
19
  - "3.2"
20
20
  steps:
21
- - uses: actions/checkout@v2
21
+ - uses: actions/checkout@v3
22
22
  - name: Set up Ruby
23
23
  uses: ruby/setup-ruby@v1
24
24
  with:
@@ -8,7 +8,7 @@ jobs:
8
8
  stale:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
- - uses: actions/stale@v1
11
+ - uses: actions/stale@v8
12
12
  with:
13
13
  repo-token: ${{ secrets.GITHUB_TOKEN }}
14
14
  stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
data/Gemfile CHANGED
@@ -3,3 +3,5 @@
3
3
  source 'http://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ gem 'byebug'
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # OmniAuth Teamwork  ![Build Status](https://github.com/kalpana0795/omniauth-teamwork/actions/workflows/ci.yml/badge.svg) [![Gem Version](https://badge.fury.io/rb/omniauth-teamwork.svg)](https://rubygems.org/gems/omniauth-teamwork)
2
+ This gem contains the Teamwork strategy for OmniAuth.
3
+
4
+ ## Installing
5
+
6
+ Add to your `Gemfile`:
7
+ ```ruby
8
+ gem 'omniauth-teamwork'
9
+ ```
10
+ Then `bundle install`
11
+
12
+ ## Usage
13
+
14
+ `OmniAuth::Strategies::Teamwork` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
15
+
16
+ Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
17
+
18
+ ```ruby
19
+ Rails.application.config.middleware.use OmniAuth::Builder do
20
+ provider :teamwork, ENV['TEAMWORK_CLIENT_ID'], ENV['TEAMWORK_CLIENT_SECRET']
21
+ end
22
+ ```
23
+
24
+ ## License
25
+ Copyright (c) 2023 Kalpana, Inc. See [LICENSE](https://github.com/kalpana0795/omniauth-teamwork/blob/main/LICENSE.md) for details.
@@ -16,10 +16,18 @@ module OmniAuth
16
16
  uid { raw_info['id'] }
17
17
 
18
18
  info do
19
+ warn('DEPRECATION WARNING: avatar_url is deprecated and will be removed from version 2.0 (use image instead)')
20
+
19
21
  {
22
+ name: "#{raw_info['first_name']} #{raw_info['last_name']}",
20
23
  email: raw_info['email_address'],
24
+ nickname: raw_info['user_name'],
21
25
  first_name: raw_info['first_name'],
22
26
  last_name: raw_info['last_name'],
27
+ location: location,
28
+ description: raw_info['profile_text'],
29
+ image: raw_info['avatar_url'],
30
+ phone: raw_info['phone_number_mobile'],
23
31
  avatar_url: raw_info['avatar_url']
24
32
  }
25
33
  end
@@ -36,6 +44,11 @@ module OmniAuth
36
44
  url = "#{access_token.response.parsed.installation.api_end_point}me.json"
37
45
  @raw_info ||= access_token.get(url).parsed.person
38
46
  end
47
+
48
+ def location
49
+ address = raw_info['address']
50
+ [address['city'], address['state']].join(' ').strip
51
+ end
39
52
  end
40
53
  end
41
54
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Teamwork
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.2'
6
6
  end
7
7
  end
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.summary = 'Unofficial OmniAuth strategy for Teamwork.'
8
8
  gem.description = 'Unofficial OmniAuth strategy for Teamwork.'
9
9
  gem.authors = ['Kalpana']
10
- gem.homepage = ''
10
+ gem.homepage = 'https://github.com/kalpana0795/omniauth-teamwork'
11
11
  gem.license = 'MIT'
12
12
 
13
13
  gem.files = `git ls-files`.split("\n")
@@ -35,11 +35,11 @@
35
35
  "site_owner": true,
36
36
  "company_name": "Awesome Company",
37
37
  "user_invited_date": "",
38
- "phone_number_mobile": "",
38
+ "phone_number_mobile": "9123456780",
39
39
  "user_type": "account",
40
40
  "has_feature_updates": true,
41
41
  "open_id": "",
42
- "address": { "city": "", "country": "", "countrycode": "", "zipcode": "", "state": "", "line1": "", "line2": "" },
42
+ "address": { "city": "xyz", "country": "", "countrycode": "", "zipcode": "", "state": "ABC", "line1": "", "line2": "" },
43
43
  "phone_number_office": "+01 123457890",
44
44
  "im_handle": "",
45
45
  "ld_hash": "99d2ae9093b3a812d74e4b7e411ea22fdb38b821259d374572f6f79f524dee41",
@@ -52,7 +52,7 @@
52
52
  "deleted": false,
53
53
  "notes": "",
54
54
  "in_owner_company": "1",
55
- "profile": "",
55
+ "profile": "<p>Awesome!!!</p>",
56
56
  "user_invited_status": "COMPLETE",
57
57
  "user_uuid": "",
58
58
  "user_invited": "0",
@@ -63,7 +63,7 @@
63
63
  "integrations": { "microsoft_connector": { "enabled": false } },
64
64
  "phone_number_home": "",
65
65
  "company_role_id": "5",
66
- "profile_text": "",
66
+ "profile_text": "Awesome!!!",
67
67
  "private_notes_text": "",
68
68
  "pid": "",
69
69
  "phone_number_mobile_parts": { "country_code": "", "prefix": "", "phone": "" },
@@ -40,17 +40,36 @@ describe OmniAuth::Strategies::Teamwork do
40
40
 
41
41
  context 'when data is present in raw info' do
42
42
  it 'returns the name' do
43
+ expect(subject.info[:name]).to eq("#{raw_info['first_name']} #{raw_info['last_name']}")
43
44
  expect(subject.info[:first_name]).to eq(raw_info['first_name'])
44
45
  expect(subject.info[:last_name]).to eq(raw_info['last_name'])
46
+ expect(subject.info[:nickname]).to eq(raw_info['user_name'])
45
47
  end
46
48
 
47
49
  it 'returns the avatar url' do
48
50
  expect(subject.info[:avatar_url]).to eq(raw_info['avatar_url'])
49
51
  end
50
52
 
51
- it 'return the email' do
53
+ it 'returns the image' do
54
+ expect(subject.info[:image]).to eq(raw_info['avatar_url'])
55
+ end
56
+
57
+ it 'returns the email' do
52
58
  expect(subject.info[:email]).to eq(raw_info['email_address'])
53
59
  end
60
+
61
+ it 'returns the location' do
62
+ location = "#{raw_info['address']['city']} #{raw_info['address']['state']}".strip
63
+ expect(subject.info[:location]).to eq(location)
64
+ end
65
+
66
+ it 'returns the description' do
67
+ expect(subject.info[:description]).to eq(raw_info['profile_text'])
68
+ end
69
+
70
+ it 'returns the phone' do
71
+ expect(subject.info[:phone]).to eq(raw_info['phone_number_mobile'])
72
+ end
54
73
  end
55
74
  end
56
75
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-teamwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kalpana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-03 00:00:00.000000000 Z
11
+ date: 2023-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2
@@ -69,6 +69,7 @@ files:
69
69
  - ".gitignore"
70
70
  - Gemfile
71
71
  - LICENSE.md
72
+ - README.md
72
73
  - Rakefile
73
74
  - lib/omniauth-teamwork.rb
74
75
  - lib/omniauth/strategies/teamwork.rb
@@ -77,7 +78,7 @@ files:
77
78
  - spec/fixtures/raw_info.json
78
79
  - spec/omniauth/strategies/teamwork_spec.rb
79
80
  - spec/spec_helper.rb
80
- homepage: ''
81
+ homepage: https://github.com/kalpana0795/omniauth-teamwork
81
82
  licenses:
82
83
  - MIT
83
84
  metadata: {}