ecoportal-api 0.1.1 → 0.1.2
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 +4 -4
- data/lib/ecoportal/api/common/base_model.rb +4 -0
- data/lib/ecoportal/api/common/wrapped_response.rb +1 -0
- data/lib/ecoportal/api/internal/login_providers.rb +1 -0
- data/lib/ecoportal/api/internal/person.rb +1 -1
- data/lib/ecoportal/api/internal/policy_groups.rb +1 -0
- data/lib/ecoportal/api/v1/people.rb +7 -2
- data/lib/ecoportal/api/v1/person.rb +8 -3
- data/lib/ecoportal/api/v1/person_details.rb +2 -2
- data/lib/ecoportal/api/v1/person_schemas.rb +1 -0
- data/lib/ecoportal/api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7556b0b8b049d1f3b7aaceff7f44b426be650a25f7973af7203254a8073350d0
|
4
|
+
data.tar.gz: 7a37f67cbdb3bc8c8237a79b3c4a3de915eb464c015975acb596ed9ceabebcb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db45b0f254848749ef3802a3229fc04b278332bb4cde34880fb3698bacdc5baf8c77f9a871847c14736c5fb1eaa3ab4cdc05f6b35f3e18f6ebe15040b187a8b0
|
7
|
+
data.tar.gz: 0ffd2ef4c5d058e98323c13203af5121242021fb0dbddf6cbc7f99395ba8c2b6a48f9b8a3891769db58a581ab69b84a253aeafe9dd8e3f8e11c4f482a0a3c29f
|
@@ -3,6 +3,7 @@ module Ecoportal
|
|
3
3
|
module API
|
4
4
|
class V1
|
5
5
|
class People
|
6
|
+
include Enumerable
|
6
7
|
include Common::DocHelpers
|
7
8
|
attr_reader :client
|
8
9
|
|
@@ -24,8 +25,8 @@ module Ecoportal
|
|
24
25
|
self
|
25
26
|
end
|
26
27
|
|
27
|
-
def get(
|
28
|
-
response = @client.get("/people/"+CGI::escape(
|
28
|
+
def get(doc)
|
29
|
+
response = @client.get("/people/"+CGI::escape(get_id(doc)))
|
29
30
|
Common::WrappedResponse.new(response, person_class)
|
30
31
|
end
|
31
32
|
|
@@ -63,6 +64,10 @@ module Ecoportal
|
|
63
64
|
@client.delete("/people/"+CGI::escape(id))
|
64
65
|
end
|
65
66
|
|
67
|
+
def new
|
68
|
+
person_class.new
|
69
|
+
end
|
70
|
+
|
66
71
|
private
|
67
72
|
|
68
73
|
def person_class
|
@@ -28,17 +28,22 @@ module Ecoportal
|
|
28
28
|
case value
|
29
29
|
when NilClass
|
30
30
|
doc["details"] = nil
|
31
|
-
when
|
32
|
-
doc["details"] =
|
31
|
+
when person_details_class
|
32
|
+
doc["details"] = value.as_json
|
33
33
|
when Hash
|
34
34
|
doc["details"] = value.slice("schema_id", "fields")
|
35
35
|
else
|
36
36
|
raise "Invalid set on details: Need nil, PersonDetails or Hash; got #{value.class}"
|
37
37
|
end
|
38
|
-
remove_instance_variable("@details")
|
38
|
+
remove_instance_variable("@details") if defined?(@details)
|
39
39
|
return details
|
40
40
|
end
|
41
41
|
|
42
|
+
def add_details(schema_id)
|
43
|
+
self.details = person_details_class.new
|
44
|
+
self.details.schema_id = schema_id
|
45
|
+
end
|
46
|
+
|
42
47
|
private
|
43
48
|
|
44
49
|
def person_details_class
|