omniauth-uber-eats-oauth2 0.2.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: 92c7c2106c0598a632f71475bb890667c28a3154ae73c943c6ff627c95ca25c3
4
- data.tar.gz: 6a71f29fdbd99ebbddc0834b2496fd43eeb6437e838ff9a1abe82e5792035002
3
+ metadata.gz: cea19e4b210768c9b76023ad072499cfb20e97e46797f8a7ef2b7caec39dfe25
4
+ data.tar.gz: 308a306de3280c6eed9f0f75eca1919fa9bdbc6d426f7bb4b398ebf4146fcd18
5
5
  SHA512:
6
- metadata.gz: 7711d536482ebe8e3be71dd6a76b4581030a50cfbf83ff4fdb7b3dbc6556cacb36d7e263fda172629fac559ef50f8fb6f78cf8e3aa70fd55ba1e919fabb21489
7
- data.tar.gz: 8f01376dba12085075292cf62783a211d30ae9c71eeca7a98c921551b3f91275d147254ac4364c55cebbf782bd3e8b348e11f33b871a4a3d642849475ac0842c
6
+ metadata.gz: 7350e7c0c56a3786c6743afbc75be6b186a83e2fd74f27e7c1a5bbd474ed44a2ca35335f5d31eeef204d9370589c3bf70994378c1ea3282754c6b6c4f5d487e4
7
+ data.tar.gz: 6805ee5e9e3d1e9adf72f3db8c8a9ba19e4fe2aecd812f344beba03591dc12f6db5304b0e0ef9f463a3b8274f586fbc23810e6e897031c4c5e028f6dc49bc003
@@ -73,12 +73,15 @@ module OmniAuth
73
73
  raise
74
74
  end
75
75
 
76
- uid { raw_info['store_id'] || raw_info['id'] }
76
+ # UID: prefer store_id from API, fall back to uber_user_id from token
77
+ uid do
78
+ raw_info['store_id'] || raw_info['id'] || uber_user_id
79
+ end
77
80
 
78
81
  info do
79
82
  {
80
- name: raw_info['store_name'],
81
- business_name: raw_info['store_name'],
83
+ name: raw_info['store_name'] || "Uber Eats Store",
84
+ business_name: raw_info['store_name'] || "Uber Eats Store",
82
85
  email: nil # Uber Eats doesn't provide merchant email via API
83
86
  }
84
87
  end
@@ -93,9 +96,20 @@ module OmniAuth
93
96
 
94
97
  private
95
98
 
99
+ # Extract user ID from the access token response.
100
+ # Uber's token response includes uber_user_id or we can derive from token params.
101
+ def uber_user_id
102
+ return @uber_user_id if defined?(@uber_user_id)
103
+
104
+ @uber_user_id = access_token.params['uber_user_id'] ||
105
+ access_token.params['user_id'] ||
106
+ access_token.token&.first(32) # last resort: use token prefix as stable ID
107
+ end
108
+
96
109
  def fetch_store_info
97
110
  response = access_token.get('/v1/eats/stores')
98
111
  parsed = response.parsed
112
+ log(:info, "Store info response: #{parsed.inspect}")
99
113
  stores = parsed['stores'] || []
100
114
  store = stores.first
101
115
 
@@ -107,10 +121,11 @@ module OmniAuth
107
121
  'status' => store['status']
108
122
  }
109
123
  else
124
+ log(:warn, "No stores found in response, using fallback UID")
110
125
  { 'store_id' => nil }
111
126
  end
112
127
  rescue StandardError => e
113
- log(:warn, "Failed to fetch store info: #{e.message}")
128
+ log(:warn, "Failed to fetch store info: #{e.message} — using fallback UID")
114
129
  { 'store_id' => nil }
115
130
  end
116
131
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module UberEatsOauth2
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-uber-eats-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dan1d