nds_api 0.1.9 → 0.1.11
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/Gemfile.lock +1 -1
- data/README.md +0 -1
- data/lib/nds_api.rb +8 -8
- data/lib/nds_api/url.rb +21 -5
- data/lib/nds_api/utils.rb +1 -3
- data/lib/nds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cc425d50c41a6f6be90940531a7801699118799ef674aa9368e031f092d8a46
|
4
|
+
data.tar.gz: 3fc04b3dff898b8479ffcc4f81ed5653be2395396049b873fb3aafe5b2876df5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e99b11e1efe1234256b14e0dbb6b9e3573994227a0bc8bba9977215c8e51971e49ab0554f1f654b12016eb61d33c16ac89fc2340bcc822ae478e76f41e61e3a
|
7
|
+
data.tar.gz: cd849bb040aea14f5114070da3722151d72f1413e0c6fbcc4e8d3d3a621dde645a7126744d4ca24905a0e98a1eecf357078ff9c65ad2d2e1b7b6412bb756003a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/nds_api.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require 'nds_api/http'
|
2
|
+
require 'nds_api/method'
|
3
|
+
require 'nds_api/url'
|
4
|
+
require 'nds_api/utils'
|
5
|
+
require 'nds_api/version'
|
6
6
|
|
7
7
|
module NdsApi
|
8
8
|
class Client
|
@@ -30,8 +30,8 @@ module NdsApi
|
|
30
30
|
|
31
31
|
private
|
32
32
|
|
33
|
-
def http_action(method, *args
|
34
|
-
if @method.is_create?
|
33
|
+
def http_action(method, *args)
|
34
|
+
if @method.is_create? || @method.is_search?
|
35
35
|
@http.post(url, data)
|
36
36
|
elsif @method.is_update?
|
37
37
|
@http.put(url, data)
|
@@ -45,7 +45,7 @@ module NdsApi
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def url
|
48
|
-
if @method.is_search?
|
48
|
+
if @method.is_search? && query_params
|
49
49
|
@url.send(@method.action, query_params)
|
50
50
|
else
|
51
51
|
@url.send(@method.action)
|
data/lib/nds_api/url.rb
CHANGED
@@ -7,8 +7,8 @@ module NdsApi
|
|
7
7
|
|
8
8
|
##### Agency #####
|
9
9
|
|
10
|
-
def get_agency_option(type_id=nil)
|
11
|
-
raise 'NDS API
|
10
|
+
def get_agency_option(type_id = nil)
|
11
|
+
raise 'NDS API ERROR: Agency Key required' unless @options[:agency_key]
|
12
12
|
"#{base_url}/agencies/config/options?agencyKey=#{@options[:agency_key]}#{type_id ? "&typeId=#{type_id}" : ''}"
|
13
13
|
end
|
14
14
|
|
@@ -72,7 +72,7 @@ module NdsApi
|
|
72
72
|
|
73
73
|
##### PROVIDERS #####
|
74
74
|
|
75
|
-
def search_providers(params=nil)
|
75
|
+
def search_providers(params = nil)
|
76
76
|
params = URI.encode_www_form(params) if params
|
77
77
|
"#{providers}/search/findByCriteriaObject#{params ? "?#{params}" : ''}"
|
78
78
|
end
|
@@ -137,6 +137,22 @@ module NdsApi
|
|
137
137
|
|
138
138
|
private
|
139
139
|
|
140
|
+
# cover: "create_XXXXXX", "update_XXXXXX"
|
141
|
+
def method_missing(method_sym, *arguments, &block)
|
142
|
+
create_prefix = 'create_'
|
143
|
+
update_prefix = 'update_'
|
144
|
+
|
145
|
+
prefix = create_prefix if method_sym[0..create_prefix.length - 1] == create_prefix
|
146
|
+
prefix = update_prefix if method_sym[0..update_prefix.length - 1] == update_prefix
|
147
|
+
|
148
|
+
if method_sym[0..prefix.length - 1] == prefix
|
149
|
+
entities = method_sym[prefix.length..method_sym.length]
|
150
|
+
send(entities)
|
151
|
+
else
|
152
|
+
super
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
140
156
|
def client_search
|
141
157
|
"#{clients}/search"
|
142
158
|
end
|
@@ -151,9 +167,9 @@ module NdsApi
|
|
151
167
|
|
152
168
|
def base_url
|
153
169
|
if @prod
|
154
|
-
|
170
|
+
'https://uatup.naccrraware.net/nds-api'
|
155
171
|
else
|
156
|
-
|
172
|
+
'http://staging-nds-api-app.emrcsv38cq.us-east-1.elasticbeanstalk.com'
|
157
173
|
end
|
158
174
|
end
|
159
175
|
end
|
data/lib/nds_api/utils.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
module NdsApi
|
2
2
|
module Utils
|
3
3
|
class << self
|
4
|
-
|
5
4
|
def hash_keys_str_to_sym(hash)
|
6
5
|
return hash unless hash.is_a? Hash
|
7
|
-
hash.
|
6
|
+
hash.each_with_object({}) { |(k, v), memo| memo[k.to_sym] = v; }
|
8
7
|
end
|
9
|
-
|
10
8
|
end
|
11
9
|
end
|
12
10
|
end
|
data/lib/nds_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nds_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pierre Hunault
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|