vng 2.2.3 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/vng/mock_request.rb +15 -1
- data/lib/vng/version.rb +1 -1
- data/lib/vng/work_order.rb +31 -2
- data/lib/vng.rb +1 -0
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3214bdc1e7dd215763c9fd4eeef8910bd50060ff157b76240b288c75a9bd08a2
|
4
|
+
data.tar.gz: 5d85d042325d3d3bbeaa7b711d35df94ca505e92775b4d87eec1080b66d5af7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb9492419c06a439732ca9bce3f79ef4f40a60a8c5875215b7ded6a912b5d04b37493842c02c8264f9a97aab6801bd73ca00e47b6963a0bd1cb072e5e9c2f197
|
7
|
+
data.tar.gz: c85669b1c567e1500833cc2aa4fd0ce5807f28a83cb1c0d4b6141762fbd93e3888de8758ef5846a5c0672629c19b4f813c3202b01853f5394d527f322ebed60b
|
data/CHANGELOG.md
CHANGED
data/lib/vng/mock_request.rb
CHANGED
@@ -224,7 +224,21 @@ module Vng
|
|
224
224
|
{"routeID" => 3, "routeName" => "Route 3 (Inactive)", "isActive" => false},
|
225
225
|
]}
|
226
226
|
when '/api/v1/data/WorkOrders/'
|
227
|
-
|
227
|
+
if @body[:isCompleteObject].eql? 'true'
|
228
|
+
{"WorkOrders" => [
|
229
|
+
{"objectID" => "4139754", "isActive" => "true", "Fields" => [
|
230
|
+
{"fieldID" => 185, "fieldValue" => "1736445600"},
|
231
|
+
{"fieldID" => 813, "fieldValue" => "135.00"},
|
232
|
+
{"fieldID" => 809, "fieldValue" => "0.00"},
|
233
|
+
{"fieldID" => 811, "fieldValue" => "0.00"},
|
234
|
+
{"fieldID" => 810, "fieldValue" => "0.00"},
|
235
|
+
{"fieldID" => 186, "fieldValue" => "30"},
|
236
|
+
{"fieldID" => 9835, "fieldValue" => "135.00"},
|
237
|
+
]}
|
238
|
+
]}
|
239
|
+
else
|
240
|
+
{ "WorkOrder"=>{ "objectID"=>"4138030" } }
|
241
|
+
end
|
228
242
|
when '/api/v1/data/Cases/'
|
229
243
|
if @body[:method].eql? '3'
|
230
244
|
{"Case" => {"objectID" => "28503"}}
|
data/lib/vng/version.rb
CHANGED
data/lib/vng/work_order.rb
CHANGED
@@ -5,10 +5,17 @@ module Vng
|
|
5
5
|
class WorkOrder < Resource
|
6
6
|
PATH = '/api/v1/data/WorkOrders/'
|
7
7
|
|
8
|
-
attr_reader :id
|
8
|
+
attr_reader :id, :scheduled_on, :price, :discount, :tax, :tip, :duration, :total
|
9
9
|
|
10
|
-
def initialize(id:)
|
10
|
+
def initialize(id:, scheduled_on: nil, price: nil, discount: nil, tax: nil, tip: nil, duration: nil, total: nil)
|
11
11
|
@id = id
|
12
|
+
@scheduled_on = scheduled_on
|
13
|
+
@price = price
|
14
|
+
@discount = discount
|
15
|
+
@tax = tax
|
16
|
+
@tip = tip
|
17
|
+
@duration = duration
|
18
|
+
@total = total
|
12
19
|
end
|
13
20
|
|
14
21
|
def self.create(lock_id:, client_id:, contact_id:, location_id:, duration:, summary:, line_items:)
|
@@ -32,6 +39,28 @@ module Vng
|
|
32
39
|
new id: data['WorkOrder']['objectID']
|
33
40
|
end
|
34
41
|
|
42
|
+
def self.for_client_id(client_id)
|
43
|
+
body = { clientID: client_id, isCompleteObject: 'true' }
|
44
|
+
|
45
|
+
data = request path: PATH, body: body, returning: 'WorkOrders'
|
46
|
+
|
47
|
+
data.filter_map do |body|
|
48
|
+
next unless body['isActive']
|
49
|
+
|
50
|
+
id = body['objectID']
|
51
|
+
# scheduled_on is in the time zone of the franchise, not UTC
|
52
|
+
scheduled_on = Time.at Integer(value_for_field body, 185), in: 'UTC'
|
53
|
+
price = BigDecimal(value_for_field body, 813)
|
54
|
+
discount = BigDecimal(value_for_field body, 809)
|
55
|
+
tax = BigDecimal(value_for_field body, 811)
|
56
|
+
tip = BigDecimal(value_for_field body, 810)
|
57
|
+
duration = Integer(value_for_field body, 186)
|
58
|
+
total = BigDecimal(value_for_field body, 9835)
|
59
|
+
|
60
|
+
new id:, scheduled_on:, price:, discount:, tax:, tip:, duration:, total:
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
35
64
|
# Returns the URL to manage the work order in the Vonigo UI.
|
36
65
|
def url
|
37
66
|
"https://#{self.class.host}/Schedule/Job/Job_Main.aspx?woID=#{id}"
|
data/lib/vng.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- claudiob
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: simplecov
|
@@ -98,7 +97,6 @@ metadata:
|
|
98
97
|
homepage_uri: https://rubygems.org/gems/vng
|
99
98
|
source_code_uri: https://github.com/claudiob/vng
|
100
99
|
changelog_uri: https://github.com/claudiob/vng/blob/main/CHANGELOG.md
|
101
|
-
post_install_message:
|
102
100
|
rdoc_options: []
|
103
101
|
require_paths:
|
104
102
|
- lib
|
@@ -113,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
111
|
- !ruby/object:Gem::Version
|
114
112
|
version: '0'
|
115
113
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
117
|
-
signing_key:
|
114
|
+
rubygems_version: 3.6.2
|
118
115
|
specification_version: 4
|
119
116
|
summary: A Ruby client for the Vonigo API.
|
120
117
|
test_files: []
|