usps-imis-api 1.0.0.pre.rc.9 → 1.0.0.pre.rc.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/Readme.md +1 -323
- data/lib/usps/imis/api.rb +11 -6
- data/lib/usps/imis/business_object.rb +11 -10
- data/lib/usps/imis/config.rb +6 -2
- data/lib/usps/imis/error.rb +1 -0
- data/lib/usps/imis/errors/missing_id_error.rb +15 -0
- data/lib/usps/imis/panels/base_panel.rb +2 -1
- data/lib/usps/imis/properties.rb +14 -14
- data/lib/usps/imis/query.rb +44 -23
- data/lib/usps/imis/requests.rb +5 -1
- data/lib/usps/imis/version.rb +1 -1
- data/spec/support/usps/vcr/config.rb +47 -0
- data/spec/support/usps/vcr/filters.rb +89 -0
- data/spec/support/usps/vcr.rb +8 -0
- metadata +6 -70
- data/.github/workflows/main.yml +0 -57
- data/.gitignore +0 -5
- data/.rspec +0 -2
- data/.rubocop.yml +0 -89
- data/.ruby-version +0 -1
- data/.simplecov +0 -8
- data/Gemfile +0 -16
- data/Gemfile.lock +0 -147
- data/Rakefile +0 -12
- data/bin/console +0 -21
- data/bin/setup +0 -8
- data/spec/fixtures/vcr_cassettes/.keep +0 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_authorize/automatically_refreshes_an_expired_token.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_imis_id_for/gets_the_iMIS_ID.yml +0 -131
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_imis_id_for/with_a_query_error/wraps_errors.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_inspect/does_not_show_the_token_instance_variable.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_inspect/is_configured_to_exclude_the_token_instance_variable.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/chains_with_on_to_a_single_block.yml +0 -256
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/nests_on_and_with.yml +0 -256
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/returns_a_BusinessObject_without_a_block.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/sends_an_update_from_put.yml +0 -256
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_put/sends_an_update.yml +0 -256
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_put/when_receiving_a_response_error/wraps_the_error.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_query/collects_all_query_results.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/blocks_calling_imis_id_.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/blocks_calling_imis_id_for.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/sends_an_update_from_put.yml +0 -256
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/sends_an_update_from_update.yml +0 -256
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/uses_a_panel_correctly.yml +0 -145
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/stores_the_initial_imis_id.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/_put_field/submits_the_correct_update_request.yml +0 -627
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_filter_fields/formats_fields_correctly.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get/delegation_to_get_fields/delegates_to_get_fields.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get/returns_multiple_values.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_field/returns_a_string_value.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_field/returns_an_integer_value.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_fields/returns_multiple_values.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/fetches_a_mapped_field.yml +0 -158
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/raises_for_unmapped_updates.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/supports_Hash_access_syntax.yml +0 -158
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/supports_Hash_access_syntax_on_the_Api_directly.yml +0 -158
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_update/raises_for_unmapped_updates.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_update/sends_a_mapped_update.yml +0 -256
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/initialize_with_imis_id/stores_the_initial_imis_id.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_BasePanel/requires_business_object_to_be_defined.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_BasePanel/requires_payload_data_to_be_defined.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get/loads_a_specific_object.yml +0 -146
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get/returns_specific_fields.yml +0 -146
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get_field/returns_a_specific_field.yml +0 -146
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get_fields/returns_specific_fields.yml +0 -146
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/interacts_with_records_correctly.yml +0 -495
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/initialization_with_ID/can_initialize_with_an_iMIS_ID.yml +0 -67
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Vsc/_get/loads_a_specific_object.yml +0 -145
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Vsc/handles_new_records_correctly.yml +0 -319
- data/spec/lib/usps/imis/api_spec.rb +0 -161
- data/spec/lib/usps/imis/business_object_spec.rb +0 -87
- data/spec/lib/usps/imis/config_spec.rb +0 -59
- data/spec/lib/usps/imis/data_spec.rb +0 -75
- data/spec/lib/usps/imis/error_spec.rb +0 -17
- data/spec/lib/usps/imis/errors/response_error_spec.rb +0 -107
- data/spec/lib/usps/imis/mapper_spec.rb +0 -55
- data/spec/lib/usps/imis/mocks/business_object_spec.rb +0 -65
- data/spec/lib/usps/imis/panels/base_panel_spec.rb +0 -33
- data/spec/lib/usps/imis/panels/education_spec.rb +0 -70
- data/spec/lib/usps/imis/panels/vsc_spec.rb +0 -37
- data/spec/lib/usps/imis/properties_spec.rb +0 -19
- data/spec/lib/usps/imis_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -78
- data/usps-imis-api.gemspec +0 -20
data/lib/usps/imis/requests.rb
CHANGED
|
@@ -9,6 +9,10 @@ module Usps
|
|
|
9
9
|
|
|
10
10
|
def logger = Imis.logger
|
|
11
11
|
|
|
12
|
+
def token = api.token
|
|
13
|
+
def token_expiration = api.token_expiration
|
|
14
|
+
def authenticate = api.send(:authenticate)
|
|
15
|
+
|
|
12
16
|
def http_get = Net::HTTP::Get.new(uri)
|
|
13
17
|
def http_put = Net::HTTP::Put.new(uri)
|
|
14
18
|
def http_post = Net::HTTP::Post.new(uri(id: ''))
|
|
@@ -26,7 +30,7 @@ module Usps
|
|
|
26
30
|
# If the current token is missing/expired, request a new one
|
|
27
31
|
#
|
|
28
32
|
def authorize(request)
|
|
29
|
-
if token_expiration < Time.now
|
|
33
|
+
if token_expiration.nil? || token_expiration < Time.now
|
|
30
34
|
logger.debug 'Token expired: re-authenticating with iMIS'
|
|
31
35
|
authenticate
|
|
32
36
|
end
|
data/lib/usps/imis/version.rb
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Usps
|
|
4
|
+
module Vcr
|
|
5
|
+
module Config
|
|
6
|
+
class << self
|
|
7
|
+
def configure!
|
|
8
|
+
WebMock.disable_net_connect!
|
|
9
|
+
|
|
10
|
+
VCR.configure do |config|
|
|
11
|
+
config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
|
12
|
+
config.hook_into :webmock
|
|
13
|
+
default_options(config)
|
|
14
|
+
config.configure_rspec_metadata!
|
|
15
|
+
apply_filters(config)
|
|
16
|
+
|
|
17
|
+
yield(config) if block_given?
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def vcr_record_ordered
|
|
22
|
+
ENV['VCR'] == 'all' ? :defined : :random
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def default_options(config)
|
|
28
|
+
config.default_cassette_options = {
|
|
29
|
+
record: ENV['VCR'] ? ENV['VCR'].to_sym : :once,
|
|
30
|
+
match_requests_on: %i[method uri]
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def apply_filters(config)
|
|
35
|
+
Filters.apply!(
|
|
36
|
+
config,
|
|
37
|
+
*%i[
|
|
38
|
+
username password access_token bearer_token
|
|
39
|
+
ignore_response_headers cf_ray cookie date
|
|
40
|
+
issued expires
|
|
41
|
+
]
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Usps
|
|
4
|
+
module Vcr
|
|
5
|
+
module Filters
|
|
6
|
+
class << self
|
|
7
|
+
def apply!(config, *filters)
|
|
8
|
+
filters.each { public_send(it, config) }
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def username(config)
|
|
12
|
+
value = Usps::Imis.config.username || '<USERNAME>'
|
|
13
|
+
config.filter_sensitive_data('<USERNAME>') { value }
|
|
14
|
+
config.filter_sensitive_data('<USERNAME>') { CGI.escape(value) }
|
|
15
|
+
config.filter_sensitive_data('<USERNAME>') { value.upcase }
|
|
16
|
+
config.filter_sensitive_data('<USERNAME>') { CGI.escape(value).upcase }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def password(config)
|
|
20
|
+
value = Usps::Imis.config.password || '<PASSWORD>'
|
|
21
|
+
config.filter_sensitive_data('<PASSWORD>') { value }
|
|
22
|
+
config.filter_sensitive_data('<PASSWORD>') { CGI.escape(value) }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def access_token(config)
|
|
26
|
+
filter_json_field(config, 'access_token', '<ACCESS_TOKEN>')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def bearer_token(config)
|
|
30
|
+
config.filter_sensitive_data('<BEARER_TOKEN>') do |interaction|
|
|
31
|
+
if interaction.request.headers['Authorization']
|
|
32
|
+
authorization = interaction.request.headers['Authorization'].first
|
|
33
|
+
if (match = authorization.match(/^Bearer\s+([^,\s]+)/))
|
|
34
|
+
match.captures.first
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def ignore_response_headers(config)
|
|
41
|
+
config.before_record do |interaction|
|
|
42
|
+
interaction.response.headers.delete('Report-To')
|
|
43
|
+
interaction.response.headers.delete('Content-Security-Policy-Report-Only')
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def cf_ray(config)
|
|
48
|
+
config.filter_sensitive_data('<CF_RAY>') do |interaction|
|
|
49
|
+
interaction.response.headers['Cf-Ray']&.first
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def cookie(config)
|
|
54
|
+
config.filter_sensitive_data('<COOKIE>') do |interaction|
|
|
55
|
+
interaction.response.headers['Set-Cookie']&.first
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def date(config)
|
|
60
|
+
config.filter_sensitive_data('<DATE>') do |interaction|
|
|
61
|
+
interaction.response.headers['Date']&.first
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def issued(config)
|
|
66
|
+
filter_json_field(config, '.issued', '<ISSUED>')
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def expires(config)
|
|
70
|
+
filter_json_field(config, '.expires', '<EXPIRES>')
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
private
|
|
74
|
+
|
|
75
|
+
def filter_json_field(config, field_name, placeholder)
|
|
76
|
+
config.filter_sensitive_data(placeholder) do |interaction|
|
|
77
|
+
if interaction.response.headers['Content-Type']&.first&.include?('application/json')
|
|
78
|
+
begin
|
|
79
|
+
JSON.parse(interaction.response.body)[field_name]
|
|
80
|
+
rescue JSON::ParserError
|
|
81
|
+
nil
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
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: 1.0.0.pre.rc.
|
|
4
|
+
version: 1.0.0.pre.rc.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Fiander
|
|
@@ -29,18 +29,7 @@ executables: []
|
|
|
29
29
|
extensions: []
|
|
30
30
|
extra_rdoc_files: []
|
|
31
31
|
files:
|
|
32
|
-
- ".github/workflows/main.yml"
|
|
33
|
-
- ".gitignore"
|
|
34
|
-
- ".rspec"
|
|
35
|
-
- ".rubocop.yml"
|
|
36
|
-
- ".ruby-version"
|
|
37
|
-
- ".simplecov"
|
|
38
|
-
- Gemfile
|
|
39
|
-
- Gemfile.lock
|
|
40
|
-
- Rakefile
|
|
41
32
|
- Readme.md
|
|
42
|
-
- bin/console
|
|
43
|
-
- bin/setup
|
|
44
33
|
- lib/usps/imis.rb
|
|
45
34
|
- lib/usps/imis/api.rb
|
|
46
35
|
- lib/usps/imis/business_object.rb
|
|
@@ -51,6 +40,7 @@ files:
|
|
|
51
40
|
- lib/usps/imis/errors/config_error.rb
|
|
52
41
|
- lib/usps/imis/errors/locked_id_error.rb
|
|
53
42
|
- lib/usps/imis/errors/mapper_error.rb
|
|
43
|
+
- lib/usps/imis/errors/missing_id_error.rb
|
|
54
44
|
- lib/usps/imis/errors/not_found_error.rb
|
|
55
45
|
- lib/usps/imis/errors/panel_unimplemented_error.rb
|
|
56
46
|
- lib/usps/imis/errors/response_error.rb
|
|
@@ -66,64 +56,9 @@ files:
|
|
|
66
56
|
- lib/usps/imis/query.rb
|
|
67
57
|
- lib/usps/imis/requests.rb
|
|
68
58
|
- lib/usps/imis/version.rb
|
|
69
|
-
- spec/
|
|
70
|
-
- spec/
|
|
71
|
-
- spec/
|
|
72
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_imis_id_for/with_a_query_error/wraps_errors.yml
|
|
73
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_inspect/does_not_show_the_token_instance_variable.yml
|
|
74
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_inspect/is_configured_to_exclude_the_token_instance_variable.yml
|
|
75
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/chains_with_on_to_a_single_block.yml
|
|
76
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/nests_on_and_with.yml
|
|
77
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/returns_a_BusinessObject_without_a_block.yml
|
|
78
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/sends_an_update_from_put.yml
|
|
79
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_put/sends_an_update.yml
|
|
80
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_put/when_receiving_a_response_error/wraps_the_error.yml
|
|
81
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_query/collects_all_query_results.yml
|
|
82
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/blocks_calling_imis_id_.yml
|
|
83
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/blocks_calling_imis_id_for.yml
|
|
84
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/sends_an_update_from_put.yml
|
|
85
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/sends_an_update_from_update.yml
|
|
86
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/uses_a_panel_correctly.yml
|
|
87
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/stores_the_initial_imis_id.yml
|
|
88
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/_put_field/submits_the_correct_update_request.yml
|
|
89
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_filter_fields/formats_fields_correctly.yml
|
|
90
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get/delegation_to_get_fields/delegates_to_get_fields.yml
|
|
91
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get/returns_multiple_values.yml
|
|
92
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_field/returns_a_string_value.yml
|
|
93
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_field/returns_an_integer_value.yml
|
|
94
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_fields/returns_multiple_values.yml
|
|
95
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/fetches_a_mapped_field.yml
|
|
96
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/raises_for_unmapped_updates.yml
|
|
97
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/supports_Hash_access_syntax.yml
|
|
98
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/supports_Hash_access_syntax_on_the_Api_directly.yml
|
|
99
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_update/raises_for_unmapped_updates.yml
|
|
100
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_update/sends_a_mapped_update.yml
|
|
101
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/initialize_with_imis_id/stores_the_initial_imis_id.yml
|
|
102
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_BasePanel/requires_business_object_to_be_defined.yml
|
|
103
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_BasePanel/requires_payload_data_to_be_defined.yml
|
|
104
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get/loads_a_specific_object.yml
|
|
105
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get/returns_specific_fields.yml
|
|
106
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get_field/returns_a_specific_field.yml
|
|
107
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get_fields/returns_specific_fields.yml
|
|
108
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/interacts_with_records_correctly.yml
|
|
109
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/initialization_with_ID/can_initialize_with_an_iMIS_ID.yml
|
|
110
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Vsc/_get/loads_a_specific_object.yml
|
|
111
|
-
- spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Vsc/handles_new_records_correctly.yml
|
|
112
|
-
- spec/lib/usps/imis/api_spec.rb
|
|
113
|
-
- spec/lib/usps/imis/business_object_spec.rb
|
|
114
|
-
- spec/lib/usps/imis/config_spec.rb
|
|
115
|
-
- spec/lib/usps/imis/data_spec.rb
|
|
116
|
-
- spec/lib/usps/imis/error_spec.rb
|
|
117
|
-
- spec/lib/usps/imis/errors/response_error_spec.rb
|
|
118
|
-
- spec/lib/usps/imis/mapper_spec.rb
|
|
119
|
-
- spec/lib/usps/imis/mocks/business_object_spec.rb
|
|
120
|
-
- spec/lib/usps/imis/panels/base_panel_spec.rb
|
|
121
|
-
- spec/lib/usps/imis/panels/education_spec.rb
|
|
122
|
-
- spec/lib/usps/imis/panels/vsc_spec.rb
|
|
123
|
-
- spec/lib/usps/imis/properties_spec.rb
|
|
124
|
-
- spec/lib/usps/imis_spec.rb
|
|
125
|
-
- spec/spec_helper.rb
|
|
126
|
-
- usps-imis-api.gemspec
|
|
59
|
+
- spec/support/usps/vcr.rb
|
|
60
|
+
- spec/support/usps/vcr/config.rb
|
|
61
|
+
- spec/support/usps/vcr/filters.rb
|
|
127
62
|
homepage: https://github.com/unitedstatespowersquadrons/imis-api-ruby
|
|
128
63
|
licenses: []
|
|
129
64
|
metadata:
|
|
@@ -131,6 +66,7 @@ metadata:
|
|
|
131
66
|
rdoc_options: []
|
|
132
67
|
require_paths:
|
|
133
68
|
- lib
|
|
69
|
+
- spec/support
|
|
134
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
71
|
requirements:
|
|
136
72
|
- - ">="
|
data/.github/workflows/main.yml
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
name: 'USPS iMIS API - Ruby'
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
paths:
|
|
5
|
-
- '**.rb'
|
|
6
|
-
- '**.yml'
|
|
7
|
-
- '**.json'
|
|
8
|
-
- 'Gemfile'
|
|
9
|
-
- '.simplecov'
|
|
10
|
-
branches:
|
|
11
|
-
- 'main'
|
|
12
|
-
- '**'
|
|
13
|
-
workflow_dispatch:
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
rubocop:
|
|
17
|
-
runs-on: ubuntu-24.04
|
|
18
|
-
environment: "USPS iMIS API - Ruby"
|
|
19
|
-
strategy:
|
|
20
|
-
matrix:
|
|
21
|
-
ruby: ['3.4', head]
|
|
22
|
-
steps:
|
|
23
|
-
- name: Checkout Code
|
|
24
|
-
uses: actions/checkout@v4
|
|
25
|
-
- name: Setup Ruby
|
|
26
|
-
uses: ruby/setup-ruby@v1
|
|
27
|
-
with:
|
|
28
|
-
ruby-version: ${{ matrix.ruby }}
|
|
29
|
-
bundler-cache: true
|
|
30
|
-
- name: Run Rubocop
|
|
31
|
-
run: bundle exec rubocop
|
|
32
|
-
rspec:
|
|
33
|
-
runs-on: ubuntu-24.04
|
|
34
|
-
environment: "USPS iMIS API - Ruby"
|
|
35
|
-
strategy:
|
|
36
|
-
matrix:
|
|
37
|
-
ruby: ['3.4', head]
|
|
38
|
-
env:
|
|
39
|
-
IMIS_USERNAME: ${{ secrets.IMIS_USERNAME }}
|
|
40
|
-
IMIS_PASSWORD: ${{ secrets.IMIS_PASSWORD }}
|
|
41
|
-
IMIS_ID_QUERY_NAME: ${{ secrets.IMIS_ID_QUERY_NAME }}
|
|
42
|
-
steps:
|
|
43
|
-
- name: Checkout Code
|
|
44
|
-
uses: actions/checkout@v4
|
|
45
|
-
- name: Setup Ruby
|
|
46
|
-
uses: ruby/setup-ruby@v1
|
|
47
|
-
with:
|
|
48
|
-
ruby-version: ${{ matrix.ruby }}
|
|
49
|
-
bundler-cache: true
|
|
50
|
-
- name: Run Rspec
|
|
51
|
-
run: bundle exec rspec --format documentation --order rand --color --tty
|
|
52
|
-
- name: Store Coverage
|
|
53
|
-
uses: actions/upload-artifact@v4
|
|
54
|
-
with:
|
|
55
|
-
name: coverage-rspec-${{ matrix.ruby }}
|
|
56
|
-
include-hidden-files: true
|
|
57
|
-
path: coverage/
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
plugins:
|
|
2
|
-
- rubocop-rspec
|
|
3
|
-
|
|
4
|
-
AllCops:
|
|
5
|
-
TargetRubyVersion: 3.4
|
|
6
|
-
Exclude:
|
|
7
|
-
- bin/**/*
|
|
8
|
-
- config/**/*
|
|
9
|
-
- db/**/*
|
|
10
|
-
- vendor/**/*
|
|
11
|
-
- tmp/**/*
|
|
12
|
-
NewCops: enable
|
|
13
|
-
SuggestExtensions: false
|
|
14
|
-
|
|
15
|
-
Layout/FirstHashElementIndentation:
|
|
16
|
-
EnforcedStyle: consistent
|
|
17
|
-
Layout/AccessModifierIndentation:
|
|
18
|
-
EnforcedStyle: outdent
|
|
19
|
-
Layout/EmptyLinesAroundAccessModifier:
|
|
20
|
-
Enabled: true
|
|
21
|
-
Layout/ArrayAlignment:
|
|
22
|
-
Enabled: true
|
|
23
|
-
Layout/HashAlignment:
|
|
24
|
-
Enabled: true
|
|
25
|
-
Layout/EmptyLineAfterGuardClause:
|
|
26
|
-
Enabled: true
|
|
27
|
-
Layout/SpaceInsideBlockBraces:
|
|
28
|
-
EnforcedStyle: space
|
|
29
|
-
EnforcedStyleForEmptyBraces: no_space
|
|
30
|
-
Layout/SpaceInsideHashLiteralBraces:
|
|
31
|
-
EnforcedStyle: space
|
|
32
|
-
EnforcedStyleForEmptyBraces: no_space
|
|
33
|
-
Layout/SpaceInsideArrayLiteralBrackets:
|
|
34
|
-
EnforcedStyle: no_space
|
|
35
|
-
|
|
36
|
-
Lint/UnusedMethodArgument:
|
|
37
|
-
Enabled: true
|
|
38
|
-
Lint/UselessAssignment:
|
|
39
|
-
Enabled: true
|
|
40
|
-
|
|
41
|
-
Metrics/MethodLength:
|
|
42
|
-
Enabled: true
|
|
43
|
-
Max: 15
|
|
44
|
-
Metrics/ClassLength:
|
|
45
|
-
Enabled: true
|
|
46
|
-
Max: 150
|
|
47
|
-
Metrics/ModuleLength:
|
|
48
|
-
Max: 150
|
|
49
|
-
Metrics/ParameterLists:
|
|
50
|
-
Enabled: true
|
|
51
|
-
Metrics/CyclomaticComplexity:
|
|
52
|
-
Enabled: true
|
|
53
|
-
Metrics/AbcSize:
|
|
54
|
-
Enabled: true
|
|
55
|
-
Max: 30
|
|
56
|
-
|
|
57
|
-
Naming/MemoizedInstanceVariableName:
|
|
58
|
-
Enabled: false
|
|
59
|
-
Naming/MethodParameterName:
|
|
60
|
-
Enabled: false
|
|
61
|
-
Naming/FileName:
|
|
62
|
-
Enabled: false
|
|
63
|
-
|
|
64
|
-
Style/Documentation:
|
|
65
|
-
Enabled: false
|
|
66
|
-
Style/FrozenStringLiteralComment:
|
|
67
|
-
Enabled: true
|
|
68
|
-
Style/NumericLiterals:
|
|
69
|
-
Enabled: false
|
|
70
|
-
Style/StringLiterals:
|
|
71
|
-
EnforcedStyle: single_quotes
|
|
72
|
-
Style/AndOr:
|
|
73
|
-
Enabled: true
|
|
74
|
-
Style/ClassCheck:
|
|
75
|
-
Enabled: true
|
|
76
|
-
Style/GuardClause:
|
|
77
|
-
Enabled: true
|
|
78
|
-
Style/OptionalBooleanParameter:
|
|
79
|
-
Enabled: false
|
|
80
|
-
|
|
81
|
-
Security/Eval:
|
|
82
|
-
Enabled: true
|
|
83
|
-
Security/JSONLoad:
|
|
84
|
-
Enabled: true
|
|
85
|
-
Security/YAMLLoad:
|
|
86
|
-
Enabled: true
|
|
87
|
-
|
|
88
|
-
RSpec/NestedGroups:
|
|
89
|
-
Max: 4
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.5-dev
|
data/.simplecov
DELETED
data/Gemfile
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source 'https://rubygems.org'
|
|
4
|
-
gemspec
|
|
5
|
-
|
|
6
|
-
gem 'dotenv', '>= 3.1.4'
|
|
7
|
-
gem 'irb', '>= 1.15.2'
|
|
8
|
-
gem 'rake', '>= 13.2.1'
|
|
9
|
-
gem 'rspec', '>= 3.13.0'
|
|
10
|
-
gem 'rubocop', '>= 1.66.1'
|
|
11
|
-
gem 'rubocop-rspec', '>= 3.1.0'
|
|
12
|
-
gem 'simplecov', '>= 0.22.0'
|
|
13
|
-
|
|
14
|
-
gem 'cgi', '>= 0.5.0' # Required to resolve a loading issue for VCR
|
|
15
|
-
gem 'vcr', '>= 6.3.1'
|
|
16
|
-
gem 'webmock', '>= 3.25.2'
|
data/Gemfile.lock
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
usps-imis-api (1.0.0.pre.rc.9)
|
|
5
|
-
activesupport (~> 8.0)
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: https://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
activesupport (8.1.0)
|
|
11
|
-
base64
|
|
12
|
-
bigdecimal
|
|
13
|
-
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
14
|
-
connection_pool (>= 2.2.5)
|
|
15
|
-
drb
|
|
16
|
-
i18n (>= 1.6, < 2)
|
|
17
|
-
json
|
|
18
|
-
logger (>= 1.4.2)
|
|
19
|
-
minitest (>= 5.1)
|
|
20
|
-
securerandom (>= 0.3)
|
|
21
|
-
tzinfo (~> 2.0, >= 2.0.5)
|
|
22
|
-
uri (>= 0.13.1)
|
|
23
|
-
addressable (2.8.7)
|
|
24
|
-
public_suffix (>= 2.0.2, < 7.0)
|
|
25
|
-
ast (2.4.3)
|
|
26
|
-
base64 (0.3.0)
|
|
27
|
-
bigdecimal (3.3.1)
|
|
28
|
-
cgi (0.5.0)
|
|
29
|
-
concurrent-ruby (1.3.5)
|
|
30
|
-
connection_pool (2.5.4)
|
|
31
|
-
crack (1.0.1)
|
|
32
|
-
bigdecimal
|
|
33
|
-
rexml
|
|
34
|
-
date (3.4.1)
|
|
35
|
-
diff-lcs (1.6.2)
|
|
36
|
-
docile (1.4.1)
|
|
37
|
-
dotenv (3.1.8)
|
|
38
|
-
drb (2.2.3)
|
|
39
|
-
erb (5.1.1)
|
|
40
|
-
hashdiff (1.2.1)
|
|
41
|
-
i18n (1.14.7)
|
|
42
|
-
concurrent-ruby (~> 1.0)
|
|
43
|
-
io-console (0.8.1)
|
|
44
|
-
irb (1.15.2)
|
|
45
|
-
pp (>= 0.6.0)
|
|
46
|
-
rdoc (>= 4.0.0)
|
|
47
|
-
reline (>= 0.4.2)
|
|
48
|
-
json (2.15.2)
|
|
49
|
-
language_server-protocol (3.17.0.5)
|
|
50
|
-
lint_roller (1.1.0)
|
|
51
|
-
logger (1.7.0)
|
|
52
|
-
minitest (5.26.0)
|
|
53
|
-
parallel (1.27.0)
|
|
54
|
-
parser (3.3.9.0)
|
|
55
|
-
ast (~> 2.4.1)
|
|
56
|
-
racc
|
|
57
|
-
pp (0.6.3)
|
|
58
|
-
prettyprint
|
|
59
|
-
prettyprint (0.2.0)
|
|
60
|
-
prism (1.6.0)
|
|
61
|
-
psych (5.2.6)
|
|
62
|
-
date
|
|
63
|
-
stringio
|
|
64
|
-
public_suffix (6.0.2)
|
|
65
|
-
racc (1.8.1)
|
|
66
|
-
rainbow (3.1.1)
|
|
67
|
-
rake (13.3.0)
|
|
68
|
-
rdoc (6.15.0)
|
|
69
|
-
erb
|
|
70
|
-
psych (>= 4.0.0)
|
|
71
|
-
tsort
|
|
72
|
-
regexp_parser (2.11.3)
|
|
73
|
-
reline (0.6.2)
|
|
74
|
-
io-console (~> 0.5)
|
|
75
|
-
rexml (3.4.4)
|
|
76
|
-
rspec (3.13.2)
|
|
77
|
-
rspec-core (~> 3.13.0)
|
|
78
|
-
rspec-expectations (~> 3.13.0)
|
|
79
|
-
rspec-mocks (~> 3.13.0)
|
|
80
|
-
rspec-core (3.13.6)
|
|
81
|
-
rspec-support (~> 3.13.0)
|
|
82
|
-
rspec-expectations (3.13.5)
|
|
83
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
84
|
-
rspec-support (~> 3.13.0)
|
|
85
|
-
rspec-mocks (3.13.6)
|
|
86
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
87
|
-
rspec-support (~> 3.13.0)
|
|
88
|
-
rspec-support (3.13.6)
|
|
89
|
-
rubocop (1.81.6)
|
|
90
|
-
json (~> 2.3)
|
|
91
|
-
language_server-protocol (~> 3.17.0.2)
|
|
92
|
-
lint_roller (~> 1.1.0)
|
|
93
|
-
parallel (~> 1.10)
|
|
94
|
-
parser (>= 3.3.0.2)
|
|
95
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
96
|
-
regexp_parser (>= 2.9.3, < 3.0)
|
|
97
|
-
rubocop-ast (>= 1.47.1, < 2.0)
|
|
98
|
-
ruby-progressbar (~> 1.7)
|
|
99
|
-
unicode-display_width (>= 2.4.0, < 4.0)
|
|
100
|
-
rubocop-ast (1.47.1)
|
|
101
|
-
parser (>= 3.3.7.2)
|
|
102
|
-
prism (~> 1.4)
|
|
103
|
-
rubocop-rspec (3.7.0)
|
|
104
|
-
lint_roller (~> 1.1)
|
|
105
|
-
rubocop (~> 1.72, >= 1.72.1)
|
|
106
|
-
ruby-progressbar (1.13.0)
|
|
107
|
-
securerandom (0.4.1)
|
|
108
|
-
simplecov (0.22.0)
|
|
109
|
-
docile (~> 1.1)
|
|
110
|
-
simplecov-html (~> 0.11)
|
|
111
|
-
simplecov_json_formatter (~> 0.1)
|
|
112
|
-
simplecov-html (0.13.2)
|
|
113
|
-
simplecov_json_formatter (0.1.4)
|
|
114
|
-
stringio (3.1.7)
|
|
115
|
-
tsort (0.2.0)
|
|
116
|
-
tzinfo (2.0.6)
|
|
117
|
-
concurrent-ruby (~> 1.0)
|
|
118
|
-
unicode-display_width (3.2.0)
|
|
119
|
-
unicode-emoji (~> 4.1)
|
|
120
|
-
unicode-emoji (4.1.0)
|
|
121
|
-
uri (1.0.4)
|
|
122
|
-
vcr (6.3.1)
|
|
123
|
-
base64
|
|
124
|
-
webmock (3.25.2)
|
|
125
|
-
addressable (>= 2.8.0)
|
|
126
|
-
crack (>= 0.3.2)
|
|
127
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
|
128
|
-
|
|
129
|
-
PLATFORMS
|
|
130
|
-
arm64-darwin-23
|
|
131
|
-
ruby
|
|
132
|
-
|
|
133
|
-
DEPENDENCIES
|
|
134
|
-
cgi (>= 0.5.0)
|
|
135
|
-
dotenv (>= 3.1.4)
|
|
136
|
-
irb (>= 1.15.2)
|
|
137
|
-
rake (>= 13.2.1)
|
|
138
|
-
rspec (>= 3.13.0)
|
|
139
|
-
rubocop (>= 1.66.1)
|
|
140
|
-
rubocop-rspec (>= 3.1.0)
|
|
141
|
-
simplecov (>= 0.22.0)
|
|
142
|
-
usps-imis-api!
|
|
143
|
-
vcr (>= 6.3.1)
|
|
144
|
-
webmock (>= 3.25.2)
|
|
145
|
-
|
|
146
|
-
BUNDLED WITH
|
|
147
|
-
2.5.6
|
data/Rakefile
DELETED
data/bin/console
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
require 'bundler/setup'
|
|
5
|
-
require 'usps/imis'
|
|
6
|
-
|
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
9
|
-
|
|
10
|
-
# Configure from the environment automatically
|
|
11
|
-
require 'dotenv/load'
|
|
12
|
-
Usps::Imis.configure do |config|
|
|
13
|
-
config.environment = :development
|
|
14
|
-
config.imis_id_query_name = ENV['IMIS_ID_QUERY_NAME']
|
|
15
|
-
|
|
16
|
-
config.username = ENV['IMIS_USERNAME']
|
|
17
|
-
config.password = ENV['IMIS_PASSWORD']
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
require "irb"
|
|
21
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
|
File without changes
|