usps-imis-api 1.0.0.pre.rc.8 → 1.0.0.pre.rc.9
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 +4 -0
- data/Gemfile.lock +20 -2
- data/Readme.md +2 -0
- data/lib/usps/imis/api.rb +11 -12
- data/lib/usps/imis/business_object.rb +7 -8
- data/lib/usps/imis/data.rb +4 -0
- data/lib/usps/imis/error.rb +1 -1
- data/lib/usps/imis/query.rb +50 -18
- data/lib/usps/imis/requests.rb +7 -3
- data/lib/usps/imis/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/.keep +0 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_authorize/automatically_refreshes_an_expired_token.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_imis_id_for/gets_the_iMIS_ID.yml +131 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_imis_id_for/with_a_query_error/wraps_errors.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_inspect/does_not_show_the_token_instance_variable.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_inspect/is_configured_to_exclude_the_token_instance_variable.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/chains_with_on_to_a_single_block.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/nests_on_and_with.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/returns_a_BusinessObject_without_a_block.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_on/sends_an_update_from_put.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_put/sends_an_update.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_put/when_receiving_a_response_error/wraps_the_error.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_query/collects_all_query_results.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/blocks_calling_imis_id_.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/blocks_calling_imis_id_for.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/sends_an_update_from_put.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/sends_an_update_from_update.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/_with/uses_a_panel_correctly.yml +145 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Api/stores_the_initial_imis_id.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/_put_field/submits_the_correct_update_request.yml +627 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_filter_fields/formats_fields_correctly.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get/delegation_to_get_fields/delegates_to_get_fields.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get/returns_multiple_values.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_field/returns_a_string_value.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_field/returns_an_integer_value.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_BusinessObject/with_stubbed_data/_get_fields/returns_multiple_values.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/fetches_a_mapped_field.yml +158 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/raises_for_unmapped_updates.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/supports_Hash_access_syntax.yml +158 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_fetch/supports_Hash_access_syntax_on_the_Api_directly.yml +158 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_update/raises_for_unmapped_updates.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/_update/sends_a_mapped_update.yml +256 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Mapper/initialize_with_imis_id/stores_the_initial_imis_id.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_BasePanel/requires_business_object_to_be_defined.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_BasePanel/requires_payload_data_to_be_defined.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get/loads_a_specific_object.yml +146 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get/returns_specific_fields.yml +146 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get_field/returns_a_specific_field.yml +146 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/_get_fields/returns_specific_fields.yml +146 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/api_example/interacts_with_records_correctly.yml +495 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Education/initialization_with_ID/can_initialize_with_an_iMIS_ID.yml +67 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Vsc/_get/loads_a_specific_object.yml +145 -0
- data/spec/fixtures/vcr_cassettes/Usps_Imis_Panels_Vsc/handles_new_records_correctly.yml +319 -0
- data/spec/lib/usps/imis/api_spec.rb +4 -14
- data/spec/lib/usps/imis/business_object_spec.rb +1 -1
- data/spec/lib/usps/imis/data_spec.rb +9 -0
- data/spec/lib/usps/imis/mapper_spec.rb +1 -1
- data/spec/lib/usps/imis/panels/base_panel_spec.rb +1 -1
- data/spec/lib/usps/imis/panels/education_spec.rb +1 -1
- data/spec/lib/usps/imis/panels/vsc_spec.rb +1 -1
- data/spec/spec_helper.rb +40 -0
- metadata +44 -1
data/spec/spec_helper.rb
CHANGED
|
@@ -11,6 +11,46 @@ require 'active_support/string_inquirer'
|
|
|
11
11
|
|
|
12
12
|
ENV['TESTING'] = 'true'
|
|
13
13
|
|
|
14
|
+
require 'vcr'
|
|
15
|
+
require 'webmock/rspec'
|
|
16
|
+
WebMock.disable_net_connect!
|
|
17
|
+
record_mode = ENV['VCR'] ? ENV['VCR'].to_sym : :once
|
|
18
|
+
VCR.configure do |config|
|
|
19
|
+
config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
|
20
|
+
config.hook_into :webmock
|
|
21
|
+
config.default_cassette_options = {
|
|
22
|
+
record: record_mode,
|
|
23
|
+
match_requests_on: %i[method uri]
|
|
24
|
+
}
|
|
25
|
+
config.configure_rspec_metadata!
|
|
26
|
+
|
|
27
|
+
config.filter_sensitive_data('<USERNAME>') { ENV.fetch('IMIS_USERNAME') }
|
|
28
|
+
config.filter_sensitive_data('<USERNAME>') { CGI.escape(ENV.fetch('IMIS_USERNAME')) }
|
|
29
|
+
|
|
30
|
+
config.filter_sensitive_data('<PASSWORD>') { ENV.fetch('IMIS_PASSWORD') }
|
|
31
|
+
config.filter_sensitive_data('<PASSWORD>') { CGI.escape(ENV.fetch('IMIS_PASSWORD')) }
|
|
32
|
+
|
|
33
|
+
config.filter_sensitive_data('<ACCESS_TOKEN>') do |interaction|
|
|
34
|
+
if interaction.response.headers['Content-Type']&.first&.include?('application/json')
|
|
35
|
+
begin
|
|
36
|
+
response_body = JSON.parse(interaction.response.body)
|
|
37
|
+
response_body['access_token']
|
|
38
|
+
rescue JSON::ParserError
|
|
39
|
+
nil
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
config.filter_sensitive_data('<BEARER_TOKEN>') do |interaction|
|
|
45
|
+
if interaction.request.headers['Authorization']
|
|
46
|
+
auth_header = interaction.request.headers['Authorization'].first
|
|
47
|
+
if (match = auth_header.match(/^Bearer\s+([^,\s]+)/))
|
|
48
|
+
match.captures.first
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
14
54
|
RSpec.configure do |config|
|
|
15
55
|
# Enable flags like --only-failures and --next-failure
|
|
16
56
|
config.example_status_persistence_file_path = 'tmp/.rspec_status'
|
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.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Julian Fiander
|
|
@@ -66,6 +66,49 @@ files:
|
|
|
66
66
|
- lib/usps/imis/query.rb
|
|
67
67
|
- lib/usps/imis/requests.rb
|
|
68
68
|
- lib/usps/imis/version.rb
|
|
69
|
+
- spec/fixtures/vcr_cassettes/.keep
|
|
70
|
+
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_authorize/automatically_refreshes_an_expired_token.yml
|
|
71
|
+
- spec/fixtures/vcr_cassettes/Usps_Imis_Api/_imis_id_for/gets_the_iMIS_ID.yml
|
|
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
|
|
69
112
|
- spec/lib/usps/imis/api_spec.rb
|
|
70
113
|
- spec/lib/usps/imis/business_object_spec.rb
|
|
71
114
|
- spec/lib/usps/imis/config_spec.rb
|