webfleet_connect 0.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 +7 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +44 -0
- data/LICENSE +674 -0
- data/README.md +286 -0
- data/Rakefile +4 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/webfleet_connect/actions/action.rb +24 -0
- data/lib/webfleet_connect/actions/actions.rb +14 -0
- data/lib/webfleet_connect/actions/addresses.rb +17 -0
- data/lib/webfleet_connect/actions/drivers.rb +23 -0
- data/lib/webfleet_connect/actions/events.rb +15 -0
- data/lib/webfleet_connect/actions/geocoding.rb +9 -0
- data/lib/webfleet_connect/actions/messages.rb +13 -0
- data/lib/webfleet_connect/actions/miscellaneous.rb +13 -0
- data/lib/webfleet_connect/actions/objects.rb +28 -0
- data/lib/webfleet_connect/actions/orders.rb +19 -0
- data/lib/webfleet_connect/actions/trips.rb +21 -0
- data/lib/webfleet_connect/builder.rb +13 -0
- data/lib/webfleet_connect/connection.rb +39 -0
- data/lib/webfleet_connect/credentials.rb +53 -0
- data/lib/webfleet_connect/default_config.rb +46 -0
- data/lib/webfleet_connect/enums/devices.rb +10 -0
- data/lib/webfleet_connect/enums/special_vehicle_types.rb +7 -0
- data/lib/webfleet_connect/enums/vehicle_types.rb +49 -0
- data/lib/webfleet_connect/error.rb +34 -0
- data/lib/webfleet_connect/format_handlers/csv_error_parser.rb +16 -0
- data/lib/webfleet_connect/format_handlers/csv_response_error_parser.rb +11 -0
- data/lib/webfleet_connect/format_handlers/csv_response_parser.rb +25 -0
- data/lib/webfleet_connect/format_handlers/error_parser.rb +11 -0
- data/lib/webfleet_connect/format_handlers/json_error_parser.rb +17 -0
- data/lib/webfleet_connect/format_handlers/json_response_parser.rb +9 -0
- data/lib/webfleet_connect/helpers/case_helper.rb +18 -0
- data/lib/webfleet_connect/helpers/class_helper.rb +5 -0
- data/lib/webfleet_connect/helpers/date_format_helper.rb +13 -0
- data/lib/webfleet_connect/helpers/encoding_helper.rb +8 -0
- data/lib/webfleet_connect/helpers.rb +2 -0
- data/lib/webfleet_connect/params/default_param.rb +16 -0
- data/lib/webfleet_connect/params/param.rb +23 -0
- data/lib/webfleet_connect/params/params.rb +2 -0
- data/lib/webfleet_connect/params/params_factory.rb +22 -0
- data/lib/webfleet_connect/params/range_pattern.rb +39 -0
- data/lib/webfleet_connect/params/rangefrom_string.rb +23 -0
- data/lib/webfleet_connect/params/rangeto_string.rb +9 -0
- data/lib/webfleet_connect/response.rb +33 -0
- data/lib/webfleet_connect/session.rb +44 -0
- data/lib/webfleet_connect/version.rb +5 -0
- data/lib/webfleet_connect.rb +10 -0
- data/sig/webfleet_connect.rbs +4 -0
- data/webfleet_connect.gemspec +33 -0
- metadata +161 -0
data/README.md
ADDED
@@ -0,0 +1,286 @@
|
|
1
|
+
# WebfleetConnect
|
2
|
+
|
3
|
+

|
4
|
+
|
5
|
+
#
|
6
|
+
|
7
|
+
Gem to consume WEBFLEET.connect API.
|
8
|
+
|
9
|
+
The WEBFLEET.connect API connects software applications with the Webfleet fleet management solution. Via WEBFLEET.connect you can enhance the value of all types of business solutions, including routing and scheduling optimization, ERP, Transport Management System (TMS), supply chain planning, asset management, and much more.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'webfleet_connect'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle install
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install webfleet_connect
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require 'webfleet_connect'
|
31
|
+
|
32
|
+
webfleet_connect = WebfleetConnect.create
|
33
|
+
response = webfleet_connect.show_object_report_extern
|
34
|
+
response.to_hash # [{:objectno=>"858EU4", :objectname=>"YRT-MMD2439", :objectclassname=>"sales", ...
|
35
|
+
```
|
36
|
+
|
37
|
+
`WebfleetConnect.create` returns a new `WebfleetConnect::Session` object which has the capabilities to request info from the WEBFLEET.connect API.
|
38
|
+
|
39
|
+
The Webfllet credential are taken from the env variables `WEBFLEET_CONNECT_ACCOUNT`, `WEBFLEET_CONNECT_USERNAME`, `WEBFLEET_CONNECT_PASSWORD` and `WEBFLEET_CONNECT_APIKEY` (if you want to know more about env variables check [this link](https://www.honeybadger.io/blog/ruby-guide-environment-variables/)).
|
40
|
+
|
41
|
+
If your system needs to work with multiple accounts or you need to specify the credentials dynamically for some other reason, you can do it this way:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
webfleet_connect = WebfleetConnect.create(account: 'companyName', username: 'dev', password: 'VLm5PpiZST6U', apikey: 'ZSksD88s-F7Uf')
|
45
|
+
```
|
46
|
+
|
47
|
+
When you use one of the methods of this gem, like for example `show_vehicle_report_extern`, this returns a `WebfleetConnect::Response` object which you can do:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
response = webfleet_connect.show_vehicle_report_extern
|
51
|
+
|
52
|
+
response.url # gets the url to fetch the informtion from WEBFLEET.connect
|
53
|
+
response.status_code # gets the status code of the request
|
54
|
+
response.to_s # returns the response message as plain text as is returned by WEBFLEET.connect
|
55
|
+
response.to_hash # returns the data as a ruby Array/Hash object
|
56
|
+
```
|
57
|
+
|
58
|
+
The methods available in this gem are the same that are documented in the [WEBFLEET.connect docs page](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html) just changed from cammelCase to snake_case. See below the list of methods.
|
59
|
+
|
60
|
+
### Params
|
61
|
+
|
62
|
+
In order to add params to a request is as easy as passing a hash of options in the request like:
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
response = webfleet_connect.show_vehicle_report_extern(filterstring: 'ECO', objectgroupname: 'Vehiculos', ungroupedonly: true)
|
66
|
+
```
|
67
|
+
|
68
|
+
The `rangefrom_string` and `rangeto_string` can accept `Time` objects:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
start_date = Time.now
|
72
|
+
end_date = start_date + (60 * 60 * 24)
|
73
|
+
|
74
|
+
response = webfleet_connect.show_event_report_extern(range_pattern: :ud, rangefrom_string: start_date, rangeto_string: end_date)
|
75
|
+
```
|
76
|
+
|
77
|
+
The `range_pattern` can accept the values
|
78
|
+
`:today`,
|
79
|
+
`:yesterday`,
|
80
|
+
`:two_days_ago`,
|
81
|
+
`:three_days_ago`,
|
82
|
+
`:four_days_ago`,
|
83
|
+
`:five_days_ago`,
|
84
|
+
`:six_days_ago`,
|
85
|
+
`:current_week`,
|
86
|
+
`:last_week`,
|
87
|
+
`:two_weeks_ago`,
|
88
|
+
`:three_weeks_ago`,
|
89
|
+
`:floating_week`,
|
90
|
+
`:last_floating_week`,
|
91
|
+
`:two_floating_weeks_ago`,
|
92
|
+
`:three_floating_weeks_ago`,
|
93
|
+
`:current_month`,
|
94
|
+
`:last_month`,
|
95
|
+
`:two_months_ago`,
|
96
|
+
`:three_months_ago`,
|
97
|
+
`:user_defined_range` and
|
98
|
+
`:ud`
|
99
|
+
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
response = webfleet_connect.show_event_report_extern(range_pattern: :today)
|
103
|
+
```
|
104
|
+
|
105
|
+
### Extra config
|
106
|
+
|
107
|
+
The `WebfleetConnect::Session` object works with the default configuration:
|
108
|
+
|
109
|
+
`lang: :en, format: :csv, useUTF8: false, useISO8601: false`
|
110
|
+
|
111
|
+
but you can change the default configuration when you create the object:
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
credentials = {
|
115
|
+
account: 'companyName',
|
116
|
+
username: 'dev',
|
117
|
+
password: 'VLm5PpiZST6U',
|
118
|
+
apikey: 'ZSksD88s-F7Uf'
|
119
|
+
}
|
120
|
+
|
121
|
+
config = {
|
122
|
+
lang: :de,
|
123
|
+
format: :json,
|
124
|
+
useUTF8: true
|
125
|
+
}
|
126
|
+
|
127
|
+
params = credentials.merge config
|
128
|
+
|
129
|
+
webfleet_connect = WebfleetConnect.create(params)
|
130
|
+
```
|
131
|
+
|
132
|
+
### Methods list
|
133
|
+
|
134
|
+
Mesage queues:
|
135
|
+
|
136
|
+
- *Not implemented yet*
|
137
|
+
|
138
|
+
Objects:
|
139
|
+
|
140
|
+
- [show_object_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showobjectreportextern.html)
|
141
|
+
- [show_vehicle_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showvehiclereportextern.html)
|
142
|
+
- [show_nearest_vehicles](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/shownearestvehicles.html)
|
143
|
+
- [show_contracts](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showcontracts.html)
|
144
|
+
- [update_vehicle](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatevehicle.html)
|
145
|
+
- [show_object_groups](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showobjectgroups.html)
|
146
|
+
- [show_object_group_objects](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showobjectgroupobjects.html)
|
147
|
+
- [attach_object_to_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/attachobjecttogroup.html)
|
148
|
+
- [detach_object_from_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/detachobjectfromgroup.html)
|
149
|
+
- [insert_object_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/insertobjectgroup.html)
|
150
|
+
- [delete_object_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/deleteobjectgroup.html)
|
151
|
+
- [update_object_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updateobjectgroup.html)
|
152
|
+
- [switch_output](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/switchoutput.html)
|
153
|
+
- [show_wakeup_timers](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showwakeuptimers.html)
|
154
|
+
- [update_wakeup_timers](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatewakeuptimers.html)
|
155
|
+
- [get_object_features](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getobjectfeatures.html)
|
156
|
+
- [update_contract_info](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatecontractinfo.html)
|
157
|
+
- [get_object_can_signals](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getobjectcansignals.html)
|
158
|
+
- [get_object_can_malfunctions](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getobjectcanmalfunctions.html)
|
159
|
+
- [get_electric_vehicle_data](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getelectricvehicledata.html)
|
160
|
+
- [get_active_asset_couplings](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getactiveassetcouplings.html)
|
161
|
+
|
162
|
+
Orders:
|
163
|
+
|
164
|
+
- [send_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/sendorderextern.html)
|
165
|
+
- [send_destination_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/senddestinationorderextern.html)
|
166
|
+
- [update_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updateorderextern.html)
|
167
|
+
- [update_destination_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatedestinationorderextern.html)
|
168
|
+
- [insert_destination_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/insertdestinationorderextern.html)
|
169
|
+
- [cancel_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/cancelorderextern.html)
|
170
|
+
- [assign_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/assignorderextern.html)
|
171
|
+
- [reassign_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/reassignorderextern.html)
|
172
|
+
- [delete_order_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/deleteorderextern.html)
|
173
|
+
- [clear_orders_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/clearordersextern.html)
|
174
|
+
- [show_order_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showorderreportextern.html)
|
175
|
+
- [show_order_waypoints](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showorderwaypoints.html)
|
176
|
+
|
177
|
+
Messages:
|
178
|
+
|
179
|
+
- [send_text_message_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/sendtextmessageextern.html)
|
180
|
+
- [clear_text_messages_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/cleartextmessagesextern.html)
|
181
|
+
- [show_messages](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showmessages.html)
|
182
|
+
- [send_binary_message](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/sendbinarymessage.html)
|
183
|
+
- [reset_binary_messages](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/resetbinarymessages.html)
|
184
|
+
- [clear_binary_messages](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/clearbinarymessages.html)
|
185
|
+
|
186
|
+
Drivers:
|
187
|
+
|
188
|
+
- [show_driver_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showdriverreportextern.html)
|
189
|
+
- [insert_driver_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/insertdriverextern.html)
|
190
|
+
- [update_driver_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatedriverextern.html)
|
191
|
+
- [delete_driver_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/deletedriverextern.html)
|
192
|
+
- [show_opti_drive_indicator](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showoptidriveindicator.html)
|
193
|
+
- [show_driver_groups](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showdrivergroups.html)
|
194
|
+
- [show_driver_group_drivers](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showdrivergroupdrivers.html)
|
195
|
+
- [attach_driver_to_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/attachdrivertogroup.html)
|
196
|
+
- [detach_driver_from_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/detachdriverfromgroup.html)
|
197
|
+
- [insert_driver_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/insertdrivergroup.html)
|
198
|
+
- [delete_driver_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/deletedrivergroup.html)
|
199
|
+
- [update_driver_group](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatedrivergroup.html)
|
200
|
+
- [attach_driver_to_vehicle](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/attachdrivertovehicle.html)
|
201
|
+
- [detach_driver_from_vehicle](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/detachdriverfromvehicle.html)
|
202
|
+
- [get_driver_rdt_rules](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getdriverrdtrules.html)
|
203
|
+
- [update_driver_rdt_rules](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatedriverrdtrules.html)
|
204
|
+
|
205
|
+
Addresses:
|
206
|
+
|
207
|
+
- [show_address_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showaddressreportextern.html)
|
208
|
+
- [show_address_group_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showaddressgroupreportextern.html)
|
209
|
+
- [show_address_group_address_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showaddressgroupaddressreporte.html)
|
210
|
+
- [insert_address_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/insertaddressextern.html)
|
211
|
+
- [updateAddressExtern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updateaddressextern.html)
|
212
|
+
- [delete_address_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/deleteaddressextern.html)
|
213
|
+
- [attach_address_to_group_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/attachaddresstogroupextern.html)
|
214
|
+
- [detach_address_from_group_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/detachaddressfromgroupextern.html)
|
215
|
+
- [insert_address_group_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/insertaddressgroupextern.html)
|
216
|
+
- [delete_address_group_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/deleteaddressgroupextern.html)
|
217
|
+
|
218
|
+
Events:
|
219
|
+
|
220
|
+
- [show_event_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showeventreportextern.html)
|
221
|
+
- [acknowledge_event_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/acknowledgeeventextern.html)
|
222
|
+
- [resolve_event_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/resolveeventextern.html)
|
223
|
+
- [get_event_forward_configs](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/geteventforwardconfigs.html)
|
224
|
+
- [get_event_forward_config_recipients](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/geteventforwardconfigrecipient.html)
|
225
|
+
- [insert_event_forward_config](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/inserteventforwardconfig.html)
|
226
|
+
- [update_event_forward_config](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updateeventforwardconfig.html)
|
227
|
+
- [delete_event_forward_config](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/deleteeventforwardconfig.html)
|
228
|
+
|
229
|
+
Trips and working times:
|
230
|
+
|
231
|
+
- [show_trip_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showtripreportextern.html)
|
232
|
+
- [show_trip_summary_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showtripsummaryreportextern.html)
|
233
|
+
- [show_tracks](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showtracks.html)
|
234
|
+
- [update_logbook](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatelogbook.html)
|
235
|
+
- [show_logbook](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showlogbook.html)
|
236
|
+
- [show_logbook_history](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showlogbookhistory.html)
|
237
|
+
- [update_logbook_mode](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatelogbookmode.html)
|
238
|
+
- [update_logbook_driver](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/updatelogbookdriver.html)
|
239
|
+
- [show_working_times](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showworkingtimes.html)
|
240
|
+
- [show_stand_stills](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showstandstills.html)
|
241
|
+
- [show_idle_exceptions](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showidleexceptions.html)
|
242
|
+
- [get_object_kpis](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getobjectkpis.html)
|
243
|
+
- [get_driver_kpis](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getdriverkpis.html)
|
244
|
+
- [get_remaining_driving_times_eu](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getremainingdrivingtimeseu.html)
|
245
|
+
|
246
|
+
Miscellaneous reports:
|
247
|
+
|
248
|
+
- [get_charger_connections](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getchargerconnections.html)
|
249
|
+
- [show_io_report_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showioreportextern.html)
|
250
|
+
- [show_acceleration_events](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showaccelerationevents.html)
|
251
|
+
- [show_speeding_events](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showspeedingevents.html)
|
252
|
+
- [show_digital_input_state_mileage](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/showdigitalinputstatemileage.html)
|
253
|
+
- [get_charger_connections](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/getchargerconnections.html)
|
254
|
+
|
255
|
+
Geocoding and routing:
|
256
|
+
|
257
|
+
- [geocode_address](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/geocodeaddress.html)
|
258
|
+
- [calc_route_simple_extern](https://www.webfleet.com/static/help/webfleet-connect/en_gb/index.html#data/calcroutesimpleextern.html)
|
259
|
+
|
260
|
+
Configuration and security:
|
261
|
+
|
262
|
+
- *Not implemented yet*
|
263
|
+
|
264
|
+
User management:
|
265
|
+
|
266
|
+
- *Not implemented yet*
|
267
|
+
|
268
|
+
Vehicle maintenance:
|
269
|
+
|
270
|
+
- *Not implemented yet*
|
271
|
+
|
272
|
+
Reporting:
|
273
|
+
|
274
|
+
- *Not implemented yet*
|
275
|
+
|
276
|
+
Areas:
|
277
|
+
|
278
|
+
- *Not implemented yet*
|
279
|
+
|
280
|
+
LINK.connect:
|
281
|
+
|
282
|
+
- *Not implemented yet*
|
283
|
+
|
284
|
+
Plugins:
|
285
|
+
|
286
|
+
- *Not implemented yet*
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "webfleet_connect"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative '../params/params_factory'
|
2
|
+
|
3
|
+
class WebfleetConnect::Actions::Action
|
4
|
+
include WebfleetConnect::Params::ParamsFactory
|
5
|
+
|
6
|
+
def initialize(name, args)
|
7
|
+
@name = name
|
8
|
+
@params = build_params(args)
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
"action=#{name}#{params}"
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def name
|
18
|
+
@name
|
19
|
+
end
|
20
|
+
|
21
|
+
def params
|
22
|
+
@params.map(&:to_s).join
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative '../helpers/case_helper'
|
2
|
+
|
3
|
+
module WebfleetConnect::Actions
|
4
|
+
include WebfleetConnect::Helpers::CaseHelper
|
5
|
+
|
6
|
+
def add_action(action_name)
|
7
|
+
action_string = snake_to_cammel(action_name.to_s)
|
8
|
+
class_eval %Q{
|
9
|
+
def #{action_name}(args = {})
|
10
|
+
exec WebfleetConnect::Actions::Action.new('#{action_string}', args)
|
11
|
+
end
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'actions'
|
2
|
+
require_relative 'action'
|
3
|
+
|
4
|
+
module WebfleetConnect::Actions::Addresses
|
5
|
+
extend WebfleetConnect::Actions
|
6
|
+
|
7
|
+
add_action :show_address_report_extern
|
8
|
+
add_action :show_address_group_report_extern
|
9
|
+
add_action :show_address_group_address_report_extern
|
10
|
+
add_action :insert_address_extern
|
11
|
+
add_action :update_address_extern
|
12
|
+
add_action :delete_address_extern
|
13
|
+
add_action :attach_address_to_group_extern
|
14
|
+
add_action :detach_address_from_group_extern
|
15
|
+
add_action :insert_address_group_extern
|
16
|
+
add_action :delete_address_group_extern
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'actions'
|
2
|
+
require_relative 'action'
|
3
|
+
|
4
|
+
module WebfleetConnect::Actions::Drivers
|
5
|
+
extend WebfleetConnect::Actions
|
6
|
+
|
7
|
+
add_action :show_driver_report_extern
|
8
|
+
add_action :insert_driver_extern
|
9
|
+
add_action :update_driver_extern
|
10
|
+
add_action :delete_driver_extern
|
11
|
+
add_action :show_opti_drive_indicator
|
12
|
+
add_action :show_driver_groups
|
13
|
+
add_action :show_driver_group_drivers
|
14
|
+
add_action :attach_driver_to_group
|
15
|
+
add_action :detach_driver_from_group
|
16
|
+
add_action :insert_driver_group
|
17
|
+
add_action :delete_driver_group
|
18
|
+
add_action :update_driver_group
|
19
|
+
add_action :attach_driver_to_vehicle
|
20
|
+
add_action :detach_driver_from_vehicle
|
21
|
+
add_action :get_driver_rdt_rules
|
22
|
+
add_action :update_driver_rdt_rules
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative 'actions'
|
2
|
+
require_relative 'action'
|
3
|
+
|
4
|
+
module WebfleetConnect::Actions::Events
|
5
|
+
extend WebfleetConnect::Actions
|
6
|
+
|
7
|
+
add_action :show_event_report_extern
|
8
|
+
add_action :acknowledge_event_extern
|
9
|
+
add_action :resolve_event_extern
|
10
|
+
add_action :get_event_forward_configs
|
11
|
+
add_action :get_event_forward_config_recipients
|
12
|
+
add_action :insert_event_forward_config
|
13
|
+
add_action :update_event_forward_config
|
14
|
+
add_action :delete_event_forward_config
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'actions'
|
2
|
+
require_relative 'action'
|
3
|
+
|
4
|
+
module WebfleetConnect::Actions::Messages
|
5
|
+
extend WebfleetConnect::Actions
|
6
|
+
|
7
|
+
add_action :send_text_message_extern
|
8
|
+
add_action :clear_text_messages_extern
|
9
|
+
add_action :show_messages
|
10
|
+
add_action :send_binary_message
|
11
|
+
add_action :reset_binary_messages
|
12
|
+
add_action :clear_binary_messages
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'actions'
|
2
|
+
require_relative 'action'
|
3
|
+
|
4
|
+
module WebfleetConnect::Actions::Miscellaneous
|
5
|
+
extend WebfleetConnect::Actions
|
6
|
+
|
7
|
+
add_action :get_charger_connections
|
8
|
+
add_action :show_io_report_extern
|
9
|
+
add_action :show_acceleration_events
|
10
|
+
add_action :show_speeding_events
|
11
|
+
add_action :show_digital_input_state_mileage
|
12
|
+
add_action :get_charger_connections
|
13
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'actions'
|
2
|
+
require_relative 'action'
|
3
|
+
|
4
|
+
module WebfleetConnect::Actions::Objects
|
5
|
+
extend WebfleetConnect::Actions
|
6
|
+
|
7
|
+
add_action :show_object_report_extern
|
8
|
+
add_action :show_vehicle_report_extern
|
9
|
+
add_action :show_nearest_vehicles
|
10
|
+
add_action :show_contracts
|
11
|
+
add_action :update_vehicle
|
12
|
+
add_action :show_object_groups
|
13
|
+
add_action :show_object_group_objects
|
14
|
+
add_action :attach_object_to_group
|
15
|
+
add_action :detach_object_from_group
|
16
|
+
add_action :insert_object_group
|
17
|
+
add_action :delete_object_group
|
18
|
+
add_action :update_object_group
|
19
|
+
add_action :switch_output
|
20
|
+
add_action :show_wakeup_timers
|
21
|
+
add_action :update_wakeup_timers
|
22
|
+
add_action :get_object_features
|
23
|
+
add_action :update_contract_info
|
24
|
+
add_action :get_object_can_signals
|
25
|
+
add_action :get_object_can_malfunctions
|
26
|
+
add_action :get_electric_vehicle_data
|
27
|
+
add_action :get_active_asset_couplings
|
28
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'actions'
|
2
|
+
require_relative 'action'
|
3
|
+
|
4
|
+
module WebfleetConnect::Actions::Orders
|
5
|
+
extend WebfleetConnect::Actions
|
6
|
+
|
7
|
+
add_action :send_order_extern
|
8
|
+
add_action :send_destination_order_extern
|
9
|
+
add_action :update_order_extern
|
10
|
+
add_action :update_destination_order_extern
|
11
|
+
add_action :insert_destination_order_extern
|
12
|
+
add_action :cancel_order_extern
|
13
|
+
add_action :assign_order_extern
|
14
|
+
add_action :reassign_order_extern
|
15
|
+
add_action :delete_order_extern
|
16
|
+
add_action :clear_orders_extern
|
17
|
+
add_action :show_order_report_extern
|
18
|
+
add_action :show_order_waypoints
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_relative 'actions'
|
2
|
+
require_relative 'action'
|
3
|
+
|
4
|
+
module WebfleetConnect::Actions::Trips
|
5
|
+
extend WebfleetConnect::Actions
|
6
|
+
|
7
|
+
add_action :show_trip_report_extern
|
8
|
+
add_action :show_trip_summary_report_extern
|
9
|
+
add_action :show_tracks
|
10
|
+
add_action :update_logbook
|
11
|
+
add_action :show_logbook
|
12
|
+
add_action :show_logbook_history
|
13
|
+
add_action :update_logbook_mode
|
14
|
+
add_action :update_logbook_driver
|
15
|
+
add_action :show_working_times
|
16
|
+
add_action :show_stand_stills
|
17
|
+
add_action :show_idle_exceptions
|
18
|
+
add_action :get_object_kpis
|
19
|
+
add_action :get_driver_kpis
|
20
|
+
add_action :get_remaining_driving_times_eu
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'credentials'
|
2
|
+
require_relative 'default_config'
|
3
|
+
require_relative 'session'
|
4
|
+
|
5
|
+
module WebfleetConnect
|
6
|
+
class Builder
|
7
|
+
def self.create(args)
|
8
|
+
credentials = Credentials.new(args)
|
9
|
+
config = DefaultConfig.new(args)
|
10
|
+
Session.new(credentials, config)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require_relative 'response'
|
3
|
+
require_relative 'error'
|
4
|
+
require_relative 'format_handlers/json_error_parser'
|
5
|
+
require_relative 'format_handlers/csv_error_parser'
|
6
|
+
|
7
|
+
module WebfleetConnect
|
8
|
+
class Connection
|
9
|
+
def initialize(session)
|
10
|
+
@session = session
|
11
|
+
@error_parser = build_error_parser(session)
|
12
|
+
end
|
13
|
+
|
14
|
+
def exec(url)
|
15
|
+
response = get(url)
|
16
|
+
raise Error.new(response.body, url, json?) if error?(response.body)
|
17
|
+
Response.new(response, url, json?)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def get(url)
|
23
|
+
HTTParty.get(url)
|
24
|
+
end
|
25
|
+
|
26
|
+
def error?(message)
|
27
|
+
@error_parser.error?(message)
|
28
|
+
end
|
29
|
+
|
30
|
+
def json?
|
31
|
+
@session.json?
|
32
|
+
end
|
33
|
+
|
34
|
+
def build_error_parser(session)
|
35
|
+
return FormatHandlers::JsonErrorParser.new(session) if json?
|
36
|
+
FormatHandlers::CsvErrorParser.new(session)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require_relative 'helpers/encoding_helper'
|
2
|
+
|
3
|
+
class WebfleetConnect::Credentials
|
4
|
+
include WebfleetConnect::Helpers::EncodingHelper
|
5
|
+
|
6
|
+
def initialize(args = {})
|
7
|
+
args = default_arguments.merge(args)
|
8
|
+
@account = args[:account]
|
9
|
+
@username = args[:username]
|
10
|
+
@password = args[:password]
|
11
|
+
@apikey = args[:apikey]
|
12
|
+
end
|
13
|
+
|
14
|
+
def auth_header
|
15
|
+
"Authorization: Basic #{encode}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"#{account}&#{username}&#{password}&#{apikey}"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def encode
|
25
|
+
text = "#{@username}:#{@password}"
|
26
|
+
base64_encode(text)
|
27
|
+
end
|
28
|
+
|
29
|
+
def default_arguments
|
30
|
+
{
|
31
|
+
account: ENV['WEBFLEET_CONNECT_ACCOUNT'],
|
32
|
+
username: ENV['WEBFLEET_CONNECT_USERNAME'],
|
33
|
+
password: ENV['WEBFLEET_CONNECT_PASSWORD'],
|
34
|
+
apikey: ENV['WEBFLEET_CONNECT_APIKEY']
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
def account
|
39
|
+
"account=#{@account}"
|
40
|
+
end
|
41
|
+
|
42
|
+
def username
|
43
|
+
"username=#{@username}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def password
|
47
|
+
"password=#{@password}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def apikey
|
51
|
+
"apikey=#{@apikey}"
|
52
|
+
end
|
53
|
+
end
|