omniauth-square-oauth2 0.1.0 → 0.2.1

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: 5e3ce6302878b604dad6faa187f8c010076d71e20f3af41511da76f145475590
4
- data.tar.gz: de9b2e8a453015ab750becdb0c8bc82adc3f1c469fc6bfaf25bbe0ab180a23cf
3
+ metadata.gz: 1dbbd4880dcd058c91dfccee51fcad1f28dbc6a2213aba3fa190752870e2f3e6
4
+ data.tar.gz: 1e519f5ed04e2f5a0eaf8e2ba0513b419d3c35c0741bda1c0dacf516f788d20d
5
5
  SHA512:
6
- metadata.gz: f258bdfe36130dc3b56d87c4fd952e71a1f72ca40c3573e520e7ba6ba808e54cfee9ece431f347a99a3f4c9708bf88efe35c3cf68b5f3bf42311726cefe77545
7
- data.tar.gz: a50c2e2d11fbeae5c8d3b553e60eb30734ff38973e12cbb1af12c618889f33091700dc00a96636ba11dc9cade30e388ac09faf38c728858c796bc6f7e45a03b7
6
+ metadata.gz: 4c149c89352d5f78e0ba70cf6dbdd8f2633c98eea3d7cfb94d2f00c6d2d0d010ec091862d9568f99234f3bd33dadbdc0406eec6d68254f72e7b3c8f64fc04e22
7
+ data.tar.gz: 0dcfcce43f17b2c4ee336695e8dea626d8d93782b7b67b2277963477a4d0d34577b7c93a2263c018d1190b689c5b5b5cbcbbe329143a5c0c38ceb5e0d8fb5fb2
data/README.md CHANGED
@@ -20,7 +20,7 @@ Once these are in, you need to add the following to your `config/initializers/de
20
20
 
21
21
  Sandbox Example:
22
22
 
23
- config.omniauth :square, "your_app_id", "your_app_oauth_secret", {:scope => "ITEMS_READ,ITEMS_WRITE,MERCHANT_PROFILE_READ", :client_options => {:connect_site => 'https://connect.squareupsandbox.com', :site => 'https://squareupsandbox.com'}}
23
+ config.omniauth :square, "your_app_id", "your_app_oauth_secret", {:scope => "ITEMS_READ,ITEMS_WRITE,MERCHANT_PROFILE_READ", :client_options => {:site => 'https://connect.squareupsandbox.com'}}
24
24
 
25
25
  You will obviously have to put in your key and secret, which you get when you register your app with Square (they call them Application Key and Secret Key).
26
26
 
@@ -39,9 +39,12 @@ module OmniAuth
39
39
 
40
40
  def raw_info
41
41
  @raw_info ||= access_token.get('/v2/merchants').parsed
42
- main_location_id = @raw_info['merchant'][0]['main_location_id']
43
- location_data = access_token.get("/v2/locations/#{main_location_id}").parsed
44
- @raw_info.merge!({email: location_data['location']['business_email']})
42
+
43
+ # Get merchant email
44
+ log :info, "Getting merchant email"
45
+ resp = access_token.post("/v2/team-members/search", {query: {filter: {is_owner: true}}}).parsed
46
+ log :info, "Got merchant email: #{resp[:team_members][0].email_address}"
47
+ @raw_info.merge!({email: resp[:team_members][0].email_address})
45
48
  end
46
49
 
47
50
  def prune!(hash)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Omniauth
4
4
  module Square
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-square-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Robinson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-29 00:00:00.000000000 Z
11
+ date: 2023-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-oauth2