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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bede4a8506fc380d9bd6d63df20bb578c490f456bdd457eec5f4d345c400f950
4
- data.tar.gz: 900b97a2513d62b0d005b9b35314b5ef6ead66175236426207ad1722576243de
3
+ metadata.gz: e7ca4a2079243da2fe7123d2de759230ea82963c4520360d81dfe0dee91f111b
4
+ data.tar.gz: aa7a03973f2e83b144fd57fec833c8c08ceea33f6cbac9e830c605ea0439512a
5
5
  SHA512:
6
- metadata.gz: cfd85e34d774dcb55810fdef033cc63cdf4b8f966e5aa76ba0a8cc6ef7ab9448b1a3c02ed8d0ae595d762f750765102838c27c406e7e1711e76675737074aa13
7
- data.tar.gz: 0fe689193d5692ee11a4e40ac75510ff51d6d9d85c7d06f685036de85ad8c1a88ab0e349f87e3a1a1950285b4dd136d92de01d6a931535cb68c5bee5e011e02c
6
+ metadata.gz: 35604effc3ee1d332b2a9f42fe875ac2758cf1e3a8fd0efcf62eeab346d5caa0698783f3d5eb119090c84716e3623689867542337dba2c1d9893071b68653f28
7
+ data.tar.gz: a1b31a6092f30d7e5062dd040669eb8bf37df1dc57a922e7d6f84f220fe9f23e2bd1366e8710e3e0ffa149113ce2acc4987cec99b72ff60d79d11c34074647ea
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nds_api (0.1.5)
4
+ nds_api (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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(@url.send(@method.action), data)
35
+ @http.post(url, data)
35
36
  elsif @method.is_update?
36
- @http.put(@url.send(@method.action), data)
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
@@ -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
- 'http://staging-nds-api-app.emrcsv38cq.us-east-1.elasticbeanstalk.com/providers/search/findByCriteriaObject'
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
@@ -1,3 +1,3 @@
1
1
  module NdsApi
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nds_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Hunault