usps-imis-api 0.6.9 → 0.6.10
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/usps/imis/mock.rb +23 -0
- data/lib/usps/imis/version.rb +1 -1
- data/lib/usps/imis.rb +1 -0
- data/spec/lib/usps/imis/mock_spec.rb +28 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5103e3c7de24d79be7d86bfd21883d572d5cc88f6c58509973ab2bcce3d99202
|
|
4
|
+
data.tar.gz: 1e96b2dbf536e4205f2fb721ddba91cd2640af1893c30db3d911fea6824b6ea9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53fa63489cda9a6dd09401605daf22329cad3a6f2f3313b068eb3ecd339d9ceff518134305601a2591451acdd03723f566096cb2bcc754c90da03d79d32de315
|
|
7
|
+
data.tar.gz: df0052735b664cc91e4d4b923b1c7ecffe065acc44d320624cc84e834607f557df7c3c39b04cc95410642de07df665da56700c9d543be3cb0f15e1644bf12f15
|
data/Gemfile.lock
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Usps
|
|
4
|
+
module Imis
|
|
5
|
+
# Mock data response for testing
|
|
6
|
+
#
|
|
7
|
+
class Mock
|
|
8
|
+
attr_reader :fields
|
|
9
|
+
|
|
10
|
+
def initialize(**fields)
|
|
11
|
+
@fields = fields.transform_keys(&:to_s)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def get_field(name) = fields[name]
|
|
15
|
+
|
|
16
|
+
def get
|
|
17
|
+
Usps::Imis::Properties.build do |props|
|
|
18
|
+
fields.each { |name, value| props.add(name, value) }
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/usps/imis/version.rb
CHANGED
data/lib/usps/imis.rb
CHANGED
|
@@ -23,6 +23,7 @@ require_relative 'imis/business_object'
|
|
|
23
23
|
require_relative 'imis/api'
|
|
24
24
|
require_relative 'imis/mapper'
|
|
25
25
|
require_relative 'imis/properties'
|
|
26
|
+
require_relative 'imis/mock'
|
|
26
27
|
require_relative 'imis/panel/base_panel'
|
|
27
28
|
require_relative 'imis/panel/vsc'
|
|
28
29
|
require_relative 'imis/panel/education'
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
describe Usps::Imis::Mock do
|
|
6
|
+
let(:mock) { described_class.new(**fields) }
|
|
7
|
+
let(:fields) { { TotMMS: 2 } }
|
|
8
|
+
|
|
9
|
+
describe 'get' do
|
|
10
|
+
it 'returns the correct Properties data' do
|
|
11
|
+
expect(mock.get).to eq(
|
|
12
|
+
'Properties' => {
|
|
13
|
+
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts',
|
|
14
|
+
'$values' => [
|
|
15
|
+
{
|
|
16
|
+
'$type' => 'Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts',
|
|
17
|
+
'Name' => 'TotMMS',
|
|
18
|
+
'Value' => {
|
|
19
|
+
'$type' => 'System.Int32',
|
|
20
|
+
'$value' => 2
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usps-imis-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Fiander
|
|
@@ -50,6 +50,7 @@ files:
|
|
|
50
50
|
- lib/usps/imis/error/mapper_error.rb
|
|
51
51
|
- lib/usps/imis/error/response_error.rb
|
|
52
52
|
- lib/usps/imis/mapper.rb
|
|
53
|
+
- lib/usps/imis/mock.rb
|
|
53
54
|
- lib/usps/imis/panel/base_panel.rb
|
|
54
55
|
- lib/usps/imis/panel/education.rb
|
|
55
56
|
- lib/usps/imis/panel/vsc.rb
|
|
@@ -62,6 +63,7 @@ files:
|
|
|
62
63
|
- spec/lib/usps/imis/error/api_error_spec.rb
|
|
63
64
|
- spec/lib/usps/imis/error/response_error_spec.rb
|
|
64
65
|
- spec/lib/usps/imis/mapper_spec.rb
|
|
66
|
+
- spec/lib/usps/imis/mock_spec.rb
|
|
65
67
|
- spec/lib/usps/imis/panel/base_panel_spec.rb
|
|
66
68
|
- spec/lib/usps/imis/panel/education_spec.rb
|
|
67
69
|
- spec/lib/usps/imis/panel/vsc_spec.rb
|