cognito-client 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -1
- data/Gemfile +37 -0
- data/Guardfile +4 -0
- data/README.md +55 -18
- data/Rakefile +3 -5
- data/bin/console +1 -1
- data/circle.yml +7 -0
- data/cognito.gemspec +4 -6
- data/config/devtools.yml +2 -0
- data/config/errors.yml +2 -0
- data/config/flay.yml +5 -0
- data/config/flog.yml +5 -0
- data/config/mutant.yml +6 -0
- data/config/reek.yml +111 -0
- data/config/rubocop.yml +91 -0
- data/config/yardstick.yml +2 -0
- data/lib/cognito/client.rb +59 -96
- data/lib/cognito/client/command.rb +34 -0
- data/lib/cognito/client/commands/create_identity.rb +22 -0
- data/lib/cognito/client/commands/create_identity_assessment.rb +26 -0
- data/lib/cognito/client/commands/create_identity_search.rb +37 -0
- data/lib/cognito/client/commands/create_profile.rb +24 -0
- data/lib/cognito/client/commands/mixins/create_behavior.rb +20 -0
- data/lib/cognito/client/commands/retrieve_identity_location.rb +28 -0
- data/lib/cognito/client/commands/retrieve_identity_search_job.rb +40 -0
- data/lib/cognito/client/connection.rb +36 -0
- data/lib/cognito/client/document.rb +32 -0
- data/lib/cognito/client/params.rb +13 -0
- data/lib/cognito/client/params/identity.rb +48 -0
- data/lib/cognito/client/params/identity_assessment.rb +23 -0
- data/lib/cognito/client/params/identity_search.rb +25 -0
- data/lib/cognito/client/params/omitted.rb +9 -0
- data/lib/cognito/client/request.rb +98 -0
- data/lib/cognito/client/resource.rb +124 -0
- data/lib/cognito/client/resource/identity_assessment.rb +53 -0
- data/lib/cognito/client/resource/identity_search.rb +64 -0
- data/lib/cognito/client/resource/identity_search_job.rb +12 -0
- data/lib/cognito/client/resource/profile.rb +10 -0
- data/lib/cognito/client/resource_identifier.rb +17 -0
- data/lib/cognito/client/response.rb +17 -0
- data/lib/cognito/client/response/builder.rb +48 -0
- data/lib/cognito/client/response/identity_assessment.rb +10 -0
- data/lib/cognito/client/response/identity_search.rb +32 -0
- data/lib/cognito/client/response/identity_search_job.rb +20 -0
- data/lib/cognito/client/response/profile.rb +10 -0
- data/lib/cognito/version.rb +3 -3
- metadata +77 -83
- data/.rubocop.yml +0 -57
- data/.travis.yml +0 -4
- data/lib/cognito.rb +0 -32
- data/lib/cognito/cleaner.rb +0 -30
- data/lib/cognito/constants.rb +0 -8
- data/lib/cognito/document.rb +0 -33
- data/lib/cognito/error.rb +0 -8
- data/lib/cognito/notary.rb +0 -56
- data/lib/cognito/resource.rb +0 -129
- data/lib/cognito/resource/identity_assessment.rb +0 -40
- data/lib/cognito/resource/identity_search.rb +0 -63
- data/lib/cognito/resource/identity_search_job.rb +0 -11
- data/lib/cognito/resource/profile.rb +0 -9
- data/lib/cognito/responder.rb +0 -61
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Cognito
|
4
|
+
class Client
|
5
|
+
class ResourceIdentifier
|
6
|
+
include Procto.call(:to_h), Anima.new(:id, :type, :attributes, :relationships)
|
7
|
+
|
8
|
+
def initialize(relationships: nil, **options)
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_h
|
13
|
+
{ type: type, id: id }
|
14
|
+
end
|
15
|
+
end # ResourceIdentifier
|
16
|
+
end # Client
|
17
|
+
end # Cognito
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Cognito
|
4
|
+
class Client
|
5
|
+
class Response
|
6
|
+
include Anima.new(:status, :headers, :data, :connection)
|
7
|
+
|
8
|
+
def self.build(response, connection)
|
9
|
+
new(Builder.call(response).merge(connection: connection))
|
10
|
+
end
|
11
|
+
|
12
|
+
class Status
|
13
|
+
include Anima.new(:code, :reason)
|
14
|
+
end # Status
|
15
|
+
end # Response
|
16
|
+
end # Client
|
17
|
+
end # Cognito
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Cognito
|
4
|
+
class Client
|
5
|
+
class Response
|
6
|
+
class Builder
|
7
|
+
include Concord.new(:response), Procto.call(:to_h), Adamantium
|
8
|
+
|
9
|
+
def to_h
|
10
|
+
{
|
11
|
+
status: build_status,
|
12
|
+
headers: response.headers.to_hash,
|
13
|
+
data: build_data
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def build_data
|
20
|
+
return if response.body.empty?
|
21
|
+
|
22
|
+
resource_class.build(document.data, document)
|
23
|
+
end
|
24
|
+
|
25
|
+
def build_status
|
26
|
+
Status.new(
|
27
|
+
code: response.code,
|
28
|
+
reason: response.reason
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
def resource_class
|
33
|
+
data = parsed_response.fetch(:data)
|
34
|
+
Resource::REGISTRY.lookup(data.fetch(:type).to_sym)
|
35
|
+
end
|
36
|
+
|
37
|
+
def document
|
38
|
+
Document.new(parsed_response)
|
39
|
+
end
|
40
|
+
|
41
|
+
def parsed_response
|
42
|
+
JSON.parse(response, symbolize_names: true)
|
43
|
+
end
|
44
|
+
memoize :parsed_response
|
45
|
+
end # Builder
|
46
|
+
end # Response
|
47
|
+
end # Client
|
48
|
+
end # Cognito
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Cognito
|
4
|
+
class Client
|
5
|
+
class Response
|
6
|
+
class IdentitySearch < self
|
7
|
+
def create_assessment(attributes = {})
|
8
|
+
Command::CreateIdentityAssessment.call(
|
9
|
+
attributes.merge(
|
10
|
+
connection: connection,
|
11
|
+
identity_search_identifier: identifier
|
12
|
+
)
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
def processing?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def identifier
|
23
|
+
ResourceIdentifier.call(data_without_parent)
|
24
|
+
end
|
25
|
+
|
26
|
+
def data_without_parent
|
27
|
+
data.to_h.reject { |key| key.equal?(:parent) }
|
28
|
+
end
|
29
|
+
end # IdentitySearch
|
30
|
+
end # Response
|
31
|
+
end # Client
|
32
|
+
end # Cognito
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Cognito
|
4
|
+
class Client
|
5
|
+
class Response
|
6
|
+
class IdentitySearchJob < self
|
7
|
+
def get
|
8
|
+
Command::RetrieveIdentitySearchJob.call(
|
9
|
+
connection,
|
10
|
+
headers.fetch('Content-Location')
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def processing?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end # IdentitySearchJob
|
18
|
+
end # Response
|
19
|
+
end # Client
|
20
|
+
end # Cognito
|
data/lib/cognito/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
|
-
VERSION = '0.
|
4
|
-
end
|
2
|
+
class Cognito
|
3
|
+
VERSION = '0.5.0'
|
4
|
+
end # Cognito
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cognito-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connor Jacobsen
|
@@ -39,159 +39,129 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.10'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '11.2'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '11.2'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.5'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.5'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0.41'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.41'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: timecop
|
42
|
+
name: abstract_type
|
85
43
|
requirement: !ruby/object:Gem::Requirement
|
86
44
|
requirements:
|
87
45
|
- - "~>"
|
88
46
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
90
|
-
type: :
|
47
|
+
version: 0.0.7
|
48
|
+
type: :runtime
|
91
49
|
prerelease: false
|
92
50
|
version_requirements: !ruby/object:Gem::Requirement
|
93
51
|
requirements:
|
94
52
|
- - "~>"
|
95
53
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
54
|
+
version: 0.0.7
|
97
55
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
56
|
+
name: adamantium
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
100
58
|
requirements:
|
101
59
|
- - "~>"
|
102
60
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
type: :
|
61
|
+
version: 0.2.0
|
62
|
+
type: :runtime
|
105
63
|
prerelease: false
|
106
64
|
version_requirements: !ruby/object:Gem::Requirement
|
107
65
|
requirements:
|
108
66
|
- - "~>"
|
109
67
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
68
|
+
version: 0.2.0
|
111
69
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
70
|
+
name: anima
|
113
71
|
requirement: !ruby/object:Gem::Requirement
|
114
72
|
requirements:
|
115
73
|
- - "~>"
|
116
74
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.0
|
75
|
+
version: 0.3.0
|
118
76
|
type: :runtime
|
119
77
|
prerelease: false
|
120
78
|
version_requirements: !ruby/object:Gem::Requirement
|
121
79
|
requirements:
|
122
80
|
- - "~>"
|
123
81
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.0
|
82
|
+
version: 0.3.0
|
125
83
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
84
|
+
name: concord
|
127
85
|
requirement: !ruby/object:Gem::Requirement
|
128
86
|
requirements:
|
129
87
|
- - "~>"
|
130
88
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
89
|
+
version: 0.1.5
|
132
90
|
type: :runtime
|
133
91
|
prerelease: false
|
134
92
|
version_requirements: !ruby/object:Gem::Requirement
|
135
93
|
requirements:
|
136
94
|
- - "~>"
|
137
95
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
96
|
+
version: 0.1.5
|
139
97
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
98
|
+
name: procto
|
141
99
|
requirement: !ruby/object:Gem::Requirement
|
142
100
|
requirements:
|
143
101
|
- - "~>"
|
144
102
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.3
|
103
|
+
version: 0.0.3
|
146
104
|
type: :runtime
|
147
105
|
prerelease: false
|
148
106
|
version_requirements: !ruby/object:Gem::Requirement
|
149
107
|
requirements:
|
150
108
|
- - "~>"
|
151
109
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.3
|
110
|
+
version: 0.0.3
|
153
111
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
112
|
+
name: ice_nine
|
155
113
|
requirement: !ruby/object:Gem::Requirement
|
156
114
|
requirements:
|
157
115
|
- - "~>"
|
158
116
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.
|
117
|
+
version: 0.11.2
|
160
118
|
type: :runtime
|
161
119
|
prerelease: false
|
162
120
|
version_requirements: !ruby/object:Gem::Requirement
|
163
121
|
requirements:
|
164
122
|
- - "~>"
|
165
123
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.
|
124
|
+
version: 0.11.2
|
167
125
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
126
|
+
name: http
|
169
127
|
requirement: !ruby/object:Gem::Requirement
|
170
128
|
requirements:
|
171
129
|
- - "~>"
|
172
130
|
- !ruby/object:Gem::Version
|
173
|
-
version: '0
|
131
|
+
version: '2.0'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 2.0.3
|
174
135
|
type: :runtime
|
175
136
|
prerelease: false
|
176
137
|
version_requirements: !ruby/object:Gem::Requirement
|
177
138
|
requirements:
|
178
139
|
- - "~>"
|
179
140
|
- !ruby/object:Gem::Version
|
180
|
-
version: '0
|
141
|
+
version: '2.0'
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 2.0.3
|
181
145
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
146
|
+
name: addressable
|
183
147
|
requirement: !ruby/object:Gem::Requirement
|
184
148
|
requirements:
|
185
149
|
- - "~>"
|
186
150
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
151
|
+
version: '2.4'
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 2.4.0
|
188
155
|
type: :runtime
|
189
156
|
prerelease: false
|
190
157
|
version_requirements: !ruby/object:Gem::Requirement
|
191
158
|
requirements:
|
192
159
|
- - "~>"
|
193
160
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
161
|
+
version: '2.4'
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 2.4.0
|
195
165
|
description:
|
196
166
|
email:
|
197
167
|
- connor@opendoor.com
|
@@ -201,28 +171,52 @@ extra_rdoc_files: []
|
|
201
171
|
files:
|
202
172
|
- ".gitignore"
|
203
173
|
- ".rspec"
|
204
|
-
- ".rubocop.yml"
|
205
|
-
- ".travis.yml"
|
206
174
|
- Gemfile
|
175
|
+
- Guardfile
|
207
176
|
- LICENSE.txt
|
208
177
|
- README.md
|
209
178
|
- Rakefile
|
210
179
|
- bin/console
|
211
180
|
- bin/setup
|
181
|
+
- circle.yml
|
212
182
|
- cognito.gemspec
|
213
|
-
-
|
214
|
-
-
|
183
|
+
- config/devtools.yml
|
184
|
+
- config/errors.yml
|
185
|
+
- config/flay.yml
|
186
|
+
- config/flog.yml
|
187
|
+
- config/mutant.yml
|
188
|
+
- config/reek.yml
|
189
|
+
- config/rubocop.yml
|
190
|
+
- config/yardstick.yml
|
215
191
|
- lib/cognito/client.rb
|
216
|
-
- lib/cognito/
|
217
|
-
- lib/cognito/
|
218
|
-
- lib/cognito/
|
219
|
-
- lib/cognito/
|
220
|
-
- lib/cognito/
|
221
|
-
- lib/cognito/
|
222
|
-
- lib/cognito/
|
223
|
-
- lib/cognito/
|
224
|
-
- lib/cognito/
|
225
|
-
- lib/cognito/
|
192
|
+
- lib/cognito/client/command.rb
|
193
|
+
- lib/cognito/client/commands/create_identity.rb
|
194
|
+
- lib/cognito/client/commands/create_identity_assessment.rb
|
195
|
+
- lib/cognito/client/commands/create_identity_search.rb
|
196
|
+
- lib/cognito/client/commands/create_profile.rb
|
197
|
+
- lib/cognito/client/commands/mixins/create_behavior.rb
|
198
|
+
- lib/cognito/client/commands/retrieve_identity_location.rb
|
199
|
+
- lib/cognito/client/commands/retrieve_identity_search_job.rb
|
200
|
+
- lib/cognito/client/connection.rb
|
201
|
+
- lib/cognito/client/document.rb
|
202
|
+
- lib/cognito/client/params.rb
|
203
|
+
- lib/cognito/client/params/identity.rb
|
204
|
+
- lib/cognito/client/params/identity_assessment.rb
|
205
|
+
- lib/cognito/client/params/identity_search.rb
|
206
|
+
- lib/cognito/client/params/omitted.rb
|
207
|
+
- lib/cognito/client/request.rb
|
208
|
+
- lib/cognito/client/resource.rb
|
209
|
+
- lib/cognito/client/resource/identity_assessment.rb
|
210
|
+
- lib/cognito/client/resource/identity_search.rb
|
211
|
+
- lib/cognito/client/resource/identity_search_job.rb
|
212
|
+
- lib/cognito/client/resource/profile.rb
|
213
|
+
- lib/cognito/client/resource_identifier.rb
|
214
|
+
- lib/cognito/client/response.rb
|
215
|
+
- lib/cognito/client/response/builder.rb
|
216
|
+
- lib/cognito/client/response/identity_assessment.rb
|
217
|
+
- lib/cognito/client/response/identity_search.rb
|
218
|
+
- lib/cognito/client/response/identity_search_job.rb
|
219
|
+
- lib/cognito/client/response/profile.rb
|
226
220
|
- lib/cognito/version.rb
|
227
221
|
homepage: https://github.com/opendoor-labs/cognito
|
228
222
|
licenses:
|