jbr 2.3.0 → 2.4.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: 3bfdb96b9790f402fd9176cc2acbe42fec07d4a23e9b06b7f217297e2bfb6fcd
4
- data.tar.gz: a09d5f78a7c996a1e6bf912b09ba1ee30c4f6805ac40b626848e79bb544104bd
3
+ metadata.gz: 131ece92fb051e64674afcd8e0066a126c83cd4502b7ea570795e2f6a456aaf6
4
+ data.tar.gz: d56615c6a47fab3de06ecebf672ade7f355e2338e263ff23577faea1b3dd744d
5
5
  SHA512:
6
- metadata.gz: 941d93dd184d08aadfd4b4c454bed5945e28b9bd2600b8e3798515656286c4806effa7995d06f47fa37d43974925c629cb77c13528dd21264cbf1e77e2e8717d
7
- data.tar.gz: 4b31eb73766e34a1aa60d9d7f0b0c4725257cb90f8e2ea1d28792b65fec581b30b43b03878c11328edd7e96cb0fef11b5e0b0a1fab827133fe12b2e69d17c436
6
+ metadata.gz: 12e0d034ad5a76d89bf9d8ded9b84bd5790197e34a709404c551f9b75d9d697dcaec066db7f9bd05283bb17fabbee9a5b1239f29b5ed90bb025141f47b9db88a
7
+ data.tar.gz: 1c3b8eff188c1a4ade48f273c6ec575bfe57a9906da717b8fba10237e3722317f04fc1bacbb333b06b2df4753e3dcf3c5e5d203a2d970908136d55098f3009d9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [2.4.0] - 2026-08-08
2
+
3
+ - [Breaking change] A visit answers `property` -- the ID Jobber files the place under, beside
4
+ the address fields -- rather than `property_id` and `address` apart. It reads the way
5
+ `client` already did, so a caller unpacks both the same way
6
+
1
7
  ## [2.3.0] - 2026-08-07
2
8
 
3
9
  - [Breaking change] A client's phone is the number Jobber holds as reachable rather than
data/README.md CHANGED
@@ -98,12 +98,11 @@ visit = visits.first
98
98
  visit.id # => 'Z2lkOi8vS'
99
99
  visit.title # => 'Furnace tune-up'
100
100
  visit.job_id # => 'Z2lkOi8vS'
101
- visit.property_id # => 'Z2lkOi8vS'
101
+ visit.property # => { id: 'Z2lkOi8vS', street: '1 Main St', city: 'Raleigh',
102
+ # state: 'NC', zip: '27601', latitude: 35.77, longitude: -78.63 }
102
103
  visit.client # => { id: 'Z2lkOi8vS', first_name: 'Jane', last_name: 'Doe',
103
104
  # phone: '5553335555', email: 'jane@example.com' }
104
105
  # phone is the reachable North American number, ten digits, or nil
105
- visit.address # => { street: '1 Main St', city: 'Raleigh', state: 'NC', zip: '27601',
106
- # latitude: 35.77, longitude: -78.63 }
107
106
  visit.starts_at # => 2026-08-09 14:00:00
108
107
  visit.ends_at # => 2026-08-09 16:00:00
109
108
  visit.all_day? # => false
@@ -175,7 +174,8 @@ Mock successfully fetching upcoming visits:
175
174
 
176
175
  ```ruby
177
176
  Jbr.mock.visits = [ { id: 'visit-01', title: 'Furnace tune-up', job_id: 'job-01',
178
- property_id: 'property-01', client: { id: 'client-01', first_name: 'Jane' },
177
+ property: { id: 'property-01', street: '1 Main St' },
178
+ client: { id: 'client-01', first_name: 'Jane' },
179
179
  address: { street: '1 Main St', city: 'Raleigh', state: 'NC', zip: '27601' },
180
180
  starts_at: Date.tomorrow.noon, ends_at: Date.tomorrow.end_of_day,
181
181
  all_day: false, client_confirmed: true } ]
@@ -15,11 +15,9 @@ module Jbr
15
15
 
16
16
  def job_id = @node[:job_id]
17
17
 
18
- def property_id = @node[:property_id]
19
-
20
18
  def client = @node.fetch :client, {}
21
19
 
22
- def address = @node.fetch :address, {}
20
+ def property = @node.fetch :property, {}
23
21
 
24
22
  def all_day? = @node[:all_day]
25
23
 
data/lib/jbr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # A Ruby client for the Jobber API.
2
2
  module Jbr
3
3
  # The version of this gem.
4
- VERSION = '2.3.0'
4
+ VERSION = '2.4.0'
5
5
  end
data/lib/jbr/visit.rb CHANGED
@@ -51,9 +51,6 @@ module Jbr
51
51
  # @return [Boolean, nil] whether the client has confirmed the visit.
52
52
  def client_confirmed? = @node['clientConfirmed']
53
53
 
54
- # @return [String, nil] the ID of the property the work happens at.
55
- def property_id = @node.dig 'property', 'id'
56
-
57
54
  # Who the work is for, in the fields a client is created with.
58
55
  # @return [Hash] any of :id, :first_name, :last_name, :phone and :email.
59
56
  def client
@@ -61,9 +58,13 @@ module Jbr
61
58
  fields.merge(phone: Phone.from(@node.dig('client', 'phones'))).compact
62
59
  end
63
60
 
64
- # Where the work happens, in the fields {Property} carries.
65
- # @return [Hash] any of :street, :city, :state, :zip, :latitude and :longitude.
66
- def address = Property.fields_from @node.dig('property', 'address')
61
+ # Where the work happens, in the fields {Property} carries, under the ID Jobber files
62
+ # it by -- the shape {#client} answers in, so both read the same way.
63
+ # @return [Hash] any of :id, :street, :city, :state, :zip, :latitude and :longitude.
64
+ def property
65
+ fields = Property.fields_from @node.dig('property', 'address')
66
+ { id: @node.dig('property', 'id') }.merge fields
67
+ end
67
68
 
68
69
  # @return [Time, nil] the visit start time
69
70
  def starts_at
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbr
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo