identity-mind 0.1.0 → 0.2.0
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/CHANGELOG.md +6 -0
- data/lib/identity_mind.rb +10 -3
- data/lib/identity_mind/entity.rb +1 -1
- data/lib/identity_mind/params.rb +55 -0
- data/lib/identity_mind/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36107bda05bc43b5019cb38c4d0bcdd055ad484c603cdf445ed02d9d2d04ed8c
|
4
|
+
data.tar.gz: abc2f2d06e02828941e8a2db8c60fef8369b153f01ea7b6e5f739d1094d063c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85ba208261f31efc1d83ebd1feb51ab3a7799f7821042c2c771f94f3dc768d0d4e27bdff2976a556a717ae08a14bef424ffb97d657fa13ed44e1868fd4436f08
|
7
|
+
data.tar.gz: 70eb05a4f23f43af056fa36168d4117ba17219c06b302b641b6dca739d9aaecb3259ec6c5c0ebbccd5e8b8b347733f345aa031da5c8e096ba585fd036acc6998
|
data/CHANGELOG.md
ADDED
data/lib/identity_mind.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'httparty'
|
3
3
|
require 'identity_mind/version'
|
4
|
+
require 'identity_mind/params'
|
4
5
|
require 'identity_mind/response_error'
|
5
6
|
require 'identity_mind/entity'
|
6
7
|
require 'identity_mind/account'
|
@@ -27,6 +28,14 @@ module IdentityMind
|
|
27
28
|
true
|
28
29
|
end
|
29
30
|
|
31
|
+
def load_default_configuration
|
32
|
+
@configuration = nil
|
33
|
+
configure do |config|
|
34
|
+
config.base_uri = 'https://edna.identitymind.com'
|
35
|
+
config.param_length_limit = 128
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
30
39
|
def perform_request(http_method, path, options, &block)
|
31
40
|
result = super
|
32
41
|
return result if result.success?
|
@@ -35,7 +44,5 @@ module IdentityMind
|
|
35
44
|
end
|
36
45
|
end
|
37
46
|
|
38
|
-
|
39
|
-
config.base_uri = 'https://edna.identitymind.com'
|
40
|
-
end
|
47
|
+
load_default_configuration
|
41
48
|
end
|
data/lib/identity_mind/entity.rb
CHANGED
@@ -0,0 +1,55 @@
|
|
1
|
+
module IdentityMind
|
2
|
+
class Params < OpenStruct
|
3
|
+
def self.[](hash)
|
4
|
+
return hash if hash.is_a?(self)
|
5
|
+
|
6
|
+
new(hash)
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(hash = nil)
|
10
|
+
@table = {}
|
11
|
+
return unless hash
|
12
|
+
|
13
|
+
hash.each_pair do |k, v|
|
14
|
+
@table[k.to_sym] = parse_param(v)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def []=(name, value)
|
19
|
+
super(name, parse_param(value))
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_json(opts = {})
|
23
|
+
@table.to_json(opts)
|
24
|
+
end
|
25
|
+
|
26
|
+
def method_missing(mid, *args)
|
27
|
+
args[0] = parse_param(args[0]) if args[0]
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def respond_to_missing?(method_name, include_private = false)
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def new_ostruct_member!(name)
|
38
|
+
name = name.to_sym
|
39
|
+
unless singleton_class.method_defined?(name)
|
40
|
+
define_singleton_method(name) { @table[name] }
|
41
|
+
define_singleton_method("#{name}=") do |x|
|
42
|
+
modifiable?[name] = parse_param(x)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
name
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse_param(value)
|
49
|
+
value = value.to_s if value.is_a?(Symbol)
|
50
|
+
return value unless value.is_a?(String)
|
51
|
+
|
52
|
+
value[0, IdentityMind.configuration.param_length_limit]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: identity-mind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wojciech Widenka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- ".rspec"
|
92
92
|
- ".rubocop.yml"
|
93
93
|
- ".travis.yml"
|
94
|
+
- CHANGELOG.md
|
94
95
|
- Gemfile
|
95
96
|
- README.md
|
96
97
|
- Rakefile
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
- lib/identity_mind.rb
|
101
102
|
- lib/identity_mind/account.rb
|
102
103
|
- lib/identity_mind/entity.rb
|
104
|
+
- lib/identity_mind/params.rb
|
103
105
|
- lib/identity_mind/response_error.rb
|
104
106
|
- lib/identity_mind/version.rb
|
105
107
|
homepage: https://github.com/BankToTheFuture/identity_mind_ruby
|