vng 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12023fde89a99a074acccda625a78dbe9636c6f5037b01165cd7b7de7c1cb688
4
- data.tar.gz: 5520d92c3ec6df2412878a884dab4167300a322ae7f4f6d9eb35de8e2e72ee1b
3
+ metadata.gz: 6331c32b323783c597456c56d604a7896c3a5d1219fe2f8c9a6f1f83299075eb
4
+ data.tar.gz: e90b4794467713d98f0adfc3c3edb5f0e8fae0d6264b77752d6aa71b06715b61
5
5
  SHA512:
6
- metadata.gz: 12f82572869a7d545cd3d02604b365bbd5966b19e1d01d6f6e64e5a1bdd4d81880e297cb3f7af714e3795269550f16c9eb0bd03c5e5d047ca5e5fb7160ed18fc
7
- data.tar.gz: 2092c2773ed63733529f25ce6d5ac9a474fe758371837d9c17793e28d1c1c1e9c6e5b7360a73a87a5e6c1ab206d8e86dc2cce63c419db278f46101afca32531e
6
+ metadata.gz: 25dd494526c573d342f30f6a1b393d2972b50ea74b60ccb56f6097b38e23c01b225576b5337fcf9c638a30e66119ec4217b1d9268b7fbf0d3c46a08e2ddbc570
7
+ data.tar.gz: 64db905f1777fe5e1866d84ea9c1d7a6eb3c224c5a5ee7680fdf319803cfbe64f15ec296e26342ab4ad5da0f09248b770d182548bf0218eb8e2356ac4fe6b498
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.2] - 2024-11-20
4
+
5
+ - Adds WorkOrder#url and Case#url
6
+
7
+ ## [1.1] - 2024-11-20
8
+
9
+ - Support optional ActiveSupport::Notifications
10
+
3
11
  ## [1.0.0] - 2024-11-20
4
12
 
5
13
  - First major release
data/README.md CHANGED
@@ -38,7 +38,7 @@ To install on your system, run
38
38
 
39
39
  To use inside a bundled Ruby project, add this line to the Gemfile:
40
40
 
41
- gem 'vng', '~> 0.1.13'
41
+ gem 'vng', '~> 1.0'
42
42
 
43
43
  Since the gem follows [Semantic Versioning](http://semver.org),
44
44
  indicating the full version in your Gemfile (~> *major*.*minor*.*patch*)
data/lib/vng/case.rb CHANGED
@@ -32,6 +32,11 @@ module Vng
32
32
  new id: data['Case']['objectID']
33
33
  end
34
34
 
35
+ # Returns the URL to manage the case in the Vonigo UI.
36
+ def url
37
+ "https://#{self.class.host}/Client/Case/Case_Main.aspx?caseID=#{id}"
38
+ end
39
+
35
40
  def destroy
36
41
  body = {
37
42
  method: '4',
data/lib/vng/resource.rb CHANGED
@@ -18,8 +18,10 @@ module Vng
18
18
  request.body = body.to_json
19
19
  end
20
20
 
21
- response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
22
- http.request request
21
+ response = instrument do |data|
22
+ data[:response] = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
23
+ http.request request
24
+ end
23
25
  end
24
26
 
25
27
  JSON(response.body).tap do |data|
@@ -41,5 +43,14 @@ module Vng
41
43
  field = data['Fields'].find { |field| field['fieldID'] == field_id }
42
44
  field['fieldValue'] if field
43
45
  end
46
+
47
+ def self.instrument(&block)
48
+ data = {class_name: name} # TODO: Add path, query, ...
49
+ if defined?(ActiveSupport::Notifications)
50
+ ActiveSupport::Notifications.instrument 'Vng.request', data, &block
51
+ else
52
+ block.call(data)
53
+ end
54
+ end
44
55
  end
45
56
  end
data/lib/vng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vng
2
- VERSION = '1.0.0'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -32,6 +32,11 @@ module Vng
32
32
  new id: data['WorkOrder']['objectID']
33
33
  end
34
34
 
35
+ # Returns the URL to manage the work order in the Vonigo UI.
36
+ def url
37
+ "https://#{self.class.host}/Schedule/Job/Job_Main.aspx?woID=#{id}"
38
+ end
39
+
35
40
  private
36
41
 
37
42
  def self.charges_for(line_items)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vng
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-20 00:00:00.000000000 Z
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: A Ruby client for the Vonigo API.
42
56
  email:
43
57
  - claudiob@users.noreply.github.com