nds_api 0.1.5 → 0.1.6
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/lib/nds_api.rb +15 -2
- data/lib/nds_api/url.rb +3 -2
- data/lib/nds_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: e7ca4a2079243da2fe7123d2de759230ea82963c4520360d81dfe0dee91f111b
|
4
|
+
data.tar.gz: aa7a03973f2e83b144fd57fec833c8c08ceea33f6cbac9e830c605ea0439512a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35604effc3ee1d332b2a9f42fe875ac2758cf1e3a8fd0efcf62eeab346d5caa0698783f3d5eb119090c84716e3623689867542337dba2c1d9893071b68653f28
|
7
|
+
data.tar.gz: a1b31a6092f30d7e5062dd040669eb8bf37df1dc57a922e7d6f84f220fe9f23e2bd1366e8710e3e0ffa149113ce2acc4987cec99b72ff60d79d11c34074647ea
|
data/Gemfile.lock
CHANGED
data/lib/nds_api.rb
CHANGED
@@ -11,6 +11,7 @@ module NdsApi
|
|
11
11
|
# @param [Hash] options
|
12
12
|
# @option options [String] :user NDS User
|
13
13
|
# @option options [String] :password NDS Password
|
14
|
+
# @option options [String] :agency_key NDS Agency Key
|
14
15
|
#
|
15
16
|
# @return [NdsApi::Client] new client instance
|
16
17
|
|
@@ -31,9 +32,9 @@ module NdsApi
|
|
31
32
|
|
32
33
|
def http_action(method, *args, &block)
|
33
34
|
if @method.is_create? or @method.is_search?
|
34
|
-
@http.post(
|
35
|
+
@http.post(url, data)
|
35
36
|
elsif @method.is_update?
|
36
|
-
@http.put(
|
37
|
+
@http.put(url, data)
|
37
38
|
else
|
38
39
|
@http.get(@url.send(method, *args))
|
39
40
|
end
|
@@ -42,5 +43,17 @@ module NdsApi
|
|
42
43
|
def data
|
43
44
|
@args.include?(:data) ? @args[:data] : @args.first
|
44
45
|
end
|
46
|
+
|
47
|
+
def url
|
48
|
+
if @method.is_search? and query_params
|
49
|
+
@url.send(@method.action, query_params)
|
50
|
+
else
|
51
|
+
@url.send(@method.action)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def query_params
|
56
|
+
@args.count > 1 ? @args[1] : nil
|
57
|
+
end
|
45
58
|
end
|
46
59
|
end
|
data/lib/nds_api/url.rb
CHANGED
@@ -72,11 +72,12 @@ module NdsApi
|
|
72
72
|
|
73
73
|
##### PROVIDERS #####
|
74
74
|
|
75
|
-
def search_providers
|
75
|
+
def search_providers(params=nil)
|
76
76
|
# stg_search = 'http://staging-nds-api-app.emrcsv38cq.us-east-1.elasticbeanstalk.com/providers/search/findByCriteriaObject'
|
77
77
|
# prod_search = 'http://staging-nds-api-app.emrcsv38cq.us-east-1.elasticbeanstalk.com/providers/search/findByCriteriaObject'
|
78
78
|
# @prod ? prod_search : stg_search
|
79
|
-
|
79
|
+
params = URI.encode_www_form(params) if params
|
80
|
+
"http://staging-nds-api-app.emrcsv38cq.us-east-1.elasticbeanstalk.com/providers/search/findByCriteriaObject#{params ? "?#{params}" : ''}"
|
80
81
|
end
|
81
82
|
|
82
83
|
def providers
|
data/lib/nds_api/version.rb
CHANGED