redox 1.0.2 → 1.1.0

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: 723ef1a6761a8bc29b184b6ce436cab1efd9bc397bc51b7907fa8692421ba8ba
4
- data.tar.gz: e45806f7bd77025ee3d060ee4c4663aa462cc0b2554042b33110f1df76f85b27
3
+ metadata.gz: 451221082b696c7421fa2feacde94c0235bbd78348c416d904cba8df3d1ff67b
4
+ data.tar.gz: 9934ade2a99d85628444a8845b15bf14c79cb595f1307da196d57d1faa2a2668
5
5
  SHA512:
6
- metadata.gz: ea1863fe78f915a3ae082963dbd56dbb2501759e2f2a0ab99b622b7925febe209f33a212a700c0a48415b1464b46715941d8f95869c6811fc0cb1fddceb7ddb2
7
- data.tar.gz: d4ed45942181735d43c458193a5cc39890d222f07168cbeec593531b0b7647c3c222686f1f738c4d80b5d091f3aa4c6a1df16186d22662bec6e951f650dca092
6
+ metadata.gz: 192db714b76ee2a5d197577e21c2907f50d211667b1d16f7ee468af71196655da67fc593771e1f713419bc5a382e8b196b315660dba62c4563ee553bc9581e8d
7
+ data.tar.gz: 2f72e880e360b4d74e6b8b27b25baf0f9a4bb867615723afa9c40089d1a4debaf42c96aa6ee5997f2bc432d315bcbd6c02d9612c9f73aa096dffed1e6cb18cb9
@@ -4,11 +4,16 @@ 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
- ## [1.x.x] - UNRELEASED
7
+ ## [1.1.0] - 2020-06-15
8
8
  ### Changed
9
- - None
9
+ - Moving to Requst classes instead of mixing in logic to models (kept backwards compatibility)
10
+ - Added potential matches to responses and implemented for patient search
10
11
 
11
- ## [1.0.2] - UNRELEASED
12
+ =======
13
+ ### Added
14
+ - PotentialMatches class
15
+
16
+ ## [1.0.2] - 2019-06-04
12
17
  ### Changed
13
18
  - Added Extensions to all Redox models
14
19
  - Fixed warnings in gemspec
@@ -89,7 +94,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
89
94
  ### Added
90
95
  - Initial Release
91
96
 
92
- [Unreleased]: https://github.com/WeInfuse/redox/compare/v1.0.2...HEAD
97
+ [1.1.0]: https://github.com/WeInfuse/redox/compare/v1.0.2...v1.1.0
93
98
  [1.0.2]: https://github.com/WeInfuse/redox/compare/v1.0.1...v1.0.2
94
99
  [1.0.1]: https://github.com/WeInfuse/redox/compare/v1.0.0...v1.0.1
95
100
  [1.0.0]: https://github.com/WeInfuse/redox/compare/v0.1.6...v1.0.0
@@ -11,6 +11,9 @@ require 'redox/models/patient/demographics'
11
11
  require 'redox/models/patient/identifier'
12
12
  require 'redox/models/patient/insurance'
13
13
  require 'redox/models/patient/p_c_p'
14
+ require 'redox/models/potential_matches'
15
+ require 'redox/request/patient_admin'
16
+ require 'redox/request/patient_search'
14
17
 
15
18
  module Redox
16
19
  class Configuration
@@ -6,9 +6,11 @@ module Redox
6
6
 
7
7
  property :Meta, from: :meta, required: false
8
8
  property :Patient, from: :patient, required: false
9
+ property :PotentialMatches, from: :potential_matches, required: false
9
10
  property :Extensions, from: :extensions, required: false
10
11
  property :response, required: false
11
12
 
13
+ alias_method :potential_matches, :PotentialMatches
12
14
  alias_method :patient, :Patient
13
15
  alias_method :meta, :Meta
14
16
 
@@ -37,7 +39,7 @@ module Redox
37
39
  model = Model.new
38
40
  model.response = response
39
41
 
40
- %w[Meta Patient].each do |k|
42
+ %w[Meta Patient PotentialMatches].each do |k|
41
43
  begin
42
44
  model.send("#{k}=", Module.const_get("Redox::Models::#{k}").new(response[k])) if response[k]
43
45
  rescue
@@ -1,11 +1,6 @@
1
1
  module Redox
2
2
  module Models
3
3
  class Patient < Model
4
- QUERY_ENDPOINT = '/query'.freeze
5
- QUERY_META = Meta.new(EventType: 'Query', DataModel: 'PatientSearch')
6
- CREATE_META = Meta.new(EventType: 'NewPatient', DataModel: 'PatientAdmin')
7
- UPDATE_META = Meta.new(EventType: 'PatientUpdate', DataModel: 'PatientAdmin')
8
-
9
4
  property :Identifiers, from: :identifiers, required: false, default: []
10
5
  property :Insurances, from: :insurances, required: false, default: []
11
6
  property :Demographics, from: :demographics, required: false
@@ -40,25 +35,16 @@ module Redox
40
35
  end
41
36
 
42
37
  def update(meta: Meta.new)
43
- meta = UPDATE_META.merge(meta)
44
- return Model.from_response((RedoxClient.connection.request(body: Patient.body(self, meta))))
38
+ Redox::Request::PatientAdmin.update(patient: self, meta: meta)
45
39
  end
46
40
 
47
41
  def create(meta: Meta.new)
48
- meta = CREATE_META.merge(meta)
49
- return Model.from_response((RedoxClient.connection.request(body: Patient.body(self, meta))))
42
+ Redox::Request::PatientAdmin.create(patient: self, meta: meta)
50
43
  end
51
44
 
52
45
  class << self
53
46
  def query(params, meta: Meta.new)
54
- meta = QUERY_META.merge(meta)
55
- return Model.from_response((RedoxClient.connection.request(endpoint: QUERY_ENDPOINT, body: Patient.body(params, meta))))
56
- end
57
-
58
- def body(params, meta)
59
- meta = Meta.new.merge(meta)
60
-
61
- return meta.to_h.merge(params.to_h)
47
+ return Redox::Request::PatientSearch.query(params, meta: meta)
62
48
  end
63
49
  end
64
50
  end
@@ -0,0 +1,13 @@
1
+ module Redox
2
+ module Models
3
+ class PotentialMatches < Array
4
+ def initialize(data = [])
5
+ if false == data.nil?
6
+ super(data.map {|patient| Redox::Models::Patient.new(patient) })
7
+ else
8
+ super([])
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ module Redox
2
+ module Request
3
+ class PatientAdmin
4
+ CREATE_META = Redox::Models::Meta.new(EventType: 'NewPatient', DataModel: 'PatientAdmin')
5
+ UPDATE_META = Redox::Models::Meta.new(EventType: 'PatientUpdate', DataModel: 'PatientAdmin')
6
+
7
+ def self.create(patient: p, meta: Redox::Models::Meta.new)
8
+ meta = CREATE_META.merge(meta)
9
+ return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request::PatientAdmin.build_body(p, meta))))
10
+ end
11
+
12
+ def self.update(patient: p, meta: Redox::Models::Meta.new)
13
+ meta = UPDATE_META.merge(meta)
14
+ return Redox::Models::Model.from_response((RedoxClient.connection.request(body: Redox::Request::PatientAdmin.build_body(p, meta))))
15
+ end
16
+
17
+ def self.build_body(params, meta)
18
+ meta = Redox::Models::Meta.new.merge(meta)
19
+
20
+ return meta.to_h.merge(params.to_h)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,13 @@
1
+ module Redox
2
+ module Request
3
+ class PatientSearch
4
+ QUERY_ENDPOINT = '/query'.freeze
5
+ QUERY_META = Redox::Models::Meta.new(EventType: 'Query', DataModel: 'PatientSearch')
6
+
7
+ def self.query(params, meta: Redox::Models::Meta.new)
8
+ meta = QUERY_META.merge(meta)
9
+ return Redox::Models::Model.from_response((RedoxClient.connection.request(endpoint: QUERY_ENDPOINT, body: Redox::Request::PatientAdmin.build_body(params, meta))))
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Redox
2
- VERSION = '1.0.2'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Clark
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-06-04 00:00:00.000000000 Z
12
+ date: 2020-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -152,7 +152,10 @@ files:
152
152
  - lib/redox/models/patient/identifier.rb
153
153
  - lib/redox/models/patient/insurance.rb
154
154
  - lib/redox/models/patient/p_c_p.rb
155
+ - lib/redox/models/potential_matches.rb
155
156
  - lib/redox/redox_exception.rb
157
+ - lib/redox/request/patient_admin.rb
158
+ - lib/redox/request/patient_search.rb
156
159
  - lib/redox/version.rb
157
160
  - redox.gemspec
158
161
  homepage: https://github.com/WeInfuse/redox