-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from mlibrary/LIBSEARCH-930-get-this-Asia-lib…
…rary-backlog Libsearch 930 get this asia library backlog
- Loading branch information
Showing
7 changed files
with
117 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ token.txt | |
/.wget-hsts | ||
.bash_history | ||
.byebug_history | ||
.solargraph.yml | ||
|
||
!public/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 22 additions & 8 deletions
30
local-gems/spectrum-json/lib/spectrum/entities/get_this_work_order_option.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,52 @@ | ||
class Spectrum::Entities::GetThisWorkOrderOption | ||
def self.for(item, client=AlmaRestClient.client) | ||
def self.for(item, client = AlmaRestClient.client) | ||
if item.process_type == "WORK_ORDER_DEPARTMENT" | ||
response = client.get("/items", query: {item_barcode: item.barcode}) | ||
raise StandardError if response.code != 200 | ||
self.new(response.parsed_response) | ||
new(response.parsed_response) | ||
else | ||
GetThisWorkOrderNotApplicable.new | ||
end | ||
rescue | ||
GetThisWorkOrderNotApplicable.new | ||
GetThisWorkOrderNotApplicable.new | ||
end | ||
|
||
def initialize(data) | ||
@data = data | ||
end | ||
|
||
def in_labeling? | ||
["Labeling"].include?(@data.dig("item_data","work_order_type","value")) | ||
["Labeling"].include?(@data.dig("item_data", "work_order_type", "value")) | ||
end | ||
|
||
def in_getable_acq_work_order? | ||
in_international_studies_acquisitions_technical_services? || in_asia_backlog? | ||
end | ||
|
||
def in_international_studies_acquisitions_technical_services? | ||
["AcqWorkOrder"].include?(@data.dig("item_data","work_order_type","value")) && | ||
["IS-SEEES"].include?(@data.dig("item_data","location","value")) | ||
["AcqWorkOrder"].include?(@data.dig("item_data", "work_order_type", "value")) && | ||
["IS-SEEES"].include?(@data.dig("item_data", "location", "value")) | ||
end | ||
|
||
def in_asia_backlog? | ||
["AcqWorkOrder"].include?(@data.dig("item_data", "work_order_type", "value")) && | ||
["ASIA"].include?(@data.dig("item_data", "location", "value")) | ||
end | ||
|
||
|
||
class GetThisWorkOrderNotApplicable < self | ||
def initialize | ||
end | ||
|
||
def in_international_studies_acquisitions_technical_services? | ||
false | ||
end | ||
|
||
def in_labeling? | ||
false | ||
end | ||
end | ||
|
||
def in_getable_acq_work_order? | ||
false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters