omniauth-teamwork 1.0.1 → 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: 5192053a1b0bf5f88c22271950ed8fabc929b629eec6049d770bcde8239a6130
4
- data.tar.gz: bbc91b98e1c9e1399001ead0a7d6eda0f9892c5cbbc32a04a946a3fed9aa626c
3
+ metadata.gz: 0d65ad4001846e7a7511b9f9ff27f68b7a67d9a17917ef9458b31b62c940f8ee
4
+ data.tar.gz: '095d9bdb5c95adb6f566ebe2af53246723a6a447635343a002d1779cd7efe305'
5
5
  SHA512:
6
- metadata.gz: c68f403d10b6890b1dc10968d929b5e513e1e07503e3c6405fd6b4954d8129bc4c712671a32d5015ff0bf910062a6c1be66933e94a4b4a661b3ce41fcf7f565e
7
- data.tar.gz: ea49df95db90ca5e5ce7434d247d9ce04441d865a26add5a1dda79b2160cf50fe04e291f3e96eed0daa561525c1ad009e94fe8562178d96796c50d5dcdd93072
6
+ metadata.gz: 9ad926b6fe78de6e9c3204b5b29a5516dd23b99499e82a0766dcdf2decf7bc34da073d37d5d6bec8b8107472cf0a16a4ea4c4803b53ffb584d1a93d98814abd8
7
+ data.tar.gz: 5059f7093eb473934a74fb5a39fd78c3f89b5c68ec1a9f05add361771f0629217e260a5b58f51615c598d73eb01c608a776bb666d32bb694561674377a7fcc84
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 CHANGED
@@ -1,5 +1,4 @@
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
-
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)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Teamwork
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.2'
6
6
  end
7
7
  end
@@ -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.1
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