We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c8b82c commit 9ca031cCopy full SHA for 9ca031c
lib/esdb/resource.rb
@@ -40,6 +40,23 @@ def get!(*args)
40
@response = get(*args)
41
end
42
43
+ # TODO: prepare to get rid of RestClient potentially, it's not really
44
+ # maintained anymore anyway. Don't use RestClient specific calls outside
45
+ # of gg itself and give gg an AR-like API.
46
+ def self.find(id)
47
+ resource = self.new(id: id)
48
+ resource.get!
49
+
50
+ if [200..207].include?(resource.response.code)
51
+ return resource
52
+ else
53
+ return nil
54
+ end
55
56
+ rescue
57
+ nil
58
59
60
# A kind of find_or_create - experimental.
61
# For example identities should be created and returned if sufficient
62
# identifying data is submitted, but no identity is found.
0 commit comments