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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74a51ed4639bd18abf242c7f5c0d76b61dcb7fe2051e51aa6bd7b8914af2972d
4
- data.tar.gz: 15b855a1e7601e67814cdc48f585e923eecc0e65c8518fce695efa767da452ed
3
+ metadata.gz: 1cc425d50c41a6f6be90940531a7801699118799ef674aa9368e031f092d8a46
4
+ data.tar.gz: 3fc04b3dff898b8479ffcc4f81ed5653be2395396049b873fb3aafe5b2876df5
5
5
  SHA512:
6
- metadata.gz: 5facb03788dbadd423440d14f509f1bc4c2f0a7d6ddd099a06a05cc1d4805829ddd8975ac1a8698fefd6062e9662382f2db5c5b63409361122f43966a20aebbe
7
- data.tar.gz: 4e17dc30ee815093201d9c17919c0970c38032475592da3e381a99665117c20e29df3d2192c272213588cd0cc658a3facb8b48821891e032ad155effde2c8ad9
6
+ metadata.gz: 5e99b11e1efe1234256b14e0dbb6b9e3573994227a0bc8bba9977215c8e51971e49ab0554f1f654b12016eb61d33c16ac89fc2340bcc822ae478e76f41e61e3a
7
+ data.tar.gz: cd849bb040aea14f5114070da3722151d72f1413e0c6fbcc4e8d3d3a621dde645a7126744d4ca24905a0e98a1eecf357078ff9c65ad2d2e1b7b6412bb756003a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nds_api (0.1.9)
4
+ nds_api (0.1.11)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -69,7 +69,6 @@ nds.client_by_id(id)
69
69
  ##### CHILDREN
70
70
 
71
71
  ```ruby
72
-
73
72
  nds.create_child(data)
74
73
  nds.update_child(data)
75
74
 
@@ -1,8 +1,8 @@
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"
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, &block)
34
- if @method.is_create? or @method.is_search?
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? and query_params
48
+ if @method.is_search? && query_params
49
49
  @url.send(@method.action, query_params)
50
50
  else
51
51
  @url.send(@method.action)
@@ -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 GEM: Agency Key required' unless @options[:agency_key]
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
- "https://uatup.naccrraware.net/nds-api"
170
+ 'https://uatup.naccrraware.net/nds-api'
155
171
  else
156
- "http://staging-nds-api-app.emrcsv38cq.us-east-1.elasticbeanstalk.com"
172
+ 'http://staging-nds-api-app.emrcsv38cq.us-east-1.elasticbeanstalk.com'
157
173
  end
158
174
  end
159
175
  end
@@ -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.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
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
@@ -1,3 +1,3 @@
1
1
  module NdsApi
2
- VERSION = '0.1.9'.freeze
2
+ VERSION = '0.1.11'.freeze
3
3
  end
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.9
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-07-27 00:00:00.000000000 Z
11
+ date: 2018-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler