comptroller 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ module Comptroller
3
3
  include Her::Model
4
4
  use_api BILLING_API
5
5
  collection_path '/duxware_errors'
6
+ include_root_in_json true
6
7
 
7
8
  def eql?(other)
8
9
  id.eql? other.id
@@ -1,3 +1,3 @@
1
1
  module Comptroller
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -3,9 +3,8 @@ require 'socket'
3
3
 
4
4
  class DataManager
5
5
  class << self
6
- def memo
7
- {
8
- 1 => {
6
+ def practices_memo
7
+ { 1 => {
9
8
  id: 1,
10
9
  export_url: "https://optimis.duxware.com",
11
10
  external_id: 3,
@@ -18,12 +17,31 @@ class DataManager
18
17
  }
19
18
  end
20
19
 
20
+ def claim_errors_memo
21
+ { 1 => {
22
+ error_message: 'Send to optimis.duxware.com failed with ERROR: Did not find this ICD code in DB: 729.90',
23
+ external_id: 3,
24
+ id: 1,
25
+ message_body: '<?xml version="1.0" encoding="UTF-8"?><incomingHeader></incomingHeader>',
26
+ record_id: 43334,
27
+ resent_at: nil,
28
+ created_at: "2013-06-13T16:17:02Z",
29
+ updated_at: "2013-06-13T16:17:02Z"
30
+ }
31
+ }
32
+ end
33
+
21
34
  def practices
22
- @practices || memo.dup
35
+ @practices ||= practices_memo.dup
23
36
  end
24
37
 
25
38
  def reset
26
- @practices = memo.dup
39
+ @claim_errors = claim_errors_memo.dup
40
+ @practices = practices_memo.dup
41
+ end
42
+
43
+ def claim_errors
44
+ @claim_errors ||= claim_errors_memo.dup
27
45
  end
28
46
  end
29
47
  end
@@ -71,19 +89,25 @@ Mimic.mimic(:port => Comptroller::Configuration::PORT) do
71
89
  end
72
90
 
73
91
  get '/duxware_errors' do
74
- [200, {}, [{
75
- error_message: 'Send to optimis.duxware.com failed with ERROR: Did not find this ICD code in DB: 729.90',
76
- external_id: 3,
77
- id: 1,
78
- message_body: '<?xml version="1.0" encoding="UTF-8"?><incomingHeader></incomingHeader>',
79
- record_id: 43334,
80
- resent_at: nil,
81
- created_at: "2013-06-13T16:17:02Z",
82
- updated_at: "2013-06-13T16:17:02Z"
83
- }].to_json
84
- ]
92
+ [ 200, {}, DataManager.claim_errors.values.to_json ]
93
+ end
94
+
95
+ get '/duxware_errors/:id' do
96
+ [ 200, {}, DataManager.claim_errors[params[:id].to_i].to_json ]
85
97
  end
86
98
 
99
+ put '/duxware_errors/:id' do
100
+ claim_error = DataManager.claim_errors[params[:id].to_i]
101
+ claim_error.merge!(params[:claim_error])
102
+ [ 200, {}, claim_error.to_json ]
103
+ end
104
+
105
+ delete '/duxware_errors/:id' do
106
+ DataManager.claim_errors[params[:id].to_i]
107
+ deleted_error = DataManager.claim_errors.extract!(params[:id].to_i)[params[:id].to_i]
108
+ [ 200, {}, deleted_error.to_json ]
109
+ end
110
+
87
111
  get '/resets' do
88
112
  DataManager.reset
89
113
  end
@@ -5,5 +5,16 @@ module Comptroller
5
5
  it 'retrieves claim errors' do
6
6
  expect(ClaimError.all.first).to eql(ClaimError.new(:id => 1))
7
7
  end
8
+
9
+ it 'allows deleting of claim errors' do
10
+ error = ClaimError.all.first
11
+ ClaimError.destroy_existing(error.id)
12
+ expect(ClaimError.all).to be_empty
13
+ end
14
+
15
+ it 'allows updating of errors' do
16
+ error = ClaimError.save_existing(1, :message_body => 'foo bar')
17
+ expect(ClaimError.find(1).message_body).to eql('foo bar')
18
+ end
8
19
  end
9
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comptroller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-30 00:00:00.000000000 Z
12
+ date: 2013-08-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: her