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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86e3186a7250f7e2aece863f01c09823bdff4864
|
4
|
+
data.tar.gz: 7d3ac5b3649e5027f309ced4325b132e369b5385
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f60da529529285bc97b3ead92afbd912a5c82314b2725b914afffb19b5d26769d111c1f20f8b78a00f4cc3dfce01d71898298b51bf58a4615dce2df49f705413
|
7
|
+
data.tar.gz: 3c18ced1a8f32d98ab893982135b358851536b3822706bc824370eac98ef30a9ada94bfbaa34c35280b532c415cc19877ee5b7fd91d20e0fbf9d9b3b0a4cbd69
|
data/.rspec
CHANGED
data/Gemfile
CHANGED
@@ -3,3 +3,40 @@ source 'https://rubygems.org'
|
|
3
3
|
|
4
4
|
# Specify your gem's dependencies in cognito.gemspec
|
5
5
|
gemspec
|
6
|
+
|
7
|
+
group(:tools) do
|
8
|
+
# mutation testing tool for ruby
|
9
|
+
gem 'mutant', '~> 0.8.10'
|
10
|
+
|
11
|
+
# Rspec integration for mutant
|
12
|
+
gem 'mutant-rspec', '~> 0.8.8'
|
13
|
+
|
14
|
+
# Watches file system and invokes commands according to mapping rules
|
15
|
+
gem 'guard', '~> 2.14.0'
|
16
|
+
|
17
|
+
# Plugin to guard for RSpec tooling
|
18
|
+
gem 'guard-rspec', '~> 4.7.2'
|
19
|
+
|
20
|
+
# A metagem wrapping development tools:
|
21
|
+
# procto,
|
22
|
+
# adamantium,
|
23
|
+
# anima,
|
24
|
+
# concord,
|
25
|
+
# rspec, rspec-core, rspec-its
|
26
|
+
# rake,
|
27
|
+
# yard,
|
28
|
+
# flog,
|
29
|
+
# flay,
|
30
|
+
# reek,
|
31
|
+
# rubocop,
|
32
|
+
# simplecov,
|
33
|
+
# yardstick,
|
34
|
+
# mutant, mutant-rspec
|
35
|
+
gem 'devtools', '~> 0.1.8'
|
36
|
+
|
37
|
+
# Rubocop extensions which reflect BlockScore's style guide
|
38
|
+
gem 'rubocop-devtools', git: 'https://github.com/backus/rubocop-devtools.git'
|
39
|
+
|
40
|
+
# Enforce style and convention for rspec
|
41
|
+
gem 'rubocop-rspec', git: 'https://github.com/nevir/rubocop-rspec.git'
|
42
|
+
end
|
data/Guardfile
ADDED
data/README.md
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
# Cognito Client
|
2
2
|
|
3
|
-
Unofficial Ruby client for the BlockScore Cognito API.
|
4
|
-
|
5
|
-
Frankenstein of demo code supplied by BlockScore, and our own stuff. `client.rb` is ours,
|
6
|
-
everything else is theirs. The BlockScore code basically just handles the structuring
|
7
|
-
of their data models.
|
8
|
-
|
9
|
-
Currently in the "make it work" phase of development.
|
3
|
+
Unofficial Ruby client for the BlockScore Cognito API. This library was designed using a [command-query separation principle](https://en.wikipedia.org/wiki/Command–query_separation).
|
10
4
|
|
11
5
|
## Installation
|
12
6
|
|
@@ -22,29 +16,72 @@ And then execute:
|
|
22
16
|
|
23
17
|
## Usage
|
24
18
|
|
25
|
-
|
19
|
+
### Creating a client
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
client = Cognito::Client.create(
|
23
|
+
api_key: 'your-api-key',
|
24
|
+
api_secret: 'your-api-secret',
|
25
|
+
uri: 'https://sandbox.cognitohq.com',
|
26
|
+
api_version: '2016-09-01'
|
27
|
+
)
|
28
|
+
```
|
29
|
+
|
30
|
+
### Creating a profile
|
26
31
|
|
27
32
|
```ruby
|
28
|
-
|
33
|
+
profile = client.create_profile
|
34
|
+
```
|
35
|
+
|
36
|
+
### Create an identity search with phone and name
|
29
37
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
38
|
+
```ruby
|
39
|
+
search = client.create_identity_search(
|
40
|
+
profile_id: profile.data.id,
|
41
|
+
phone_number: '+14151231234',
|
42
|
+
name: { # optional
|
43
|
+
first: 'Leslie',
|
44
|
+
last: 'Knope'
|
45
|
+
}
|
46
|
+
)
|
34
47
|
```
|
35
48
|
|
36
|
-
|
49
|
+
### Creating an identity assessment for the search
|
37
50
|
|
38
51
|
```ruby
|
39
|
-
|
52
|
+
assessment = search.create_assessment(
|
53
|
+
phone_number: '+14151231234',
|
54
|
+
name: {
|
55
|
+
first: 'Leslie',
|
56
|
+
last: 'Doe'
|
57
|
+
}
|
58
|
+
)
|
40
59
|
```
|
41
60
|
|
42
|
-
|
61
|
+
### Traversing the data
|
62
|
+
|
63
|
+
The client automatically links the resource relationships allowing you to make calls like:
|
43
64
|
|
44
65
|
```ruby
|
45
|
-
|
66
|
+
search.data.identity_records.first.names.map(&:attributes)
|
46
67
|
|
47
|
-
|
68
|
+
# [
|
69
|
+
# { :first=>"LESLIE", :middle=>"BARBARA", :last=>"KNOPE" },
|
70
|
+
# {:first=>"LESLIE", :middle=>nil, :last=>"KNOPE-WYATT" }
|
71
|
+
# ]
|
72
|
+
|
73
|
+
```
|
74
|
+
|
75
|
+
## Running the test suite
|
76
|
+
|
77
|
+
```
|
78
|
+
bundle exec rspec
|
79
|
+
```
|
80
|
+
|
81
|
+
## Running the CI tasks
|
82
|
+
|
83
|
+
```
|
84
|
+
bundle exec rake ci
|
48
85
|
```
|
49
86
|
|
50
87
|
## License
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/circle.yml
ADDED
data/cognito.gemspec
CHANGED
@@ -21,16 +21,14 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
23
23
|
spec.add_development_dependency 'pry', '~> 0.10'
|
24
|
-
spec.add_development_dependency 'rake', '~> 11.2'
|
25
|
-
spec.add_development_dependency 'rspec', '~> 3.5'
|
26
|
-
spec.add_development_dependency 'rubocop', '~> 0.41'
|
27
|
-
spec.add_development_dependency 'timecop', '~> 0.8'
|
28
|
-
spec.add_development_dependency 'rspec-its', '~> 1.2.0'
|
29
24
|
|
30
25
|
spec.add_dependency 'abstract_type', '~> 0.0.7'
|
31
26
|
spec.add_dependency 'adamantium', '~> 0.2.0'
|
32
27
|
spec.add_dependency 'anima', '~> 0.3.0'
|
33
28
|
spec.add_dependency 'concord', '~> 0.1.5'
|
34
|
-
spec.add_dependency 'httparty', '~> 0.13'
|
35
29
|
spec.add_dependency 'procto', '~> 0.0.3'
|
30
|
+
spec.add_dependency 'ice_nine', '~> 0.11.2'
|
31
|
+
|
32
|
+
spec.add_runtime_dependency 'http', '~> 2.0', '>= 2.0.3'
|
33
|
+
spec.add_runtime_dependency 'addressable', '~> 2.4', '>= 2.4.0'
|
36
34
|
end
|
data/config/devtools.yml
ADDED
data/config/errors.yml
ADDED
data/config/flay.yml
ADDED
data/config/flog.yml
ADDED
data/config/mutant.yml
ADDED
data/config/reek.yml
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
---
|
2
|
+
Attribute:
|
3
|
+
enabled: false
|
4
|
+
exclude: []
|
5
|
+
BooleanParameter:
|
6
|
+
enabled: true
|
7
|
+
exclude: []
|
8
|
+
ClassVariable:
|
9
|
+
enabled: true
|
10
|
+
exclude: []
|
11
|
+
ControlParameter:
|
12
|
+
enabled: true
|
13
|
+
exclude: []
|
14
|
+
DataClump:
|
15
|
+
enabled: true
|
16
|
+
exclude: []
|
17
|
+
max_copies: 2
|
18
|
+
min_clump_size: 2
|
19
|
+
DuplicateMethodCall:
|
20
|
+
enabled: false
|
21
|
+
exclude: []
|
22
|
+
max_calls: 1
|
23
|
+
allow_calls: []
|
24
|
+
FeatureEnvy:
|
25
|
+
enabled: true
|
26
|
+
exclude: []
|
27
|
+
IrresponsibleModule:
|
28
|
+
enabled: false
|
29
|
+
exclude: []
|
30
|
+
LongParameterList:
|
31
|
+
enabled: true
|
32
|
+
exclude: []
|
33
|
+
max_params: 3
|
34
|
+
overrides:
|
35
|
+
initialize:
|
36
|
+
max_params: 5
|
37
|
+
LongYieldList:
|
38
|
+
enabled: true
|
39
|
+
exclude: []
|
40
|
+
max_params: 3
|
41
|
+
ModuleInitialize:
|
42
|
+
enabled: true
|
43
|
+
exclude: []
|
44
|
+
NestedIterators:
|
45
|
+
enabled: true
|
46
|
+
exclude: []
|
47
|
+
max_allowed_nesting: 2
|
48
|
+
ignore_iterators: []
|
49
|
+
NilCheck:
|
50
|
+
enabled: true
|
51
|
+
exclude: []
|
52
|
+
PrimaDonnaMethod:
|
53
|
+
enabled: true
|
54
|
+
exclude: []
|
55
|
+
RepeatedConditional:
|
56
|
+
enabled: true
|
57
|
+
exclude: []
|
58
|
+
max_ifs: 2
|
59
|
+
TooManyInstanceVariables:
|
60
|
+
enabled: true
|
61
|
+
exclude: []
|
62
|
+
max_instance_variables: 9
|
63
|
+
TooManyMethods:
|
64
|
+
enabled: true
|
65
|
+
exclude: []
|
66
|
+
max_methods: 25
|
67
|
+
TooManyStatements:
|
68
|
+
enabled: true
|
69
|
+
exclude:
|
70
|
+
- initialize
|
71
|
+
max_statements: 5
|
72
|
+
UncommunicativeMethodName:
|
73
|
+
enabled: true
|
74
|
+
exclude: []
|
75
|
+
reject:
|
76
|
+
- !ruby/regexp /^[a-z]$/
|
77
|
+
- !ruby/regexp /[0-9]$/
|
78
|
+
- !ruby/regexp /[A-Z]/
|
79
|
+
accept: []
|
80
|
+
UncommunicativeModuleName:
|
81
|
+
enabled: true
|
82
|
+
exclude: []
|
83
|
+
reject:
|
84
|
+
- !ruby/regexp /^.$/
|
85
|
+
- !ruby/regexp /[0-9]$/
|
86
|
+
accept:
|
87
|
+
- Inline::C
|
88
|
+
UncommunicativeParameterName:
|
89
|
+
enabled: true
|
90
|
+
exclude: []
|
91
|
+
reject:
|
92
|
+
- !ruby/regexp /^.$/
|
93
|
+
- !ruby/regexp /[0-9]$/
|
94
|
+
- !ruby/regexp /[A-Z]/
|
95
|
+
- !ruby/regexp /^_/
|
96
|
+
accept: []
|
97
|
+
UncommunicativeVariableName:
|
98
|
+
enabled: true
|
99
|
+
exclude: []
|
100
|
+
reject:
|
101
|
+
- !ruby/regexp /^.$/
|
102
|
+
- !ruby/regexp /[0-9]$/
|
103
|
+
- !ruby/regexp /[A-Z]/
|
104
|
+
accept:
|
105
|
+
- _
|
106
|
+
UnusedParameters:
|
107
|
+
enabled: true
|
108
|
+
exclude: []
|
109
|
+
UtilityFunction:
|
110
|
+
enabled: true
|
111
|
+
exclude: []
|
data/config/rubocop.yml
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
---
|
2
|
+
require:
|
3
|
+
- rubocop-rspec
|
4
|
+
- rubocop/devtools
|
5
|
+
inherit_gem:
|
6
|
+
rubocop-devtools: config/default.yml
|
7
|
+
AllCops:
|
8
|
+
Exclude:
|
9
|
+
- vendor/**/*
|
10
|
+
- db/migrate/*
|
11
|
+
DisplayCopNames: true
|
12
|
+
TargetRubyVersion: 2.3
|
13
|
+
# This ends up being too spammy
|
14
|
+
Style/Documentation:
|
15
|
+
Enabled: false
|
16
|
+
Style/ExtraSpacing:
|
17
|
+
AllowForAlignment: true
|
18
|
+
Metrics/LineLength:
|
19
|
+
Max: 100
|
20
|
+
Style/IfUnlessModifier:
|
21
|
+
MaxLineLength: 100
|
22
|
+
Style/Next:
|
23
|
+
EnforcedStyle: always
|
24
|
+
Style/PercentLiteralDelimiters:
|
25
|
+
PreferredDelimiters:
|
26
|
+
'%i': '[]'
|
27
|
+
'%I': '[]'
|
28
|
+
'%q': '{}'
|
29
|
+
'%Q': '{}'
|
30
|
+
'%r': '{}'
|
31
|
+
'%s': ()
|
32
|
+
'%w': '[]'
|
33
|
+
'%W': '[]'
|
34
|
+
'%x': ()
|
35
|
+
Style/TrivialAccessors:
|
36
|
+
ExactNameMatch: false
|
37
|
+
Style/MethodCalledOnDoEndBlock:
|
38
|
+
Enabled: true
|
39
|
+
Style/SymbolArray:
|
40
|
+
Enabled: true
|
41
|
+
Style/BarePercentLiterals:
|
42
|
+
EnforcedStyle: percent_q
|
43
|
+
Style/CollectionMethods:
|
44
|
+
Enabled: true
|
45
|
+
Style/Send:
|
46
|
+
Enabled: true
|
47
|
+
Style/AutoResourceCleanup:
|
48
|
+
Enabled: true
|
49
|
+
Style/FirstArrayElementLineBreak:
|
50
|
+
Enabled: true
|
51
|
+
Style/FirstHashElementLineBreak:
|
52
|
+
Enabled: true
|
53
|
+
Style/FirstMethodArgumentLineBreak:
|
54
|
+
Enabled: true
|
55
|
+
Style/FirstMethodParameterLineBreak:
|
56
|
+
Enabled: true
|
57
|
+
Style/MultilineArrayBraceLayout:
|
58
|
+
Enabled: true
|
59
|
+
Style/MultilineAssignmentLayout:
|
60
|
+
EnforcedStyle: new_line
|
61
|
+
Enabled: true
|
62
|
+
Style/MultilineHashBraceLayout:
|
63
|
+
Enabled: true
|
64
|
+
Style/MultilineMethodCallBraceLayout:
|
65
|
+
Enabled: true
|
66
|
+
Style/MultilineMethodDefinitionBraceLayout:
|
67
|
+
Enabled: true
|
68
|
+
Style/OptionHash:
|
69
|
+
Enabled: true
|
70
|
+
Style/StringMethods:
|
71
|
+
Enabled: true
|
72
|
+
Style/IndentArray:
|
73
|
+
EnforcedStyle: consistent
|
74
|
+
Style/IndentHash:
|
75
|
+
EnforcedStyle: consistent
|
76
|
+
MultilineMethodCallIndentation:
|
77
|
+
EnforcedStyle: indented
|
78
|
+
Style/Alias:
|
79
|
+
EnforcedStyle: prefer_alias_method
|
80
|
+
Style/AlignHash:
|
81
|
+
EnforcedColonStyle: table
|
82
|
+
Style/SignalException:
|
83
|
+
EnforcedStyle: semantic
|
84
|
+
Style/SingleLineBlockParams:
|
85
|
+
Enabled: false
|
86
|
+
RSpec/DescribeClass:
|
87
|
+
Exclude: []
|
88
|
+
RSpec/ExampleLength:
|
89
|
+
Enabled: false
|
90
|
+
RSpec/VerifiedDoubles:
|
91
|
+
IgnoreSymbolicNames: true
|