change_health 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdc3db789f5792e202e57cac60ca245077fab8659605c09eccc8dd5fe90b1c56
4
- data.tar.gz: 3768e68f35d7b4cda231e4dd0ebecb6ab0b318b727c9c84ea7a21fdd7b48152e
3
+ metadata.gz: ac67086d3b413c76be97296012100a822dc8c803f87c2a36cf66904aef24e9e6
4
+ data.tar.gz: 9bb60539514b873f4f254075d671ad70e93ee5c9d6bc3e0dfc7e34bb385a448a
5
5
  SHA512:
6
- metadata.gz: 8b0a05cc4e1499e369167d8eb10602089943eac19acc5a790da0703445de3648bca2c06da5d672eaae3f34262b0663422ed6543c1fc578e725eeec5cbd9cce3b
7
- data.tar.gz: f7a91483da97c145a89e0ccba01fafc3efe490e31dc4f429a5bafc268c7f37aadb626518152610d4f454cefad8284ac2885f9ed1d7bc20539722dbce34c6a856
6
+ metadata.gz: b68b71dd41df082e4dc349e3fb16da3950805e1f0f767f293ee7c699fe7d1edb960774870cd5b9afb119b8e95194b75c089b4f61bc24644c2c131266b50b0557
7
+ data.tar.gz: ce0c9747de2134e13a404702d0af42ab9555bf3555bf0e712ef6bd731bc187f11b5ecaf49a1f5899c508b383f7cbb9ab03ff047862691cc94c7c1bec21f911b3
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.8.0] - [2020-04-04]
8
+ ### Changed
9
+ - Attemp to serialize all properties with 'date' in the name to ChangeHealth date format
10
+
7
11
  ## [0.7.0] - [2020-04-03]
8
12
  ### Changed
9
13
  - Fixed bug in serializing date on subscriber and encounter
@@ -53,6 +57,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
53
57
  - Authentication
54
58
  - Configuration
55
59
 
60
+ [0.8.0]: https://github.com/WeInfuse/change_health/compare/v0.7.0...v0.8.0
56
61
  [0.7.0]: https://github.com/WeInfuse/change_health/compare/v0.6.0...v0.7.0
57
62
  [0.6.0]: https://github.com/WeInfuse/change_health/compare/v0.5.0...v0.6.0
58
63
  [0.5.0]: https://github.com/WeInfuse/change_health/compare/v0.4.0...v0.5.0
@@ -1,8 +1,6 @@
1
1
  module ChangeHealth
2
2
  module Models
3
- DATE_FORMAT = '%Y%m%d'
4
-
5
- class Encounter < Hashie::Trash
3
+ class Encounter < Model
6
4
  property :beginningDateOfService, from: :beginning_date_of_service, required: false
7
5
  property :dateOfService, from: :date_of_service, required: false
8
6
  property :dateRange, from: :date_range, required: false, default: false
@@ -17,24 +15,6 @@ module ChangeHealth
17
15
  self[:serviceTypeCodes] ||= []
18
16
  self[:serviceTypeCodes] << code
19
17
  end
20
-
21
- def to_h
22
- result = super.to_h
23
-
24
- [:beginningDateOfService, :dateOfService, :endDateOfService].each do |key|
25
- result[key] = result[key].strftime(ChangeHealth::Models::DATE_FORMAT) if result[key].respond_to?(:strftime)
26
- end
27
-
28
- result
29
- end
30
-
31
- def as_json(args = {})
32
- self.to_h
33
- end
34
-
35
- def to_json
36
- self.to_h.to_json
37
- end
38
18
  end
39
19
  end
40
20
  end
@@ -0,0 +1,37 @@
1
+ module ChangeHealth
2
+ module Models
3
+ DATE_FORMAT = '%Y%m%d'
4
+ DATE_FORMATTER = ->(d) {
5
+ begin
6
+ d = Date.parse(d) if d.is_a?(String)
7
+ rescue ArgumentError
8
+ end
9
+
10
+ d = d.strftime(ChangeHealth::Models::DATE_FORMAT) if d.respond_to?(:strftime)
11
+
12
+ d
13
+ }
14
+
15
+ class Model < Hashie::Trash
16
+ def to_h
17
+ result = super.to_h
18
+
19
+ self.class.properties.each do |key|
20
+ if key.to_s.downcase.include?('date')
21
+ result[key] = ChangeHealth::Models::DATE_FORMATTER.call(result[key])
22
+ end
23
+ end
24
+
25
+ result
26
+ end
27
+
28
+ def as_json(args = {})
29
+ self.to_h
30
+ end
31
+
32
+ def to_json
33
+ self.to_h.to_json
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,6 +1,6 @@
1
1
  module ChangeHealth
2
2
  module Models
3
- class Subscriber < Hashie::Trash
3
+ class Subscriber < Model
4
4
  property :additionalIdentification, required: false
5
5
  property :address, required: false
6
6
  property :birthSequenceNumber, from: :birth_sequence_number, required: false
@@ -24,24 +24,6 @@ module ChangeHealth
24
24
  self[:healthCareCodeInformation] ||= []
25
25
  self[:healthCareCodeInformation] << value
26
26
  end
27
-
28
- def to_h
29
- result = super.to_h
30
-
31
- [:dateOfBirth].each do |key|
32
- result[key] = result[key].strftime(ChangeHealth::Models::DATE_FORMAT) if result[key].respond_to?(:strftime)
33
- end
34
-
35
- result
36
- end
37
-
38
- def as_json(args = {})
39
- self.to_h
40
- end
41
-
42
- def to_json
43
- self.to_h.to_json
44
- end
45
27
  end
46
28
  end
47
29
  end
@@ -1,3 +1,3 @@
1
1
  module ChangeHealth
2
- VERSION = '0.7.0'.freeze
2
+ VERSION = '0.8.0'.freeze
3
3
  end
data/lib/change_health.rb CHANGED
@@ -4,6 +4,7 @@ require 'change_health/version'
4
4
  require 'change_health/change_health_exception'
5
5
  require 'change_health/connection'
6
6
  require 'change_health/authentication'
7
+ require 'change_health/models/model'
7
8
  require 'change_health/models/eligibility'
8
9
  require 'change_health/models/eligibility_data'
9
10
  require 'change_health/models/eligibility_benefit'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: change_health
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Crockett
@@ -151,6 +151,7 @@ files:
151
151
  - lib/change_health/models/eligibility_benefits.rb
152
152
  - lib/change_health/models/eligibility_data.rb
153
153
  - lib/change_health/models/encounter.rb
154
+ - lib/change_health/models/model.rb
154
155
  - lib/change_health/models/provider.rb
155
156
  - lib/change_health/models/subscriber.rb
156
157
  - lib/change_health/version.rb