omniauth-teamwork 1.0.1 → 1.0.2
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 +4 -4
- data/Gemfile +2 -0
- data/README.md +4 -2
- data/lib/omniauth/strategies/teamwork.rb +13 -0
- data/lib/omniauth/teamwork/version.rb +1 -1
- data/spec/fixtures/raw_info.json +4 -4
- data/spec/omniauth/strategies/teamwork_spec.rb +20 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d65ad4001846e7a7511b9f9ff27f68b7a67d9a17917ef9458b31b62c940f8ee
|
4
|
+
data.tar.gz: '095d9bdb5c95adb6f566ebe2af53246723a6a447635343a002d1779cd7efe305'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ad926b6fe78de6e9c3204b5b29a5516dd23b99499e82a0766dcdf2decf7bc34da073d37d5d6bec8b8107472cf0a16a4ea4c4803b53ffb584d1a93d98814abd8
|
7
|
+
data.tar.gz: 5059f7093eb473934a74fb5a39fd78c3f89b5c68ec1a9f05add361771f0629217e260a5b58f51615c598d73eb01c608a776bb666d32bb694561674377a7fcc84
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
# OmniAuth Teamwork  [](https://rubygems.org/gems/omniauth-teamwork)
|
2
|
-
|
1
|
+
# OmniAuth Teamwork  [](https://rubygems.org/gems/omniauth-teamwork)
|
3
2
|
This gem contains the Teamwork strategy for OmniAuth.
|
4
3
|
|
5
4
|
## Installing
|
@@ -21,3 +20,6 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
|
21
20
|
provider :teamwork, ENV['TEAMWORK_CLIENT_ID'], ENV['TEAMWORK_CLIENT_SECRET']
|
22
21
|
end
|
23
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
|
data/spec/fixtures/raw_info.json
CHANGED
@@ -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 '
|
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.
|
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-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth-oauth2
|