nds_api 0.1.18 → 0.1.19

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
- SHA1:
3
- metadata.gz: c8928fce359d00064e649f7963733a6df41654a1
4
- data.tar.gz: 060d40a0f38dcf6f2539acdbdb53fafef5b62ea0
2
+ SHA256:
3
+ metadata.gz: eac1bcebe1a40589148c9a099a23517acd4c165f2b95e7aa2f90c4b00e809ab4
4
+ data.tar.gz: b4f61f63d91812e135ba15ea8539af32c2379b241746cd36e3491f5fb52b7d0e
5
5
  SHA512:
6
- metadata.gz: '040878a8af8655282efb1e0ba3f8daeb9c4c99adea10006c1b82d89f134d6453c563cdae9868a536c24c0dbe065d9e928c93e1601c43936892a6a3642590bc34'
7
- data.tar.gz: 2b31eec632ff0d18fbded70292d90030330275754a02206fec49a71d80083dc01ad177ac4f4ca0a38f287ba7377e609b99141a4f40d9f83198e0e142b1669f5f
6
+ metadata.gz: 5ed4831d0c8032beef109b0a612a270979e112b1240f1232dad354d80eccb8dad88d19547397767a20a6e802cc6a0cb7d6e7358bae9a4951568c352a06e465cb
7
+ data.tar.gz: '09eb16e7b31c480328650faea1bb11884c2021c8b1e2637387b05fb47bc287036229b627c7cc3a05613fb0c89a58886fa97240f3d8e4fa13eb8b241b3b010f6d'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nds_api (0.1.18)
4
+ nds_api (0.1.19)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,6 +2,7 @@ require 'nds_api/http'
2
2
  require 'nds_api/method'
3
3
  require 'nds_api/url'
4
4
  require 'nds_api/utils'
5
+ require 'nds_api/validator'
5
6
  require 'nds_api/version'
6
7
 
7
8
  module NdsApi
@@ -25,6 +26,9 @@ module NdsApi
25
26
  def method_missing(method, *args, &block)
26
27
  @method = NdsApi::Method.new(method)
27
28
  @args = *args
29
+
30
+ validate_search_providers_params!
31
+
28
32
  console_debug(step: 1)
29
33
  @response = http_action(method, *args, &block)
30
34
  console_debug(step: 2)
@@ -60,6 +64,12 @@ module NdsApi
60
64
  @args.count > 1 ? @args[1] : nil
61
65
  end
62
66
 
67
+ def validate_search_providers_params!
68
+ return unless @method.is_search_providers?
69
+ console_debug(action: 'search_providers - validating params')
70
+ NdsApi::Validator.validate_search_providers_params!(data)
71
+ end
72
+
63
73
  def console_debug(params)
64
74
  return unless @options[:debug]
65
75
  if params[:step] == 1
@@ -75,6 +85,7 @@ module NdsApi
75
85
  end
76
86
  puts "NDS API DEBUG: RESPONSE: #{@response.inspect}" if params[:step] == 2
77
87
  puts "NDS API DEBUG: URL: #{params[:url]}" if params[:url]
88
+ puts "NDS API DEBUG: ACTION: #{params[:action]}" if params[:action]
78
89
  end
79
90
  end
80
91
  end
@@ -21,6 +21,10 @@ module NdsApi
21
21
  @method.include? 'search'
22
22
  end
23
23
 
24
+ def is_search_providers?
25
+ @method.include? 'search_providers'
26
+ end
27
+
24
28
  def action
25
29
  action = method_split[0]
26
30
  object_type =
@@ -38,7 +42,7 @@ module NdsApi
38
42
  when 'providers'
39
43
  'providers'
40
44
  end
41
- "#{action}_#{object_type}#{method_split[2].present? ? "_#{method_split[2]}" : ''}"
45
+ "#{action}_#{object_type}#{method_split[2] ? "_#{method_split[2]}" : ''}"
42
46
  end
43
47
 
44
48
  private
@@ -0,0 +1,60 @@
1
+ module NdsApi
2
+ module Validator
3
+ class << self
4
+ def validate_search_providers_params!(params)
5
+ raise "NDS API ERROR: Invalid params: #{invalid_params(params).join(' - ')}" unless invalid_params(params).empty?
6
+ end
7
+
8
+ private
9
+
10
+ def invalid_params(params)
11
+ invalid_params = []
12
+ if params
13
+ params.keys.each do |param|
14
+ invalid_params << param unless is_valid_field?(param)
15
+ end
16
+ end
17
+ invalid_params
18
+ end
19
+
20
+ def is_valid_field?(field)
21
+ valid_fields.include?(field.to_s)
22
+ end
23
+
24
+ def valid_fields
25
+ %w[agesServiced
26
+ ageGroups
27
+ locationA
28
+ locationB
29
+ distance
30
+ zips
31
+ attributesLocal17
32
+ typesOfCare
33
+ shiftType
34
+ acceptsChildren
35
+ yearlySchedule
36
+ weeklySchedule
37
+ dailySchedule
38
+ financialAssist
39
+ languages
40
+ attributesLocal3
41
+ generalLocal1
42
+ generalLocal2
43
+ totalVacancies
44
+ vacanciesByAge
45
+ vacancyDateRange
46
+ meals
47
+ environment
48
+ weeklyRate
49
+ monthtlyRate
50
+ beforeSchool
51
+ afterSchool
52
+ acceptsDropIns
53
+ rotating
54
+ openHolidays
55
+ tempEmergency
56
+ open24Hours]
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,3 +1,3 @@
1
1
  module NdsApi
2
- VERSION = '0.1.18'.freeze
2
+ VERSION = '0.1.19'.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.18
4
+ version: 0.1.19
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-10-10 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,6 +63,7 @@ files:
63
63
  - lib/nds_api/method.rb
64
64
  - lib/nds_api/url.rb
65
65
  - lib/nds_api/utils.rb
66
+ - lib/nds_api/validator.rb
66
67
  - lib/nds_api/version.rb
67
68
  - nds_api.gemspec
68
69
  homepage: http://exygy.com
@@ -85,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
86
  version: '0'
86
87
  requirements: []
87
88
  rubyforge_project:
88
- rubygems_version: 2.6.14
89
+ rubygems_version: 2.7.7
89
90
  signing_key:
90
91
  specification_version: 4
91
92
  summary: NDS API is a Rubygem for easy interface with the NDS API. https://developer.uatup.naccrraware.net/