flexops 1.0.0

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.
@@ -0,0 +1,129 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-08
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ module FlexOps
10
+ module Resources
11
+ class Carriers
12
+ attr_reader :usps, :ups, :fedex, :dhl
13
+
14
+ def initialize(http)
15
+ @http = http
16
+ @usps = UspsCarrier.new(http)
17
+ @ups = UpsCarrier.new(http)
18
+ @fedex = FedExCarrier.new(http)
19
+ @dhl = DhlCarrier.new(http)
20
+ end
21
+ end
22
+
23
+ class UspsCarrier
24
+ PROXY = "/api/ApiProxy"
25
+
26
+ def initialize(http)
27
+ @http = http
28
+ end
29
+
30
+ def validate_address(params) = @http.get("#{PROXY}/api/v3/AddressValidation/getUspsValidateAndCorrectAddress", query: params)
31
+ def city_state_lookup(zip_code) = @http.get("#{PROXY}/api/v3/AddressValidation/getUspsCityStateLookupByZipCode", query: { zipCode: zip_code })
32
+ def zip_code_lookup(params) = @http.get("#{PROXY}/api/v3/AddressValidation/getUspsZipCodeLookupByAddress", query: params)
33
+ def get_domestic_rates(body) = @http.post("#{PROXY}/api/v3/RateCalculator/postUspsSearchDomesticBaseRates", body: body)
34
+ def get_domestic_products(body) = @http.post("#{PROXY}/api/v3/RateCalculator/postUspsSearchEligibleDomesticProducts", body: body)
35
+ def get_domestic_prices(body) = @http.post("#{PROXY}/api/v3/RateCalculator/postUspsSearchEligibleDomesticPrices", body: body)
36
+ def get_international_rates(body) = @http.post("#{PROXY}/api/v3/RateCalculator/postUspsSearchInternationalBaseRates", body: body)
37
+ def get_international_prices(body) = @http.post("#{PROXY}/api/v3/RateCalculator/postUspsSearchEligibleInternationalPrices", body: body)
38
+ def create_domestic_label(body) = @http.post("#{PROXY}/api/v3/Shipping/postUspsGenerateDomesticShippingLabel", body: body)
39
+ def create_return_label(body) = @http.post("#{PROXY}/api/v3/Shipping/postUspsGenerateDomesticReturnsShippingLabel", body: body)
40
+ def create_international_label(body) = @http.post("#{PROXY}/api/v3/Shipping/postUspsGenerateInternationalShippingLabel", body: body)
41
+ def cancel_domestic_label = @http.delete("#{PROXY}/api/v3/Shipping/cancelUspsDomesticShipmentLabel")
42
+ def cancel_international_label = @http.delete("#{PROXY}/api/v3/Shipping/cancelUspsInternationalShipmentLabel")
43
+ def track_summary(params) = @http.get("#{PROXY}/api/v3/Tracking/getUspsTrackingSummaryInformation", query: params)
44
+ def track_detail(params) = @http.get("#{PROXY}/api/v3/Tracking/getUspsTrackingDetailInformation", query: params)
45
+ def create_pickup(body) = @http.post("#{PROXY}/api/v3/CarrierPickup/postUspsCreateCarrierPickupSchedule", body: body)
46
+ def cancel_pickup = @http.delete("#{PROXY}/api/v3/CarrierPickup/cancelUspsCarrierPickupSchedule")
47
+ def create_scan_form(body) = @http.post("#{PROXY}/api/v3/ScanForm/postUspsCreateScanFormLabelShipment", body: body)
48
+ def delivery_standards(params) = @http.get("#{PROXY}/api/v3/ServiceStandards/getUspsGetDeliveryStandardsEstimates", query: params)
49
+ def find_drop_off_locations(params) = @http.get("#{PROXY}/api/v3/LocationSearch/getUspsFindValidDropOffLocations", query: params)
50
+ def find_post_offices(params) = @http.get("#{PROXY}/api/v3/LocationSearch/getUspsFindValidPostOfficeLocations", query: params)
51
+ end
52
+
53
+ class UpsCarrier
54
+ PROXY = "/api/ApiProxy"
55
+
56
+ def initialize(http)
57
+ @http = http
58
+ end
59
+
60
+ def validate_address(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsVerifyAddress", body: body)
61
+ def get_rates(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsRateCheck", body: body)
62
+ def create_label(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/generateNewUpsShipLabel", body: body)
63
+ def track(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getSingleUpsTrackingDetail", query: params)
64
+ def create_pickup(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsCreatePickup", body: body)
65
+ def cancel_pickup = @http.delete("#{PROXY}/api/v2/ShippingLabel/deleteUpsPickup")
66
+ def get_transit_times(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsGetTransitTimes", body: body)
67
+ def get_landed_cost(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsGetLandedCostQuote", body: body)
68
+ def search_locations(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsSearchLocations", body: body)
69
+ def upload_document(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsUploadPaperlessDocument", body: body)
70
+ def create_freight_shipment(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsCreateFreightShipment", body: body)
71
+ def get_freight_rate(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postUpsGetFreightRate", body: body)
72
+ end
73
+
74
+ class FedExCarrier
75
+ PROXY = "/api/ApiProxy"
76
+
77
+ def initialize(http)
78
+ @http = http
79
+ end
80
+
81
+ def validate_address(body) = @http.post("#{PROXY}/api/v3/AddressValidation/postFedExValidateAndCorrectDomesticAddress", body: body)
82
+ def validate_postal_code(body) = @http.post("#{PROXY}/api/v3/AddressValidation/postFedExValidatePostalCode", body: body)
83
+ def get_rates(body) = @http.post("#{PROXY}/api/v3/RateCalculator/postRetrieveFedExRateAndTransitTimesAsync", body: body)
84
+ def create_shipment(body) = @http.post("#{PROXY}/api/v3/Shipping/postFedExCreateNewShipment", body: body)
85
+ def cancel_shipment(body) = @http.put("#{PROXY}/api/v3/Shipping/putFedExCancelShipment", body: body)
86
+ def validate_shipment(body) = @http.post("#{PROXY}/api/v3/Shipping/postFedExValidateShipment", body: body)
87
+ def create_return_shipment(body) = @http.post("#{PROXY}/api/v3/Shipping/postFedExCreateNewReturnShipment", body: body)
88
+ def track(body) = @http.post("#{PROXY}/api/v3/Tracking/postFedExRetrieveTrackingInfoByTrackingNumber", body: body)
89
+ def track_multi_piece(body) = @http.post("#{PROXY}/api/v3/Tracking/postFedExRetrieveTrackingInfoForMultiPieceShipment", body: body)
90
+ def register_tracking_notification(body) = @http.post("#{PROXY}/api/v3/Tracking/postFedExRegisterForTrackingNotification", body: body)
91
+ def create_pickup(body) = @http.post("#{PROXY}/api/v3/CarrierPickup/postFedExCreateCarrierPickupRequest", body: body)
92
+ def cancel_pickup(body) = @http.put("#{PROXY}/api/v3/CarrierPickup/putFedExCancelCarrierPickupRequest", body: body)
93
+ def search_locations(body) = @http.post("#{PROXY}/api/v3/LocationSearch/postFedExSearchValidLocations", body: body)
94
+ def get_service_standards(body) = @http.post("#{PROXY}/api/v3/ServiceStandards/postFedExRetrieveServicesAndTransitTimes", body: body)
95
+ def get_freight_rate(body) = @http.post("#{PROXY}/api/v3/Freight/postFedExGetFreightRateQuote", body: body)
96
+ def create_freight_shipment(body) = @http.post("#{PROXY}/api/v3/Freight/postFedExCreateFreightShipment", body: body)
97
+ def ground_close(body) = @http.post("#{PROXY}/api/v3/GroundClose/postFedExCloseWithDocuments", body: body)
98
+ def upload_trade_documents(body) = @http.post("#{PROXY}/api/v3/Trade/postFedExUploadTradeDocuments", body: body)
99
+ def create_open_shipment(body) = @http.post("#{PROXY}/api/v3/OpenShip/postFedExCreateOpenShipment", body: body)
100
+ def add_packages_to_open_shipment(body) = @http.post("#{PROXY}/api/v3/OpenShip/postFedExAddPackagesToOpenShipment", body: body)
101
+ def confirm_open_shipment(body) = @http.post("#{PROXY}/api/v3/OpenShip/postFedExConfirmOpenShipment", body: body)
102
+ end
103
+
104
+ class DhlCarrier
105
+ PROXY = "/api/ApiProxy"
106
+
107
+ def initialize(http)
108
+ @http = http
109
+ end
110
+
111
+ def validate_address(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getDhlValidateAddress", query: params)
112
+ def get_rates(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getDhlRates", query: params)
113
+ def get_multi_piece_rates(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postDhlMultiPieceRates", body: body)
114
+ def get_products(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getDhlProducts", query: params)
115
+ def create_shipment(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postDhlCreateShipment", body: body)
116
+ def track(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getDhlTrackSingleShipment", query: params)
117
+ def track_multiple(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getDhlTrackMultipleShipments", query: params)
118
+ def create_pickup(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postDhlCreatePickup", body: body)
119
+ def update_pickup(body) = @http.patch("#{PROXY}/api/v2/ShippingLabel/patchDhlUpdatePickup", body: body)
120
+ def cancel_pickup = @http.delete("#{PROXY}/api/v2/ShippingLabel/deleteDhlPickup")
121
+ def calculate_landed_cost(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postDhlCalculateLandedCost", body: body)
122
+ def screen_shipment(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postDhlScreenShipment", body: body)
123
+ def upload_invoice(body) = @http.post("#{PROXY}/api/v2/ShippingLabel/postDhlUploadInvoice", body: body)
124
+ def get_proof_of_delivery(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getDhlElectronicProofOfDelivery", query: params)
125
+ def get_reference_data(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getDhlReferenceData", query: params)
126
+ def find_service_points(params) = @http.get("#{PROXY}/api/v2/ShippingLabel/getDhlServicePoints", query: params)
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,50 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-31
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ # frozen_string_literal: true
10
+
11
+ module FlexOps
12
+ module Resources
13
+ class EmailTemplates
14
+ def initialize(http, ws_id_proc)
15
+ @http = http
16
+ @ws_id = ws_id_proc
17
+ end
18
+
19
+ def list
20
+ @http.get("#{ws_path}/shipment-email-templates/")
21
+ end
22
+
23
+ def get(id)
24
+ @http.get("#{ws_path}/shipment-email-templates/#{id}")
25
+ end
26
+
27
+ def create(request)
28
+ @http.post("#{ws_path}/shipment-email-templates/", body: request)
29
+ end
30
+
31
+ def update(id, request)
32
+ @http.put("#{ws_path}/shipment-email-templates/#{id}", body: request)
33
+ end
34
+
35
+ def delete(id)
36
+ @http.delete("#{ws_path}/shipment-email-templates/#{id}")
37
+ end
38
+
39
+ def preview(id, context = {})
40
+ @http.post("#{ws_path}/shipment-email-templates/#{id}/preview", body: context)
41
+ end
42
+
43
+ private
44
+
45
+ def ws_path
46
+ "/api/workspaces/#{@ws_id.call}"
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,39 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-31
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ # frozen_string_literal: true
10
+
11
+ module FlexOps
12
+ module Resources
13
+ class HsCodes
14
+ def initialize(http, ws_id_proc)
15
+ @http = http
16
+ @ws_id = ws_id_proc
17
+ end
18
+
19
+ def search(query, destination_country: nil, max_results: 10)
20
+ params = { query: query, destinationCountry: destination_country, maxResults: max_results }.compact
21
+ @http.get("#{ws_path}/shipping/hs-codes/search", query: params)
22
+ end
23
+
24
+ def lookup(code)
25
+ @http.get("#{ws_path}/shipping/hs-codes/#{code}")
26
+ end
27
+
28
+ def estimate_landed_cost(request)
29
+ @http.post("#{ws_path}/shipping/landed-cost", body: request)
30
+ end
31
+
32
+ private
33
+
34
+ def ws_path
35
+ "/api/workspaces/#{@ws_id.call}"
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,48 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-08
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ module FlexOps
10
+ module Resources
11
+ class Insurance
12
+ def initialize(http, ws_id_proc)
13
+ @http = http
14
+ @ws_id = ws_id_proc
15
+ end
16
+
17
+ def get_providers
18
+ @http.get("#{ws_path}/insurance/providers")
19
+ end
20
+
21
+ def get_quote(carrier:, declared_value:, provider: nil)
22
+ body = { carrier: carrier, declaredValue: declared_value }
23
+ body[:provider] = provider if provider
24
+ @http.post("#{ws_path}/insurance/quote", body: body)
25
+ end
26
+
27
+ def purchase(tracking_number:, carrier:, declared_value:, provider: nil)
28
+ body = { trackingNumber: tracking_number, carrier: carrier, declaredValue: declared_value }
29
+ body[:provider] = provider if provider
30
+ @http.post("#{ws_path}/insurance/purchase", body: body)
31
+ end
32
+
33
+ def void(policy_id)
34
+ @http.delete("#{ws_path}/insurance/policies/#{policy_id}")
35
+ end
36
+
37
+ def file_claim(policy_id, description:, claim_amount:)
38
+ @http.post("#{ws_path}/insurance/policies/#{policy_id}/claims", body: { description: description, claimAmount: claim_amount })
39
+ end
40
+
41
+ private
42
+
43
+ def ws_path
44
+ "/api/workspaces/#{@ws_id.call}"
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,39 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-08
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ module FlexOps
10
+ module Resources
11
+ class Inventory
12
+ PROXY = "/api/ApiProxy"
13
+
14
+ def initialize(http)
15
+ @http = http
16
+ end
17
+
18
+ def post_asn_receipt(receipt)
19
+ @http.post("#{PROXY}/api/v1/Inventory/postNewAsnReceipt", body: receipt)
20
+ end
21
+
22
+ def get_warehouse_snapshot(params = nil)
23
+ @http.get("#{PROXY}/api/v1/Inventory/getWarehouseInventorySnapshot", query: params)
24
+ end
25
+
26
+ def get_complete_snapshot(params = nil)
27
+ @http.get("#{PROXY}/api/v1/Inventory/getCompleteInventorySnapshot", query: params)
28
+ end
29
+
30
+ def get_part_numbers(params = nil)
31
+ @http.get("#{PROXY}/api/v1/Inventory/getPartNumberList", query: params)
32
+ end
33
+
34
+ def update_inventory(data)
35
+ @http.post("#{PROXY}/api/v2/Inventory/postCustomerInventoryUpdate", body: data)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,38 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-31
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ # frozen_string_literal: true
10
+
11
+ module FlexOps
12
+ module Resources
13
+ class Offsets
14
+ def initialize(http, ws_id_proc)
15
+ @http = http
16
+ @ws_id = ws_id_proc
17
+ end
18
+
19
+ def offset(label_id)
20
+ @http.post("#{ws_path}/shipping/labels/#{label_id}/offset")
21
+ end
22
+
23
+ def get_emissions(label_id)
24
+ @http.get("#{ws_path}/shipping/labels/#{label_id}/emissions")
25
+ end
26
+
27
+ def batch_offset(label_ids)
28
+ @http.post("#{ws_path}/shipping/labels/offset/batch", body: { labelIds: label_ids })
29
+ end
30
+
31
+ private
32
+
33
+ def ws_path
34
+ "/api/workspaces/#{@ws_id.call}"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,67 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-08
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ module FlexOps
10
+ module Resources
11
+ class Orders
12
+ BASE = "/api/ApiProxy/api/v1/Order"
13
+
14
+ def initialize(http)
15
+ @http = http
16
+ end
17
+
18
+ def create(order)
19
+ @http.post("#{BASE}/postNewOrder", body: order)
20
+ end
21
+
22
+ def get_new_orders(params = nil)
23
+ @http.get("#{BASE}/getNewOrderList", query: params)
24
+ end
25
+
26
+ def get_by_status(params = nil)
27
+ @http.get("#{BASE}/getAllOrderListByStatus", query: params)
28
+ end
29
+
30
+ def get_details(order_number)
31
+ @http.get("#{BASE}/getCompleteOrderDetailsByOrderNumber", query: { orderNumber: order_number })
32
+ end
33
+
34
+ def get_extended_details(order_number)
35
+ @http.get("#{BASE}/getExtendedOrderDetailsByOrderNumber", query: { orderNumber: order_number })
36
+ end
37
+
38
+ def get_status(order_number)
39
+ @http.get("#{BASE}/getIndividualOrderStatusByOrderNumber", query: { orderNumber: order_number })
40
+ end
41
+
42
+ def cancel(order_number)
43
+ @http.post("#{BASE}/cancelOrderByOrderNumber", body: { orderNumber: order_number })
44
+ end
45
+
46
+ def get_items(order_number)
47
+ @http.get("#{BASE}/getAllOrderItemsByOrderNumber", query: { orderNumber: order_number })
48
+ end
49
+
50
+ def get_ship_methods
51
+ @http.get("#{BASE}/getAvailableShipMethodsList")
52
+ end
53
+
54
+ def get_warehouses
55
+ @http.get("#{BASE}/getActiveWarehouseList")
56
+ end
57
+
58
+ def get_country_codes
59
+ @http.get("#{BASE}/getCountryNameCodeList")
60
+ end
61
+
62
+ def get_status_types
63
+ @http.get("#{BASE}/getOrderStatusTypesList")
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,40 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-08
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ module FlexOps
10
+ module Resources
11
+ class Pickups
12
+ def initialize(http, ws_id_proc)
13
+ @http = http
14
+ @ws_id = ws_id_proc
15
+ end
16
+
17
+ def schedule(request)
18
+ @http.post("#{ws_path}/pickups", body: request)
19
+ end
20
+
21
+ def list
22
+ @http.get("#{ws_path}/pickups")
23
+ end
24
+
25
+ def get(pickup_id)
26
+ @http.get("#{ws_path}/pickups/#{pickup_id}")
27
+ end
28
+
29
+ def cancel(pickup_id)
30
+ @http.delete("#{ws_path}/pickups/#{pickup_id}")
31
+ end
32
+
33
+ private
34
+
35
+ def ws_path
36
+ "/api/workspaces/#{@ws_id.call}"
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,59 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-31
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ # frozen_string_literal: true
10
+
11
+ module FlexOps
12
+ module Resources
13
+ class RecurringShipments
14
+ def initialize(http, ws_id_proc)
15
+ @http = http
16
+ @ws_id = ws_id_proc
17
+ end
18
+
19
+ def list(page: nil, page_size: nil, is_active: nil)
20
+ query = { page: page, pageSize: page_size, isActive: is_active }.compact
21
+ @http.get("#{ws_path}/recurring-shipments/", query: query.empty? ? nil : query)
22
+ end
23
+
24
+ def get(id)
25
+ @http.get("#{ws_path}/recurring-shipments/#{id}")
26
+ end
27
+
28
+ def create(request)
29
+ @http.post("#{ws_path}/recurring-shipments/", body: request)
30
+ end
31
+
32
+ def update(id, request)
33
+ @http.put("#{ws_path}/recurring-shipments/#{id}", body: request)
34
+ end
35
+
36
+ def delete(id)
37
+ @http.delete("#{ws_path}/recurring-shipments/#{id}")
38
+ end
39
+
40
+ def pause(id)
41
+ @http.post("#{ws_path}/recurring-shipments/#{id}/pause")
42
+ end
43
+
44
+ def resume(id)
45
+ @http.post("#{ws_path}/recurring-shipments/#{id}/resume")
46
+ end
47
+
48
+ def trigger(id)
49
+ @http.post("#{ws_path}/recurring-shipments/#{id}/trigger")
50
+ end
51
+
52
+ private
53
+
54
+ def ws_path
55
+ "/api/workspaces/#{@ws_id.call}"
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,46 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-31
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ # frozen_string_literal: true
10
+
11
+ module FlexOps
12
+ module Resources
13
+ class Reports
14
+ def initialize(http, ws_id_proc)
15
+ @http = http
16
+ @ws_id = ws_id_proc
17
+ end
18
+
19
+ def list
20
+ @http.get("#{ws_path}/report-schedules/")
21
+ end
22
+
23
+ def get(id)
24
+ @http.get("#{ws_path}/report-schedules/#{id}")
25
+ end
26
+
27
+ def create(request)
28
+ @http.post("#{ws_path}/report-schedules/", body: request)
29
+ end
30
+
31
+ def update(id, request)
32
+ @http.put("#{ws_path}/report-schedules/#{id}", body: request)
33
+ end
34
+
35
+ def delete(id)
36
+ @http.delete("#{ws_path}/report-schedules/#{id}")
37
+ end
38
+
39
+ private
40
+
41
+ def ws_path
42
+ "/api/workspaces/#{@ws_id.call}"
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,61 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-08
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ module FlexOps
10
+ module Resources
11
+ class Returns
12
+ def initialize(http, ws_id_proc)
13
+ @http = http
14
+ @ws_id = ws_id_proc
15
+ end
16
+
17
+ def list(page: nil, page_size: nil, status: nil)
18
+ query = { page: page, pageSize: page_size, status: status }.compact
19
+ @http.get("#{ws_path}/returns", query: query.empty? ? nil : query)
20
+ end
21
+
22
+ def get(return_id)
23
+ @http.get("#{ws_path}/returns/#{return_id}")
24
+ end
25
+
26
+ def create(request)
27
+ @http.post("#{ws_path}/returns", body: request)
28
+ end
29
+
30
+ def approve(return_id)
31
+ @http.post("#{ws_path}/returns/#{return_id}/approve")
32
+ end
33
+
34
+ def reject(return_id, reason)
35
+ @http.post("#{ws_path}/returns/#{return_id}/reject", body: { reason: reason })
36
+ end
37
+
38
+ def cancel(return_id)
39
+ @http.post("#{ws_path}/returns/#{return_id}/cancel")
40
+ end
41
+
42
+ def generate_label(return_id)
43
+ @http.post("#{ws_path}/returns/#{return_id}/label")
44
+ end
45
+
46
+ def mark_received(return_id, items)
47
+ @http.post("#{ws_path}/returns/#{return_id}/receive", body: { items: items })
48
+ end
49
+
50
+ def process_refund(return_id)
51
+ @http.post("#{ws_path}/returns/#{return_id}/refund")
52
+ end
53
+
54
+ private
55
+
56
+ def ws_path
57
+ "/api/workspaces/#{@ws_id.call}"
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,48 @@
1
+ # ***********************************************************************
2
+ # Package : flexops
3
+ # Author : FlexOps, LLC
4
+ # Created : 2026-03-08
5
+ #
6
+ # Copyright (c) 2021-2026 by FlexOps, LLC. All rights reserved.
7
+ # ***********************************************************************
8
+
9
+ module FlexOps
10
+ module Resources
11
+ class Rules
12
+ def initialize(http, ws_id_proc)
13
+ @http = http
14
+ @ws_id = ws_id_proc
15
+ end
16
+
17
+ def list
18
+ @http.get("#{ws_path}/shipping-rules")
19
+ end
20
+
21
+ def get(rule_id)
22
+ @http.get("#{ws_path}/shipping-rules/#{rule_id}")
23
+ end
24
+
25
+ def create(rule)
26
+ @http.post("#{ws_path}/shipping-rules", body: rule)
27
+ end
28
+
29
+ def update(rule_id, rule)
30
+ @http.put("#{ws_path}/shipping-rules/#{rule_id}", body: rule)
31
+ end
32
+
33
+ def delete(rule_id)
34
+ @http.delete("#{ws_path}/shipping-rules/#{rule_id}")
35
+ end
36
+
37
+ def reorder(rule_ids)
38
+ @http.put("#{ws_path}/shipping-rules/reorder", body: rule_ids)
39
+ end
40
+
41
+ private
42
+
43
+ def ws_path
44
+ "/api/workspaces/#{@ws_id.call}"
45
+ end
46
+ end
47
+ end
48
+ end