borrow_direct 1.1.0 → 1.2.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +6 -0
- data/Gemfile +2 -0
- data/README.md +19 -6
- data/bd_metrics/finditem_measure.rb +8 -1
- data/borrow_direct.gemspec +1 -1
- data/lib/borrow_direct/authentication.rb +16 -8
- data/lib/borrow_direct/defaults.rb +4 -1
- data/lib/borrow_direct/encryption.rb +34 -0
- data/lib/borrow_direct/error.rb +17 -0
- data/lib/borrow_direct/find_item.rb +32 -18
- data/lib/borrow_direct/pickup_location.rb +32 -0
- data/lib/borrow_direct/request.rb +30 -8
- data/lib/borrow_direct/request_item.rb +15 -7
- data/lib/borrow_direct/request_query.rb +18 -4
- data/lib/borrow_direct/version.rb +1 -1
- data/test/authentication_test.rb +40 -12
- data/test/encryption_test.rb +58 -0
- data/test/find_item_test.rb +66 -11
- data/test/request_item_test.rb +65 -8
- data/test/request_query_test.rb +23 -27
- data/test/request_test.rb +40 -27
- data/test/test_helper.rb +10 -1
- data/test/vcr_cassettes/Authentication/Makes_a_request_succesfully.yml +11 -23
- data/test/vcr_cassettes/Authentication/Raises_for_bad_library_symbol.yml +12 -23
- data/test/vcr_cassettes/Authentication/Raises_for_bad_patron_barcode.yml +12 -24
- data/test/vcr_cassettes/Authentication/get_auth_id/Raises_for_bad_api_key.yml +41 -0
- data/test/vcr_cassettes/Authentication/get_auth_id/raises_for_a_bad_library_symbol.yml +12 -23
- data/test/vcr_cassettes/Authentication/get_auth_id/raises_for_a_bad_patron_barcode.yml +12 -24
- data/test/vcr_cassettes/Authentication/get_auth_id/returns_an_auth_id_for_a_good_request.yml +11 -23
- data/test/vcr_cassettes/Authentication/get_auth_id/returns_auth_id_with_API_key_from_defaults.yml +40 -0
- data/test/vcr_cassettes/Authentication/raw_request_to_verify_HTTP_api/works.yml +11 -23
- data/test/vcr_cassettes/FindItem/_find_item_request/Raises_with_bad_api_key.yml +41 -0
- data/test/vcr_cassettes/FindItem/_find_item_request/finds_a_locally_available_item.yml +47 -18
- data/test/vcr_cassettes/FindItem/_find_item_request/finds_a_requestable_item.yml +66 -18
- data/test/vcr_cassettes/FindItem/_find_item_request/finds_an_item_that_does_not_exist_in_BD.yml +66 -19
- data/test/vcr_cassettes/FindItem/_find_item_request/raises_proper_error_on_bad_AID.yml +40 -0
- data/test/vcr_cassettes/FindItem/_find_item_request/uses_manually_set_auth_id.yml +97 -0
- data/test/vcr_cassettes/FindItem/_find_item_request/with_expected_error_PUBFI002/returns_result.yml +46 -9
- data/test/vcr_cassettes/FindItem/_find_item_request/works_with_multiple_values.yml +66 -18
- data/test/vcr_cassettes/FindItem/find_with_Response/_pickup_location_data/returns_array_of_PickupLocations.yml +97 -0
- data/test/vcr_cassettes/FindItem/find_with_Response/has_an_auth_id.yml +66 -18
- data/test/vcr_cassettes/FindItem/find_with_Response/has_nil_pickup_locations_when_BD_doesn_t_want_to_give_us_them.yml +46 -9
- data/test/vcr_cassettes/FindItem/find_with_Response/has_pickup_locations.yml +66 -18
- data/test/vcr_cassettes/FindItem/find_with_Response/knows_locally_available_.yml +47 -18
- data/test/vcr_cassettes/FindItem/find_with_Response/not_requestable_for_item_that_BD_returns_PUBFI002.yml +46 -9
- data/test/vcr_cassettes/FindItem/find_with_Response/not_requestable_for_item_that_does_not_exist_in_BD.yml +46 -19
- data/test/vcr_cassettes/FindItem/find_with_Response/not_requestable_for_item_that_no_libraries_will_lend.yml +275 -18
- data/test/vcr_cassettes/FindItem/find_with_Response/not_requestable_for_locally_available_item.yml +47 -18
- data/test/vcr_cassettes/FindItem/find_with_Response/requestable_for_requestable_item.yml +66 -18
- data/test/vcr_cassettes/FindItem/find_with_Response/requestable_with_multiple_items_if_at_least_one_is_requestable.yml +66 -18
- data/test/vcr_cassettes/Request/authentication_id/automatically_fetches_one_when_needed.yml +47 -22
- data/test/vcr_cassettes/Request/authentication_id/can_refetch_when_instructed.yml +47 -22
- data/test/vcr_cassettes/Request/authentication_id/manually_set_one_will_be_used_without_fetch.yml +40 -0
- data/test/vcr_cassettes/Request/authentication_id/starts_out_nil.yml +40 -0
- data/test/vcr_cassettes/Request/authentication_id/takes_with_auth_id.yml +40 -0
- data/test/vcr_cassettes/Request/can_make_a_succesful_request_with_AID.yml +97 -0
- data/test/vcr_cassettes/Request/gets_BD_error_info.yml +49 -12
- data/test/vcr_cassettes/Request/gets_BD_error_info_from_a_bad_AID.yml +77 -0
- data/test/vcr_cassettes/Request/raises_exception_on_timeout_live.yml +40 -0
- data/test/vcr_cassettes/Request/raises_on_bad_path.yml +61 -24
- data/test/vcr_cassettes/Request/raises_on_bad_request_hash.yml +50 -35
- data/test/vcr_cassettes/Request/uses_timeout_for_HttpClient.yml +40 -0
- data/test/vcr_cassettes/Request/with_expected_errors/still_returns_result.yml +47 -10
- data/test/vcr_cassettes/RequestItem/make_request/make_request_for_a_locally_available_item.yml +21 -33
- data/test/vcr_cassettes/RequestItem/make_request/make_request_for_a_requestable_item.yml +20 -32
- data/test/vcr_cassettes/RequestItem/make_request/make_request_for_an_unrequestable_item.yml +21 -33
- data/test/vcr_cassettes/RequestItem/make_request/says_no_for_item_that_BD_returns_PUBRI003.yml +77 -0
- data/test/vcr_cassettes/RequestItem/make_request/sets_an_auth_id.yml +77 -0
- data/test/vcr_cassettes/RequestItem/make_request_/raises_for_unrequestable.yml +21 -33
- data/test/vcr_cassettes/RequestItem/make_request_/returns_number_for_succesful_request.yml +20 -32
- data/test/vcr_cassettes/RequestItem/raises_proper_error_on_bad_AID.yml +40 -0
- data/test/vcr_cassettes/RequestItem/raw_RequestItem_sanity_check.yml +134 -0
- data/test/vcr_cassettes/RequestItem/raw_requests_an_unrequestable_item.yml +21 -33
- data/test/vcr_cassettes/RequestItem/uses_manually_set_auth_id.yml +20 -32
- data/test/vcr_cassettes/RequestItem/with_pickup_location_and_requestable_item/works_with_String_pickup_location.yml +78 -0
- data/test/vcr_cassettes/RequestItem/with_pickup_location_and_requestable_item/works_with_structured_PickupLocation.yml +77 -0
- data/test/vcr_cassettes/RequestQuery/raises_proper_error_on_bad_AID.yml +40 -0
- data/test/vcr_cassettes/RequestQuery/raw_request_query_request/returns_results.yml +117 -325
- data/test/vcr_cassettes/RequestQuery/raw_request_to_verify_the_BD_HTTP_API.yml +30 -325
- data/test/vcr_cassettes/RequestQuery/requests/fetches_default_records.yml +117 -328
- data/test/vcr_cassettes/RequestQuery/requests/fetches_full_records.yml +148 -425
- metadata +67 -38
- data/test/vcr_cassettes/Authentication/raw_request_to_verify_HTTP_api/.yml +0 -52
- data/test/vcr_cassettes/FindItem/find_with_Response/has_nil_auth_id_when_BD_doesn_t_want_to_give_us_one.yml +0 -40
- data/test/vcr_cassettes/Request/can_make_a_succesful_request.yml +0 -49
- data/test/vcr_cassettes/RequestItem/make_request/raises_for_unrequestable.yml +0 -91
- data/test/vcr_cassettes/RequestItem/make_request/returns_number_for_succesful_request.yml +0 -89
- data/test/vcr_cassettes/RequestItem/make_request/says_no_for_item_that_BD_returns_PUBRI004.yml +0 -89
- data/test/vcr_cassettes/RequestItem/with_pickup_location_and_requestable_item/still_works.yml +0 -90
- data/test/vcr_cassettes/top_level_describe/an_inner_describe/.yml +0 -76
data/test/vcr_cassettes/RequestItem/make_request/says_no_for_item_that_BD_returns_PUBRI004.yml
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://bdtest.relais-host.com/portal-service/user/authentication/patron
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: ! '{"AuthenticationInformation":{"LibrarySymbol":"DUMMY_BD_LIBRARY_SYMBOL","PatronId":"DUMMY_BD_PATRON"}}'
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- ruby borrow_direct gem 0.0.1 (HTTPClient 2.5.1) https://github.com/jrochkind/borrow_direct
|
12
|
-
Accept:
|
13
|
-
- ! '*/*'
|
14
|
-
Date:
|
15
|
-
- Tue, 21 Oct 2014 17:05:13 GMT
|
16
|
-
Content-Type:
|
17
|
-
- application/json
|
18
|
-
Accept-Language:
|
19
|
-
- en
|
20
|
-
response:
|
21
|
-
status:
|
22
|
-
code: 200
|
23
|
-
message: OK
|
24
|
-
headers:
|
25
|
-
Server:
|
26
|
-
- nginx/1.4.1
|
27
|
-
Date:
|
28
|
-
- Tue, 21 Oct 2014 17:05:15 GMT
|
29
|
-
Content-Type:
|
30
|
-
- application/json;charset=UTF-8
|
31
|
-
Transfer-Encoding:
|
32
|
-
- chunked
|
33
|
-
Connection:
|
34
|
-
- keep-alive
|
35
|
-
Set-Cookie:
|
36
|
-
- visited=yes
|
37
|
-
Expires:
|
38
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
39
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
40
|
-
Content-Language:
|
41
|
-
- en
|
42
|
-
Pragma:
|
43
|
-
- no-cache
|
44
|
-
Cache-Control:
|
45
|
-
- no-cache, no-store, max-age=0
|
46
|
-
body:
|
47
|
-
encoding: US-ASCII
|
48
|
-
string: ! '{"Authentication":{"AuthnUserInfo":{"AId":"7tqolo4J0DtmlTbXm_-y6mnWihk","LibrarySymbol":"DUMMY_BD_LIBRARY_SYMBOL","Iso639_2_LangCode":"ENG","UserLogin":"DUMMY_BD_PATRON","FirstName":"Jonathan","LastName":"Rochkind","AllowLoanAddRequest":true,"AllowCopyAddRequest":false,"AllowSelDelivLoanChange":true,"AllowSelDelivCopyChange":false,"ILSProfile":{"EmailAddress":"jonathan@dnil.net","Telephone":"4105168886","AddressInformation":{"Address1":"Library
|
49
|
-
Systems","Address2":"MSE Library\r\nHomewood Campus"}}}}}'
|
50
|
-
http_version:
|
51
|
-
recorded_at: Tue, 21 Oct 2014 17:05:15 GMT
|
52
|
-
- request:
|
53
|
-
method: post
|
54
|
-
uri: https://bdtest.relais-host.com/dws/item/add
|
55
|
-
body:
|
56
|
-
encoding: UTF-8
|
57
|
-
string: ! '{"PartnershipId":"BD","AuthorizationId":"7tqolo4J0DtmlTbXm_-y6mnWihk","PickupLocation":null,"ExactSearch":[{"Type":"ISBN","Value":"0109836413"}]}'
|
58
|
-
headers:
|
59
|
-
User-Agent:
|
60
|
-
- ruby borrow_direct gem 0.0.1 (HTTPClient 2.5.1) https://github.com/jrochkind/borrow_direct
|
61
|
-
Accept:
|
62
|
-
- ! '*/*'
|
63
|
-
Date:
|
64
|
-
- Tue, 21 Oct 2014 17:05:15 GMT
|
65
|
-
Content-Type:
|
66
|
-
- application/json
|
67
|
-
Accept-Language:
|
68
|
-
- en
|
69
|
-
response:
|
70
|
-
status:
|
71
|
-
code: 404
|
72
|
-
message: Not Found
|
73
|
-
headers:
|
74
|
-
Server:
|
75
|
-
- nginx/1.4.1
|
76
|
-
Date:
|
77
|
-
- Tue, 21 Oct 2014 17:05:18 GMT
|
78
|
-
Content-Type:
|
79
|
-
- application/json;charset=UTF-8
|
80
|
-
Transfer-Encoding:
|
81
|
-
- chunked
|
82
|
-
Connection:
|
83
|
-
- keep-alive
|
84
|
-
body:
|
85
|
-
encoding: US-ASCII
|
86
|
-
string: ! '{"Error":{"ErrorNumber":"PUBRI004","ErrorMessage":"No result"}}'
|
87
|
-
http_version:
|
88
|
-
recorded_at: Tue, 21 Oct 2014 17:05:18 GMT
|
89
|
-
recorded_with: VCR 2.9.3
|
data/test/vcr_cassettes/RequestItem/with_pickup_location_and_requestable_item/still_works.yml
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: post
|
5
|
-
uri: https://bdtest.relais-host.com/portal-service/user/authentication/patron
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: ! '{"AuthenticationInformation":{"LibrarySymbol":"DUMMY_BD_LIBRARY_SYMBOL","PatronId":"DUMMY_BD_PATRON"}}'
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- ruby borrow_direct gem 0.0.1 (HTTPClient 2.5.1) https://github.com/jrochkind/borrow_direct
|
12
|
-
Accept:
|
13
|
-
- ! '*/*'
|
14
|
-
Date:
|
15
|
-
- Tue, 21 Oct 2014 17:05:31 GMT
|
16
|
-
Content-Type:
|
17
|
-
- application/json
|
18
|
-
Accept-Language:
|
19
|
-
- en
|
20
|
-
response:
|
21
|
-
status:
|
22
|
-
code: 200
|
23
|
-
message: OK
|
24
|
-
headers:
|
25
|
-
Server:
|
26
|
-
- nginx/1.4.1
|
27
|
-
Date:
|
28
|
-
- Tue, 21 Oct 2014 17:05:33 GMT
|
29
|
-
Content-Type:
|
30
|
-
- application/json;charset=UTF-8
|
31
|
-
Transfer-Encoding:
|
32
|
-
- chunked
|
33
|
-
Connection:
|
34
|
-
- keep-alive
|
35
|
-
Set-Cookie:
|
36
|
-
- visited=yes
|
37
|
-
Expires:
|
38
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
39
|
-
- Thu, 01 Jan 1970 00:00:00 GMT
|
40
|
-
Content-Language:
|
41
|
-
- en
|
42
|
-
Pragma:
|
43
|
-
- no-cache
|
44
|
-
Cache-Control:
|
45
|
-
- no-cache, no-store, max-age=0
|
46
|
-
body:
|
47
|
-
encoding: US-ASCII
|
48
|
-
string: ! '{"Authentication":{"AuthnUserInfo":{"AId":"jE6-fPtd-67zVGBOgCGUDXLdWGs","LibrarySymbol":"DUMMY_BD_LIBRARY_SYMBOL","Iso639_2_LangCode":"ENG","UserLogin":"DUMMY_BD_PATRON","FirstName":"Jonathan","LastName":"Rochkind","AllowLoanAddRequest":true,"AllowCopyAddRequest":false,"AllowSelDelivLoanChange":true,"AllowSelDelivCopyChange":false,"ILSProfile":{"EmailAddress":"jonathan@dnil.net","Telephone":"4105168886","AddressInformation":{"Address1":"Library
|
49
|
-
Systems","Address2":"MSE Library\r\nHomewood Campus"}}}}}'
|
50
|
-
http_version:
|
51
|
-
recorded_at: Tue, 21 Oct 2014 17:05:33 GMT
|
52
|
-
- request:
|
53
|
-
method: post
|
54
|
-
uri: https://bdtest.relais-host.com/dws/item/add
|
55
|
-
body:
|
56
|
-
encoding: UTF-8
|
57
|
-
string: ! '{"PartnershipId":"BD","AuthorizationId":"jE6-fPtd-67zVGBOgCGUDXLdWGs","PickupLocation":"Some
|
58
|
-
location","ExactSearch":[{"Type":"ISBN","Value":"9797994864"}]}'
|
59
|
-
headers:
|
60
|
-
User-Agent:
|
61
|
-
- ruby borrow_direct gem 0.0.1 (HTTPClient 2.5.1) https://github.com/jrochkind/borrow_direct
|
62
|
-
Accept:
|
63
|
-
- ! '*/*'
|
64
|
-
Date:
|
65
|
-
- Tue, 21 Oct 2014 17:05:33 GMT
|
66
|
-
Content-Type:
|
67
|
-
- application/json
|
68
|
-
Accept-Language:
|
69
|
-
- en
|
70
|
-
response:
|
71
|
-
status:
|
72
|
-
code: 200
|
73
|
-
message: OK
|
74
|
-
headers:
|
75
|
-
Server:
|
76
|
-
- nginx/1.4.1
|
77
|
-
Date:
|
78
|
-
- Tue, 21 Oct 2014 17:05:34 GMT
|
79
|
-
Content-Type:
|
80
|
-
- application/json;charset=UTF-8
|
81
|
-
Transfer-Encoding:
|
82
|
-
- chunked
|
83
|
-
Connection:
|
84
|
-
- keep-alive
|
85
|
-
body:
|
86
|
-
encoding: US-ASCII
|
87
|
-
string: ! '{"Request":{"RequestNumber":"JHU-99000779"}}'
|
88
|
-
http_version:
|
89
|
-
recorded_at: Tue, 21 Oct 2014 17:05:35 GMT
|
90
|
-
recorded_with: VCR 2.9.3
|
@@ -1,76 +0,0 @@
|
|
1
|
-
---
|
2
|
-
http_interactions:
|
3
|
-
- request:
|
4
|
-
method: get
|
5
|
-
uri: http://example.org/
|
6
|
-
body:
|
7
|
-
encoding: UTF-8
|
8
|
-
string: ''
|
9
|
-
headers:
|
10
|
-
User-Agent:
|
11
|
-
- HTTPClient/1.0 (2.5.1, ruby 1.9.3 (2013-11-22))
|
12
|
-
Accept:
|
13
|
-
- ! '*/*'
|
14
|
-
Date:
|
15
|
-
- Tue, 21 Oct 2014 17:05:39 GMT
|
16
|
-
response:
|
17
|
-
status:
|
18
|
-
code: 200
|
19
|
-
message: !binary |-
|
20
|
-
T0s=
|
21
|
-
headers:
|
22
|
-
!binary "QWNjZXB0LVJhbmdlcw==":
|
23
|
-
- !binary |-
|
24
|
-
Ynl0ZXM=
|
25
|
-
!binary "Q2FjaGUtQ29udHJvbA==":
|
26
|
-
- !binary |-
|
27
|
-
bWF4LWFnZT02MDQ4MDA=
|
28
|
-
!binary "Q29udGVudC1UeXBl":
|
29
|
-
- !binary |-
|
30
|
-
dGV4dC9odG1s
|
31
|
-
!binary "RGF0ZQ==":
|
32
|
-
- !binary |-
|
33
|
-
VHVlLCAyMSBPY3QgMjAxNCAxNzowNTozOSBHTVQ=
|
34
|
-
!binary "RXRhZw==":
|
35
|
-
- !binary |-
|
36
|
-
IjM1OTY3MDY1MSI=
|
37
|
-
!binary "RXhwaXJlcw==":
|
38
|
-
- !binary |-
|
39
|
-
VHVlLCAyOCBPY3QgMjAxNCAxNzowNTozOSBHTVQ=
|
40
|
-
!binary "TGFzdC1Nb2RpZmllZA==":
|
41
|
-
- !binary |-
|
42
|
-
RnJpLCAwOSBBdWcgMjAxMyAyMzo1NDozNSBHTVQ=
|
43
|
-
!binary "U2VydmVy":
|
44
|
-
- !binary |-
|
45
|
-
RUNTIChpYWQvMTgyQSk=
|
46
|
-
!binary "WC1DYWNoZQ==":
|
47
|
-
- !binary |-
|
48
|
-
SElU
|
49
|
-
!binary "WC1FYy1DdXN0b20tRXJyb3I=":
|
50
|
-
- !binary |-
|
51
|
-
MQ==
|
52
|
-
!binary "Q29udGVudC1MZW5ndGg=":
|
53
|
-
- !binary |-
|
54
|
-
MTI3MA==
|
55
|
-
body:
|
56
|
-
encoding: US-ASCII
|
57
|
-
string: ! "<!doctype html>\n<html>\n<head>\n <title>Example Domain</title>\n\n
|
58
|
-
\ <meta charset=\"utf-8\" />\n <meta http-equiv=\"Content-type\" content=\"text/html;
|
59
|
-
charset=utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width,
|
60
|
-
initial-scale=1\" />\n <style type=\"text/css\">\n body {\n background-color:
|
61
|
-
#f0f0f2;\n margin: 0;\n padding: 0;\n font-family: \"Open
|
62
|
-
Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n \n }\n
|
63
|
-
\ div {\n width: 600px;\n margin: 5em auto;\n padding:
|
64
|
-
50px;\n background-color: #fff;\n border-radius: 1em;\n }\n
|
65
|
-
\ a:link, a:visited {\n color: #38488f;\n text-decoration:
|
66
|
-
none;\n }\n @media (max-width: 700px) {\n body {\n background-color:
|
67
|
-
#fff;\n }\n div {\n width: auto;\n margin:
|
68
|
-
0 auto;\n border-radius: 0;\n padding: 1em;\n }\n
|
69
|
-
\ }\n </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n
|
70
|
-
\ <p>This domain is established to be used for illustrative examples in
|
71
|
-
documents. You may use this\n domain in examples without prior coordination
|
72
|
-
or asking for permission.</p>\n <p><a href=\"http://www.iana.org/domains/example\">More
|
73
|
-
information...</a></p>\n</div>\n</body>\n</html>\n"
|
74
|
-
http_version:
|
75
|
-
recorded_at: Tue, 21 Oct 2014 17:05:39 GMT
|
76
|
-
recorded_with: VCR 2.9.3
|