Skip to content

Commit 53f202f

Browse files
committed
give Resource#find the ability to auth to esdb
1 parent f7c40e9 commit 53f202f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/esdb/resource.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ def get!(*args)
4343
# TODO: prepare to get rid of RestClient potentially, it's not really
4444
# maintained anymore anyway. Don't use RestClient specific calls outside
4545
# of gg itself and give gg an AR-like API.
46-
def self.find(id)
47-
resource = self.new(id: id)
46+
#
47+
# Note: the auth option is not used anywhere currently - ggtracker uses
48+
# sync below, which always appends the API key anyway. This is needed to
49+
# retrieve sensible information from esdb, such as the character_code of an
50+
# identity.
51+
def self.find(id, options = {})
52+
resource = options[:auth] ? self.new(id: id, access_token: ESDB.api_key) : self.new(id: id)
4853
resource.get!
4954

5055
if (200..207).include?(resource.response.code)

0 commit comments

Comments
 (0)