hcp 4.1.0 → 5.0.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: aad72b55ce034138806c6d68b993d430e7c299960ee14c92e0c59563b5f5bae3
4
- data.tar.gz: ba0582ba808d0dbf087eb8a9f6823336e57d6fbc466a1be0f71a9daee38db25b
3
+ metadata.gz: c68dd1ad565d18c93e6682c1e8d75598f3ef742d93c3e477c6a1bdd82f840fec
4
+ data.tar.gz: fe27f4cc519612a192baf591a5cabc458ea1d3e56ff5c4837ec6ad17a923c96d
5
5
  SHA512:
6
- metadata.gz: da42001d35f67f6aa680b8b2b5f3cbc9ee020b537af8ba126ead44d76257d8f8f881afad501ecbce5c8c5fa7ebf65be59ccfb79f3d16ad2d5af5436288dd3c78
7
- data.tar.gz: 680f9463a9f6540f03281fe4013251f83622811cfaff0a53bb1e9c47081720bc99f624be79ba86b0d9ce8031892c40f38cc140cf128711bc0cb0b800793ff4f8
6
+ metadata.gz: 2c83f06540c5cb55fbc276c8c8c565e52626ab5371fc4711b9a19332155fbc708faf9d8e9f7bf872c1f754410460a9b7a4c6e97dfd1c197fdd6705640907c3df
7
+ data.tar.gz: 66439b6015456b0110de1635c912f3c10827b77d850baeb9d49e12db49da012bc8be7962b705daed05885a7453ad7ef877a18b6c58e8983eb8b23cf844b0dc55
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [5.0.0] - 2026-09-17
4
+
5
+ - [Breaking change] The vocabulary is `company` 4.0: `of` takes the ID Housecall Pro files a
6
+ technician under rather than the technician, so `account.visits.of(technician.id)` is what
7
+ `account.visits.of(technician)` was, and the same for `account.windows`. The pin is `~> 4.0`.
8
+
9
+ - [Note] The ID is the whole of what this gem ever narrowed by -- `employee_ids` on both lists,
10
+ and a comparison on the walk -- and taking it plainly is what stops a caller handing over a
11
+ record of its own whose `id` is not the one Housecall Pro knows. That has already happened
12
+ once, and Housecall Pro answered with everybody's free time rather than one person's.
13
+
3
14
  ## [4.1.0] - 2026-09-17
4
15
 
5
16
  - [Feature] `account.visits.for_work`, the stops of jobs and of estimates together and the hours
data/README.md CHANGED
@@ -151,7 +151,7 @@ One technician's week is the visits in it narrowed to them, which is how a sched
151
151
 
152
152
  ```ruby
153
153
  monday = Date.today.beginning_of_week.in_time_zone
154
- account.visits.between(monday, monday + 1.week).of(technician).each do |visit|
154
+ account.visits.between(monday, monday + 1.week).of(technician.id).each do |visit|
155
155
  visit.starts_at, visit.ends_at, visit.job.location.street
156
156
  end
157
157
  ```
@@ -167,7 +167,7 @@ The other half of that week is the hours they are *not* out, which Housecall Pro
167
167
  itself and answers whole:
168
168
 
169
169
  ```ruby
170
- account.windows.between(monday, monday + 1.week).of(technician).each do |window|
170
+ account.windows.between(monday, monday + 1.week).of(technician.id).each do |window|
171
171
  window.starts_at, window.ends_at
172
172
  end
173
173
  ```
@@ -6,7 +6,7 @@ module Hcp
6
6
  # @param client [Client] how to reach Housecall Pro as the location.
7
7
  # @param from [Time, nil] the moment the window opens, or nothing for every visit there was.
8
8
  # @param to [Time, nil] the moment the window closes, or nothing for every visit to come.
9
- # @param technician [Company::Technician, nil] whose work to ask for, or nothing for all.
9
+ # @param technician [String, nil] ID of whose work to ask for, or nothing for all.
10
10
  # @param jobs [Boolean] whether to read the stops of jobs.
11
11
  # @param leads [Boolean] whether to read the stops of estimates.
12
12
  # @param events [Boolean] whether to read the hours blocked out around them.
@@ -29,12 +29,12 @@ module Hcp
29
29
  # Housecall Pro narrows both lists by who is assigned to the work, so the window is asked
30
30
  # for as this technician's; a job's stop is the whole crew's until somebody is dispatched
31
31
  # to it, so the stops they are not on are let go once the work comes back.
32
- # @param technician [Company::Technician] whoever the work is booked for.
33
- # @return [Company::Selection] the same list, narrowed to the stops they are booked for.
34
- def of(technician)
35
- theirs = with technician: technician
32
+ # @param id [String] ID Housecall Pro files whoever the work is booked for under.
33
+ # @return [Company::Selection] the same list, narrowed to the visits they are booked for.
34
+ def of(id)
35
+ theirs = with technician: id
36
36
  Company::Selection.new(collection: theirs) do |visit|
37
- visit.technicians.any? { |each| each.id == technician.id }
37
+ visit.technicians.any? { |technician| technician.id == id }
38
38
  end
39
39
  end
40
40
 
@@ -75,7 +75,7 @@ module Hcp
75
75
 
76
76
  def window = @from..@to
77
77
 
78
- def crew = { employee_ids: (@technician && [ @technician.id ]) }
78
+ def crew = { employee_ids: (@technician && [ @technician ]) }
79
79
 
80
80
  def jobs
81
81
  bounds = { scheduled_end_min: @from&.utc&.iso8601, scheduled_start_max: @to&.utc&.iso8601 }
@@ -9,8 +9,8 @@ module Hcp
9
9
  DAYS = 7
10
10
 
11
11
  # @param client [Client] how to reach Housecall Pro as the location.
12
- # @param technician [Company::Technician, nil] whose free time to ask for, or nothing for
13
- # whether anybody at all is free.
12
+ # @param technician [String, nil] ID of whose free time to ask for, or nothing for whether
13
+ # anybody at all is free.
14
14
  # @param from [Time, nil] the moment the window opens, or nothing for the first day open.
15
15
  # @param to [Time, nil] the moment the window closes, or nothing for a week of it.
16
16
  def initialize(client:, technician: nil, from: nil, to: nil)
@@ -27,9 +27,9 @@ module Hcp
27
27
 
28
28
  # Housecall Pro narrows free time by who it is free for, so the technician joins the window
29
29
  # in the one request and nobody else's hours are answered or paid for.
30
- # @param technician [Company::Technician] whose free time to answer.
30
+ # @param id [String] ID Housecall Pro files whoever is free under.
31
31
  # @return [Windows] the same list, as that technician's alone.
32
- def of(technician) = with(technician: technician)
32
+ def of(id) = with(technician: id)
33
33
 
34
34
  # Housecall Pro answers a week as a row of short windows, each open or not. Consecutive open
35
35
  # ones are one stretch of free time and are joined back into it, so what comes out is as long
@@ -61,7 +61,7 @@ module Hcp
61
61
 
62
62
  def params
63
63
  { start_date: @from&.utc&.strftime('%Y-%m-%dT%H:%M:%S'), show_for_days: days,
64
- employee_ids: (@technician && [ @technician.id ]), }.compact
64
+ employee_ids: (@technician && [ @technician ]), }.compact
65
65
  end
66
66
 
67
67
  def days = (@to && @from) ? ((@to - @from) / 1.day).ceil : DAYS
data/lib/hcp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # The Housecall Pro API, answered in the vocabulary of the company gem.
2
2
  module Hcp
3
3
  # The version of this gem, as RubyGems knows it.
4
- VERSION = '4.1.0'
4
+ VERSION = '5.0.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
@@ -29,14 +29,14 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '3.1'
32
+ version: '4.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '3.1'
39
+ version: '4.0'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: ice_cube
42
42
  requirement: !ruby/object:Gem::Requirement