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,36 @@
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 ScanForms
12
+ def initialize(http, ws_id_proc)
13
+ @http = http
14
+ @ws_id = ws_id_proc
15
+ end
16
+
17
+ def create(request)
18
+ @http.post("#{ws_path}/scan-forms", body: request)
19
+ end
20
+
21
+ def list
22
+ @http.get("#{ws_path}/scan-forms")
23
+ end
24
+
25
+ def get(scan_form_id)
26
+ @http.get("#{ws_path}/scan-forms/#{scan_form_id}")
27
+ end
28
+
29
+ private
30
+
31
+ def ws_path
32
+ "/api/workspaces/#{@ws_id.call}"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,84 @@
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 Shipping
12
+ def initialize(http, ws_id_proc)
13
+ @http = http
14
+ @ws_id = ws_id_proc
15
+ end
16
+
17
+ def get_rates(request)
18
+ @http.post("#{ws_path}/shipping/rates", body: request)
19
+ end
20
+
21
+ def get_cheapest_rate(request)
22
+ @http.post("#{ws_path}/shipping/rates/cheapest", body: request)
23
+ end
24
+
25
+ def get_fastest_rate(request)
26
+ @http.post("#{ws_path}/shipping/rates/fastest", body: request)
27
+ end
28
+
29
+ def create_label(request)
30
+ @http.post("#{ws_path}/shipping/labels", body: request)
31
+ end
32
+
33
+ def cancel_label(label_id)
34
+ @http.delete("#{ws_path}/shipping/labels/#{label_id}")
35
+ end
36
+
37
+ def track(tracking_number)
38
+ @http.get("#{ws_path}/shipping/track/#{tracking_number}")
39
+ end
40
+
41
+ def validate_address(address)
42
+ @http.post("#{ws_path}/shipping/addresses/validate", body: address)
43
+ end
44
+
45
+ def create_batch(request)
46
+ @http.post("#{ws_path}/labels/batch", body: request)
47
+ end
48
+
49
+ def preview_batch(request)
50
+ @http.post("#{ws_path}/labels/batch/preview", body: request)
51
+ end
52
+
53
+ def get_batch_status(job_id)
54
+ @http.get("#{ws_path}/labels/batch/#{job_id}")
55
+ end
56
+
57
+ def download_batch_label(job_id, item_id)
58
+ @http.get("#{ws_path}/labels/batch/#{job_id}/items/#{item_id}/label")
59
+ end
60
+
61
+ def get_carriers
62
+ @http.get("#{ws_path}/shipping/carriers")
63
+ end
64
+
65
+ def get_recommendations(request)
66
+ @http.post("#{ws_path}/shipping/recommendations", body: request)
67
+ end
68
+
69
+ def predict_delivery(request)
70
+ @http.post("#{ws_path}/shipping/predictions/delivery", body: request)
71
+ end
72
+
73
+ def get_savings
74
+ @http.get("#{ws_path}/shipping/savings")
75
+ end
76
+
77
+ private
78
+
79
+ def ws_path
80
+ "/api/workspaces/#{@ws_id.call}"
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,41 @@
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 Wallet
12
+ def initialize(http, ws_id_proc)
13
+ @http = http
14
+ @ws_id = ws_id_proc
15
+ end
16
+
17
+ def get_balance
18
+ @http.get("#{ws_path}/wallet/balance")
19
+ end
20
+
21
+ def add_funds(amount)
22
+ @http.post("#{ws_path}/wallet/add-funds", body: { amount: amount })
23
+ end
24
+
25
+ def list_transactions(page: nil, page_size: nil, start_date: nil, end_date: nil)
26
+ query = { page: page, pageSize: page_size, startDate: start_date, endDate: end_date }.compact
27
+ @http.get("#{ws_path}/wallet/transactions", query: query.empty? ? nil : query)
28
+ end
29
+
30
+ def configure_auto_reload(enabled:, threshold: nil, amount: nil)
31
+ @http.put("#{ws_path}/wallet/auto-reload", body: { enabled: enabled, threshold: threshold, amount: amount }.compact)
32
+ end
33
+
34
+ private
35
+
36
+ def ws_path
37
+ "/api/workspaces/#{@ws_id.call}"
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,59 @@
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
+ require "openssl"
10
+
11
+ module FlexOps
12
+ module Resources
13
+ class Webhooks
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}/webhooks")
21
+ end
22
+
23
+ def get(webhook_id)
24
+ @http.get("#{ws_path}/webhooks/#{webhook_id}")
25
+ end
26
+
27
+ def create(request)
28
+ @http.post("#{ws_path}/webhooks", body: request)
29
+ end
30
+
31
+ def update(webhook_id, data)
32
+ @http.put("#{ws_path}/webhooks/#{webhook_id}", body: data)
33
+ end
34
+
35
+ def delete(webhook_id)
36
+ @http.delete("#{ws_path}/webhooks/#{webhook_id}")
37
+ end
38
+
39
+ def rotate_secret(webhook_id)
40
+ @http.post("#{ws_path}/webhooks/#{webhook_id}/rotate-secret")
41
+ end
42
+
43
+ def list_delivery_logs(webhook_id)
44
+ @http.get("#{ws_path}/webhooks/#{webhook_id}/deliveries")
45
+ end
46
+
47
+ def self.verify_signature(payload, signature, secret)
48
+ expected = OpenSSL::HMAC.hexdigest("SHA256", secret, payload)
49
+ OpenSSL.secure_compare(expected, signature)
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,53 @@
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 Workspaces
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("/api/workspaces")
19
+ end
20
+
21
+ def get(workspace_id = nil)
22
+ id = workspace_id || @ws_id.call
23
+ @http.get("/api/workspaces/#{id}")
24
+ end
25
+
26
+ def create(request)
27
+ @http.post("/api/workspaces", body: request)
28
+ end
29
+
30
+ def update(data)
31
+ @http.put("/api/workspaces/#{@ws_id.call}", body: data)
32
+ end
33
+
34
+ def list_members
35
+ @http.get("/api/workspaces/#{@ws_id.call}/members")
36
+ end
37
+
38
+ def invite_member(email:, role: nil)
39
+ body = { email: email }
40
+ body[:role] = role if role
41
+ @http.post("/api/workspaces/#{@ws_id.call}/members/invite", body: body)
42
+ end
43
+
44
+ def remove_member(user_id)
45
+ @http.delete("/api/workspaces/#{@ws_id.call}/members/#{user_id}")
46
+ end
47
+
48
+ def update_member_role(user_id, role)
49
+ @http.put("/api/workspaces/#{@ws_id.call}/members/#{user_id}/role", body: { role: role })
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,11 @@
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
+ VERSION = "1.0.0"
11
+ end
data/lib/flexops.rb ADDED
@@ -0,0 +1,35 @@
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
+ require_relative "flexops/version"
10
+ require_relative "flexops/errors"
11
+ require_relative "flexops/http"
12
+ require_relative "flexops/client"
13
+ require_relative "flexops/resources/auth"
14
+ require_relative "flexops/resources/workspaces"
15
+ require_relative "flexops/resources/shipping"
16
+ require_relative "flexops/resources/carriers"
17
+ require_relative "flexops/resources/webhooks"
18
+ require_relative "flexops/resources/wallet"
19
+ require_relative "flexops/resources/insurance"
20
+ require_relative "flexops/resources/returns"
21
+ require_relative "flexops/resources/api_keys"
22
+ require_relative "flexops/resources/analytics"
23
+ require_relative "flexops/resources/orders"
24
+ require_relative "flexops/resources/inventory"
25
+ require_relative "flexops/resources/pickups"
26
+ require_relative "flexops/resources/scan_forms"
27
+ require_relative "flexops/resources/rules"
28
+ require_relative "flexops/resources/offsets"
29
+ require_relative "flexops/resources/hs_codes"
30
+ require_relative "flexops/resources/recurring_shipments"
31
+ require_relative "flexops/resources/email_templates"
32
+ require_relative "flexops/resources/reports"
33
+
34
+ module FlexOps
35
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flexops
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - FlexOps, LLC
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: json
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '2.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.13'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.13'
40
+ - !ruby/object:Gem::Dependency
41
+ name: webmock
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.24'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.24'
54
+ description: Ruby SDK for the FlexOps multi-carrier shipping platform API. Supports
55
+ USPS, UPS, FedEx, DHL with rate shopping, label generation, tracking, webhooks,
56
+ wallet, insurance, returns, and more.
57
+ email:
58
+ - support@flexops.io
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - LICENSE
64
+ - README.md
65
+ - lib/flexops.rb
66
+ - lib/flexops/client.rb
67
+ - lib/flexops/errors.rb
68
+ - lib/flexops/http.rb
69
+ - lib/flexops/resources/analytics.rb
70
+ - lib/flexops/resources/api_keys.rb
71
+ - lib/flexops/resources/auth.rb
72
+ - lib/flexops/resources/carriers.rb
73
+ - lib/flexops/resources/email_templates.rb
74
+ - lib/flexops/resources/hs_codes.rb
75
+ - lib/flexops/resources/insurance.rb
76
+ - lib/flexops/resources/inventory.rb
77
+ - lib/flexops/resources/offsets.rb
78
+ - lib/flexops/resources/orders.rb
79
+ - lib/flexops/resources/pickups.rb
80
+ - lib/flexops/resources/recurring_shipments.rb
81
+ - lib/flexops/resources/reports.rb
82
+ - lib/flexops/resources/returns.rb
83
+ - lib/flexops/resources/rules.rb
84
+ - lib/flexops/resources/scan_forms.rb
85
+ - lib/flexops/resources/shipping.rb
86
+ - lib/flexops/resources/wallet.rb
87
+ - lib/flexops/resources/webhooks.rb
88
+ - lib/flexops/resources/workspaces.rb
89
+ - lib/flexops/version.rb
90
+ homepage: https://github.com/BillEisenman/flexops-sdk-ruby
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '3.1'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubygems_version: 3.6.9
109
+ specification_version: 4
110
+ summary: Official FlexOps multi-carrier shipping platform SDK
111
+ test_files: []