ruby-onfleet 1.0.4 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 471ca6ebbd3bc9644207244c2b19d8d60ff9221e6c3e19a50e53e9e1411db11d
4
- data.tar.gz: 5e7c98f994113bd8ce492770398868e786522630bd0b222d3a9d9fae986b47cc
3
+ metadata.gz: 255756c91bf47c71619555d33e379c62da3f860352bdad2fb7f14c0d61c78171
4
+ data.tar.gz: 4cc8ee7a255e12669f40b7b4c74977b0e15774ee04a9ba2ae7236f74899b2529
5
5
  SHA512:
6
- metadata.gz: 743882b728bfcdecd669d8d72799705a16dceaa89947c6eafaf83791d04913221f557e78abac56129f599c38f5ed434798854b3ea2ba1660b7acc355444d77ea
7
- data.tar.gz: f276fe5e4e1c895c95cb78151dd8514a6e10a5a854efd5b4e5bb7704714e0d9e9625c98e7cb1a6b2904076e8e3e4f86468fe6d3dac15bad6a777cf34ac367a9c
6
+ metadata.gz: f9b69f6a007f3343cb257e0ec1b6b581567a499a2e47c66775d9e62a6290ec5a044e28ef82b44c7e21205af7ad3ef3f68ed72d419491d3deebff59b4f7a949fd
7
+ data.tar.gz: 9f6bae5ca0e0c69c0d3e47eda842a8747ec465fe60244a9564eb5c482efec669a1a34b0e2004fbe843026f5e51bc0d46fb9a0c0a9ffa14787d70da2fccd3f7bd
data/CHANGELOG.md CHANGED
@@ -4,13 +4,28 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [1.0.0](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.0) - 2023-05-11
7
+ ## [Unreleased]
8
+ ## [1.1.0](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.1.0) - 2025-10-16
8
9
  Added
9
- * Initial release on RubyGems
10
+ * New CRUD operations for Route Plans
11
+ * New `create` endpoint
12
+ * New `get` endpoint(s) that support both id and query
13
+ * New `update` endpoint
14
+ * New `delete_one` endpoint
15
+ * New `add_tasks_to_route_plan` endpoint
10
16
 
11
- ## [1.0.1](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.1) - 2023-05-12
17
+ ## [1.0.5](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.5) - 2024-06-26
12
18
  Added
13
- * Refactored resources for module/class inheritance
19
+ * Update to RubyGems release
20
+
21
+ ## [1.0.4](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.4) - 2024-05-29
22
+ Added
23
+ * Added support for Worker's Route Delivery Manifest
24
+
25
+ ## [1.0.3](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.3) - 2023-06-05
26
+ Added
27
+ * Updated package.json to reference relative path
28
+ * Updated utils.rb to require error classes
14
29
 
15
30
  ## [1.0.2](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.2) - 2023-05-19
16
31
  Added
@@ -18,11 +33,13 @@ Added
18
33
  * Included throttling constraints for 20 API requests per second using faraday-rate_limiter
19
34
  * Updated headers on initialization to allow for custom headers
20
35
 
21
- ## [1.0.3](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.3) - 2023-06-05
36
+ ## [1.0.1](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.1) - 2023-05-12
22
37
  Added
23
- * Updated package.json to reference relative path
24
- * Updated utils.rb to require error classes
38
+ * Refactored resources for module/class inheritance
25
39
 
26
- ## [1.0.4](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.4) - 2024-05-29
40
+ ## [1.0.0](https://github.com/onfleet/ruby-onfleet/releases/tag/v1.0.0) - 2023-05-11
27
41
  Added
28
- * Added support for Worker's Route Delivery Manifest
42
+ * Initial release on RubyGems
43
+
44
+ [Unreleased]: https://github.com/onfleet/ruby-onfleet/compare/v1.1.0...HEAD
45
+ [1.0.0]: https://github.com/onfleet/ruby-onfleet/releases/tag/v1.1.0
data/Gemfile CHANGED
@@ -1,11 +1,9 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- gem 'faraday'
4
- gem 'faraday-net_http'
5
- gem 'faraday-rate_limiter'
6
- gem 'json'
7
- gem 'rspec'
8
- gem 'uri'
9
- gem 'webmock'
10
-
11
- gemspec
3
+ gem "uri", "~> 1.0"
4
+ gem "faraday"
5
+ gem "faraday-net_http"
6
+ gem "faraday-rate_limiter"
7
+ gem "json"
8
+ gem "rspec"
9
+ gem "webmock"
data/README.es.md CHANGED
@@ -86,6 +86,7 @@ Estas son las operaciones disponibles para cada endpoint:
86
86
  |[hubs](https://docs.onfleet.com/reference/hubs)|list()|create(body={})|update(id, body={})|x|
87
87
  |[organizations](https://docs.onfleet.com/reference/organizations)|get(delegateeId=nil)|x|insert_task(orgId, body={})|x|
88
88
  |[recipients](https://docs.onfleet.com/reference/recipients)|get(id)<br />get_by_name(name)<br />get_by_phone(phone)|create(body={})<br />match_metadata(body={})|update(id, body={})|x|
89
+ |[routeplans](https://docs.onfleet.com/reference/routeplan#/) | get(id)<br />get(body={}) | create(body={}) | update(id, body={})<br />add_tasks_to_routeplan(id, body={}) | delete_one(id) |
89
90
  |[tasks](https://docs.onfleet.com/reference/tasks)|get(id)<br />list(queryParameters={})<br />get_by_short_id(shortId)|create(body={})<br />batch_create(body={})<br />batch_create_async(body={})<br />complete(id, body={})<br />clone(id)<br />auto_assign(body={})<br />match_metadata(body={})|update(id, body={})|delete(id)|
90
91
  |[teams](https://docs.onfleet.com/reference/teams)|get(id)<br />list()<br />driver_time_estimate(workerId, queryParameters={})<br />get_unassigned_tasks(id)|create(body={})<br />auto_dispatch(id, body={})|update(id, body={})<br />insert_task(teamId, body={})|delete(id)|
91
92
  |[webhooks](https://docs.onfleet.com/reference/webhooks)|list()|create(body={})|X|delete(id)|
data/README.md CHANGED
@@ -84,6 +84,7 @@ Here are the operations available for each entity:
84
84
  |[hubs](https://docs.onfleet.com/reference/hubs)|list()|create(body={})|update(id, body={})|x|
85
85
  |[organizations](https://docs.onfleet.com/reference/organizations)|get(delegateeId=nil)|x|insert_task(orgId, body={})|x|
86
86
  |[recipients](https://docs.onfleet.com/reference/recipients)|get(id)<br />get_by_name(name)<br />get_by_phone(phone)|create(body={})<br />match_metadata(body={})|update(id, body={})|x|
87
+ |[routeplans](https://docs.onfleet.com/reference/routeplan#/) | get(id)<br />get(body={}) | create(body={}) | update(id, body={})<br />add_tasks_to_routeplan(id, body={}) | delete_one(id) |
87
88
  |[tasks](https://docs.onfleet.com/reference/tasks)|get(id)<br />list(queryParameters={})<br />get_by_short_id(shortId)|create(body={})<br />batch_create(body={})<br />batch_create_async(body={})<br />complete(id, body={})<br />clone(id)<br />auto_assign(body={})<br />match_metadata(body={})|update(id, body={})|delete(id)|
88
89
  |[teams](https://docs.onfleet.com/reference/teams)|get(id)<br />list()<br />driver_time_estimate(workerId, queryParameters={})<br />get_unassigned_tasks(id)|create(body={})<br />auto_dispatch(id, body={})|update(id, body={})<br />insert_task(teamId, body={})|delete(id)|
89
90
  |[webhooks](https://docs.onfleet.com/reference/webhooks)|list()|create(body={})|X|delete(id)|
data/lib/onfleet.rb CHANGED
@@ -10,6 +10,7 @@ require_relative './resources/destinations'
10
10
  require_relative './resources/hubs'
11
11
  require_relative './resources/organizations'
12
12
  require_relative './resources/recipients'
13
+ require_relative './resources/routeplans'
13
14
  require_relative './resources/tasks'
14
15
  require_relative './resources/teams'
15
16
  require_relative './resources/webhooks'
@@ -17,7 +17,6 @@ module Onfleet
17
17
  Onfleet.request(config, method.to_sym, path)
18
18
  end
19
19
 
20
- # ACTION: still needs to be tested
21
20
  def match_metadata(config, body)
22
21
  method = 'post'
23
22
  path = 'destinations/metadata'
@@ -17,7 +17,6 @@ module Onfleet
17
17
  Onfleet.request(config, method.to_sym, path)
18
18
  end
19
19
 
20
- # ACTION: still needs to be tested
21
20
  def insert_task(config, org_id, body)
22
21
  method = 'put'
23
22
  path = "containers/organizations/#{org_id}"
@@ -39,7 +39,6 @@ module Onfleet
39
39
  Onfleet.request(config, method.to_sym, path)
40
40
  end
41
41
 
42
- # ACTION: still needs to be tested
43
42
  def match_metadata(config, body)
44
43
  method = 'post'
45
44
  path = 'recipients/metadata'
@@ -0,0 +1,53 @@
1
+ require 'uri'
2
+
3
+ require_relative '../onfleet'
4
+
5
+ module Onfleet
6
+ class Routeplans
7
+ def create(config, body)
8
+ method = 'post'
9
+ path = 'routePlans'
10
+
11
+ Onfleet.request(config, method.to_sym, path, body.to_json)
12
+ end
13
+
14
+ def get(config, query_parameters_hash)
15
+ method = 'get'
16
+ # NOTE: parameters included here must be a hash object that is translated to URL query parameters
17
+ # The from parameter is the only required query parameter for this API call - must be formatted in Unix time.
18
+ query_parameters = URI.encode_www_form(query_parameters_hash)
19
+ path = "routePlans?#{query_parameters}"
20
+
21
+ Onfleet.request(config, method.to_sym, path)
22
+ end
23
+
24
+ def get_by_id(config, id)
25
+ method = 'get'
26
+ path = "routePlans/#{id}"
27
+
28
+ Onfleet.request(config, method.to_sym, path)
29
+ end
30
+
31
+ def update(config, id, body)
32
+ method = 'put'
33
+ path = "routePlans/#{id}"
34
+
35
+ Onfleet.request(config, method.to_sym, path, body.to_json)
36
+ end
37
+
38
+ def add_tasks_to_routeplan(config, id, body)
39
+ method = 'put'
40
+ path = "routePlans/#{id}/tasks"
41
+
42
+ Onfleet.request(config, method.to_sym, path, body.to_json)
43
+ end
44
+
45
+ def delete_one(config, id)
46
+ method = 'delete'
47
+ path = "routePlans/#{id}"
48
+
49
+ Onfleet.request(config, method.to_sym, path)
50
+ end
51
+
52
+ end
53
+ end
@@ -15,7 +15,6 @@ module Onfleet
15
15
  Onfleet.request(config, method.to_sym, path, body.to_json)
16
16
  end
17
17
 
18
- # ACTION: still needs to be tested
19
18
  def batch_create(config, body)
20
19
  method = 'post'
21
20
  path = 'tasks/batch'
@@ -23,7 +22,6 @@ module Onfleet
23
22
  Onfleet.request(config, method.to_sym, path, body.to_json)
24
23
  end
25
24
 
26
- # ACTION: still needs to be tested
27
25
  def batch_create_async(config, body)
28
26
  method = 'post'
29
27
  path = 'tasks/batch-async'
@@ -62,7 +60,6 @@ module Onfleet
62
60
  Onfleet.request(config, method.to_sym, path, body.to_json)
63
61
  end
64
62
 
65
- # ACTION: still needs to be tested
66
63
  def complete(config, id, body)
67
64
  method = 'post'
68
65
  path = "tasks/#{id}/complete"
@@ -84,7 +81,6 @@ module Onfleet
84
81
  Onfleet.request(config, method.to_sym, path)
85
82
  end
86
83
 
87
- # ACTION: still needs to be tested
88
84
  def auto_assign(config, body)
89
85
  method = 'post'
90
86
  path = 'tasks/autoAssign'
@@ -92,7 +88,6 @@ module Onfleet
92
88
  Onfleet.request(config, method.to_sym, path, body.to_json)
93
89
  end
94
90
 
95
- # ACTION: still needs to be tested
96
91
  def match_metadata(config, body)
97
92
  method = 'post'
98
93
  path = 'tasks/metadata'
@@ -41,7 +41,7 @@ module Onfleet
41
41
  Onfleet.request(config, method.to_sym, path)
42
42
  end
43
43
 
44
- # ACTION: still needs to be tested
44
+
45
45
  def auto_dispatch(config, id, body)
46
46
  method = 'post'
47
47
  path = "teams/#{id}/dispatch"
@@ -49,7 +49,6 @@ module Onfleet
49
49
  Onfleet.request(config, method.to_sym, path, body.to_json)
50
50
  end
51
51
 
52
- # ACTION: still needs to be tested
53
52
  def driver_time_estimate(config, worker_id, query_parameters_hash = nil)
54
53
  method = 'get'
55
54
 
@@ -63,15 +62,20 @@ module Onfleet
63
62
  Onfleet.request(config, method.to_sym, path)
64
63
  end
65
64
 
66
- # ACTION: still needs to be tested
67
- def get_unassigned_tasks(config, id)
65
+ # ACTION: still needs to be tested - need to include query_parameters
66
+ def get_unassigned_tasks(config, id, query_parameters_hash = nil)
68
67
  method = 'get'
69
- path = "teams/#{id}/tasks"
68
+
69
+ # NOTE: parameters included here must be a hash object that is translated to URL query parameters
70
+ query_parameters = nil
71
+ if query_parameters_hash
72
+ query_parameters = URI.encode_www_form(query_parameters_hash)
73
+ end
74
+ path = "teams/#{id}/tasks?#{query_parameters}"
70
75
 
71
76
  Onfleet.request(config, method.to_sym, path)
72
77
  end
73
78
 
74
- # ACTION: still needs to be tested
75
79
  def insert_task(config, team_id, body)
76
80
  method = 'put'
77
81
  path = "containers/teams/#{team_id}"
@@ -10,7 +10,7 @@ module Onfleet
10
10
  # Any failed requests will be retried in 30-minute cycles, up to one full day.
11
11
  # A failed request is any non-200 response that a webhook request gets from your application.
12
12
  class Webhooks
13
- # ACTION: still needs to be tested
13
+
14
14
  def create(config, body)
15
15
  method = 'post'
16
16
  path = 'webhooks'
@@ -18,7 +18,6 @@ module Onfleet
18
18
  Onfleet.request(config, method.to_sym, path, body.to_json)
19
19
  end
20
20
 
21
- # ACTION: still needs to be tested
22
21
  def list(config)
23
22
  method = 'get'
24
23
  path = 'webhooks'
@@ -26,7 +25,6 @@ module Onfleet
26
25
  Onfleet.request(config, method.to_sym, path)
27
26
  end
28
27
 
29
- # ACTION: still needs to be tested
30
28
  def delete(config, id)
31
29
  method = 'delete'
32
30
  path = "webhooks/#{id}"
@@ -51,7 +51,6 @@ module Onfleet
51
51
  Onfleet.request(config, method.to_sym, path)
52
52
  end
53
53
 
54
- # ACTION: still needs to be tested
55
54
  def get_by_location(config, longitude, latitude, radius = 1000)
56
55
  method = 'get'
57
56
  path = "workers/location?longitude=#{longitude}&latitude=#{latitude}&radius=#{radius}"
@@ -73,7 +72,7 @@ module Onfleet
73
72
  Onfleet.request(config, method.to_sym, path, body.to_json)
74
73
  end
75
74
 
76
- def get_delivery_manifest(config, body, google_api_key, query_parameters_hash)
75
+ def get_delivery_manifest(config, body, google_api_key = nil, query_parameters_hash = nil)
77
76
  method = 'post'
78
77
  query_parameters = nil
79
78
 
@@ -89,7 +88,6 @@ module Onfleet
89
88
  Onfleet.request(config, method.to_sym, path, body.to_json)
90
89
  end
91
90
 
92
- # ACTION: still needs to be tested
93
91
  def insert_task(config, worker_id, body)
94
92
  method = 'put'
95
93
  path = "containers/workers/#{worker_id}"
@@ -97,7 +95,6 @@ module Onfleet
97
95
  Onfleet.request(config, method.to_sym, path, body.to_json)
98
96
  end
99
97
 
100
- # ACTION: still needs to be tested
101
98
  def match_metadata(config, body)
102
99
  method = 'post'
103
100
  path = 'workers/metadata'
@@ -1997,9 +1997,9 @@
1997
1997
  ]
1998
1998
  }
1999
1999
  },
2000
- "getManifestProvider": {
2000
+ "get_delivery_manifest": {
2001
2001
  "request": {
2002
- "path": "providers/manifest/generate?hubId=<hubId>&workerId=<workerId>",
2002
+ "path": "providers/manifest/generate?hubId=kyfYe*wyVbqfomP2HTn5dAe1&workerId=kBUZAb7pREtRn*8wIUCpjnPu",
2003
2003
  "method": "GET"
2004
2004
  },
2005
2005
  "response": {
@@ -15,6 +15,9 @@ require_relative '../resources/teams'
15
15
  require_relative '../resources/webhooks'
16
16
  require_relative '../resources/workers'
17
17
 
18
+ # WebMock blocks HTTP requests in integration tests, but you can either stub the request or call WebMock.allow_net_connect! to configure the tests to run as normal.
19
+ WebMock.allow_net_connect!
20
+
18
21
  # RSpec configuration setup for unit tests
19
22
  RSpec.configure do |config|
20
23
  file = File.read('./test_data.json')
@@ -22,7 +25,7 @@ RSpec.configure do |config|
22
25
  config.test_data = JSON.parse(file)
23
26
 
24
27
  config.add_setting :api_variables
25
- config.api_variables = Onfleet::Configuration.new("f70dd381f0366c721677fb7e088b83bd","https://staging.onfleet.com/api/v2")
28
+ config.api_variables = Onfleet::Configuration.new("f70dd381f0366c721677fb7e088b83bd","https://stable1.onfleet.com/api/v2")
26
29
  end
27
30
 
28
31
  # Administrator entity tests
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onfleet/ruby-onfleet",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "description": "Onfleet's Ruby API wrapper package",
5
5
  "main": "onfleet.rb",
6
6
  "scripts": {
data/ruby-onfleet.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'ruby-onfleet'
3
- s.version = '1.0.4'
4
- s.date = '2024-06-10'
3
+ s.version = '1.1.0'
4
+ s.date = '2025-10-16'
5
5
  s.summary = 'Onfleet Ruby API wrapper package'
6
6
  s.description = 'The Onfleet Ruby library provides convenient access to the Onfleet API.'
7
7
  s.authors = ['Dan Menza']
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.add_dependency('faraday-net_http', '~> 3.1.0')
15
15
  s.add_dependency('faraday-rate_limiter', '~> 0.0.4')
16
16
  s.add_dependency('json', '~> 2.6.3')
17
- s.add_dependency('uri', '~> 0.12.1')
17
+ s.add_dependency('uri', '~> 1.0')
18
18
 
19
19
  s.add_development_dependency('rspec', '~> 3.12.0')
20
20
  s.add_development_dependency('webmock', '~> 3.18.1')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-onfleet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Menza
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-10 00:00:00.000000000 Z
11
+ date: 2025-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.12.1
75
+ version: '1.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.12.1
82
+ version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -133,6 +133,7 @@ files:
133
133
  - lib/resources/hubs.rb
134
134
  - lib/resources/organizations.rb
135
135
  - lib/resources/recipients.rb
136
+ - lib/resources/routeplans.rb
136
137
  - lib/resources/tasks.rb
137
138
  - lib/resources/teams.rb
138
139
  - lib/resources/webhooks.rb
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
164
  - !ruby/object:Gem::Version
164
165
  version: '0'
165
166
  requirements: []
166
- rubygems_version: 3.4.10
167
+ rubygems_version: 3.3.7
167
168
  signing_key:
168
169
  specification_version: 4
169
170
  summary: Onfleet Ruby API wrapper package