cronofy 0.37.1 → 0.37.2
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/cronofy/client.rb +5 -5
- data/lib/cronofy/version.rb +1 -1
- data/spec/lib/cronofy/client_spec.rb +64 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e09c2030d7992753a4e8f0e52af1d00d2ab6ced77f5e5b81336cb97a5c98ec6
|
4
|
+
data.tar.gz: 464b7a63bdfb341f67da6f4556e4ee66b36db144d9d41270c9204ee6a10ca56c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6a6f59a184da190d6905b495a0c067437ab422561ccf26f23e1e7d6f48fd0a0d2c63bb033d46f760b9ce24e958539a58e319b8a160c2fc2a719f4f1e3f31bcd
|
7
|
+
data.tar.gz: a777db3452a6cc462ba526447c17fe0790d73dd8b08517d62363ac3f5d9b7cb076d2b77ef614ed51f981941451362bd0f568fab4749c08bdc9bc38533974729b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## [0.37.2]
|
2
|
+
|
3
|
+
* Support `query_periods` as well as the original `available_periods` for Availability Query and Sequenced Availability [#91]
|
4
|
+
|
1
5
|
## [0.37.1]
|
2
6
|
|
3
7
|
* Rename `data_centre` to `data_centre` (with aliases for backwards compatibility) [#90]
|
@@ -182,6 +186,7 @@
|
|
182
186
|
[0.36.1]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.36.1
|
183
187
|
[0.37.0]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.0
|
184
188
|
[0.37.1]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.1
|
189
|
+
[0.37.2]: https://github.com/cronofy/cronofy-ruby/releases/tag/v0.37.2
|
185
190
|
|
186
191
|
[#13]: https://github.com/cronofy/cronofy-ruby/pull/13
|
187
192
|
[#16]: https://github.com/cronofy/cronofy-ruby/pull/16
|
@@ -225,3 +230,4 @@
|
|
225
230
|
[#85]: https://github.com/cronofy/cronofy-ruby/pull/85
|
226
231
|
[#86]: https://github.com/cronofy/cronofy-ruby/pull/86
|
227
232
|
[#90]: https://github.com/cronofy/cronofy-ruby/pull/90
|
233
|
+
[#91]: https://github.com/cronofy/cronofy-ruby/pull/91
|
data/lib/cronofy/client.rb
CHANGED
@@ -803,7 +803,7 @@ module Cronofy
|
|
803
803
|
# for a single participant group.
|
804
804
|
# :required_duration - An Integer representing the minimum number
|
805
805
|
# of minutes of availability required.
|
806
|
-
# :
|
806
|
+
# :query_periods - An Array of available time periods Hashes,
|
807
807
|
# each must specify a start and end Time.
|
808
808
|
# :start_interval - An Integer representing the start interval
|
809
809
|
# of minutes for the availability query.
|
@@ -833,7 +833,7 @@ module Cronofy
|
|
833
833
|
options[:buffer] = map_availability_buffer(buffer)
|
834
834
|
end
|
835
835
|
|
836
|
-
translate_available_periods(options[:available_periods])
|
836
|
+
translate_available_periods(options[:query_periods] || options[:available_periods])
|
837
837
|
|
838
838
|
response = post("/v1/availability", options)
|
839
839
|
|
@@ -847,7 +847,7 @@ module Cronofy
|
|
847
847
|
# Public: Performs an sequenced availability query.
|
848
848
|
#
|
849
849
|
# options - The Hash options used to refine the selection (default: {}):
|
850
|
-
#
|
850
|
+
# :sequence - An Array of sequence defintions containing
|
851
851
|
# a Hash of:
|
852
852
|
# :sequence_id - A String to uniquely identify this part
|
853
853
|
# of the proposed sequence.
|
@@ -861,7 +861,7 @@ module Cronofy
|
|
861
861
|
# of minutes for the availability query.
|
862
862
|
# :buffer - An Hash containing the buffer to apply to
|
863
863
|
# the availability query.
|
864
|
-
#
|
864
|
+
# :query_periods - An Array of available time periods Hashes,
|
865
865
|
# each must specify a start and end Time.
|
866
866
|
#
|
867
867
|
# Returns an Array of Sequences.
|
@@ -878,7 +878,7 @@ module Cronofy
|
|
878
878
|
def sequenced_availability(options = {})
|
879
879
|
options[:sequence] = map_availability_sequence(options[:sequence])
|
880
880
|
|
881
|
-
translate_available_periods(options[:available_periods])
|
881
|
+
translate_available_periods(options[:query_periods] || options[:available_periods])
|
882
882
|
|
883
883
|
response = post("/v1/sequenced_availability", options)
|
884
884
|
parse_collection(Sequence, "sequences", response)
|
data/lib/cronofy/version.rb
CHANGED
@@ -266,6 +266,7 @@ describe Cronofy::Client do
|
|
266
266
|
],
|
267
267
|
}
|
268
268
|
end
|
269
|
+
|
269
270
|
let(:request_body) do
|
270
271
|
{
|
271
272
|
:event_id => "qTtZdczOccgaPncGJaCiLg",
|
@@ -1718,6 +1719,57 @@ describe Cronofy::Client do
|
|
1718
1719
|
it_behaves_like 'a Cronofy request'
|
1719
1720
|
it_behaves_like 'a Cronofy request with mapped return value'
|
1720
1721
|
end
|
1722
|
+
|
1723
|
+
context "when given query_periods instead of available_periods" do
|
1724
|
+
let(:participants) do
|
1725
|
+
{ members: %w{acc_567236000909002 acc_678347111010113} }
|
1726
|
+
end
|
1727
|
+
|
1728
|
+
let(:required_duration) { 60 }
|
1729
|
+
|
1730
|
+
let(:query_periods) do
|
1731
|
+
[
|
1732
|
+
{ start: Time.parse("2017-01-03T09:00:00Z"), end: Time.parse("2017-01-03T18:00:00Z") },
|
1733
|
+
{ start: Time.parse("2017-01-04T09:00:00Z"), end: Time.parse("2017-01-04T18:00:00Z") },
|
1734
|
+
]
|
1735
|
+
end
|
1736
|
+
|
1737
|
+
let(:request_body) do
|
1738
|
+
{
|
1739
|
+
"participants" => [
|
1740
|
+
{
|
1741
|
+
"members" => [
|
1742
|
+
{ "sub" => "acc_567236000909002" },
|
1743
|
+
{ "sub" => "acc_678347111010113" }
|
1744
|
+
],
|
1745
|
+
"required" => "all"
|
1746
|
+
}
|
1747
|
+
],
|
1748
|
+
"query_periods" => [
|
1749
|
+
{
|
1750
|
+
"start" => "2017-01-03T09:00:00Z",
|
1751
|
+
"end" => "2017-01-03T18:00:00Z"
|
1752
|
+
},
|
1753
|
+
{
|
1754
|
+
"start" => "2017-01-04T09:00:00Z",
|
1755
|
+
"end" => "2017-01-04T18:00:00Z"
|
1756
|
+
}
|
1757
|
+
],
|
1758
|
+
"required_duration" => { "minutes" => 60 },
|
1759
|
+
}
|
1760
|
+
end
|
1761
|
+
|
1762
|
+
subject do
|
1763
|
+
client.availability(
|
1764
|
+
participants: participants,
|
1765
|
+
required_duration: required_duration,
|
1766
|
+
query_periods: query_periods
|
1767
|
+
)
|
1768
|
+
end
|
1769
|
+
|
1770
|
+
it_behaves_like 'a Cronofy request'
|
1771
|
+
it_behaves_like 'a Cronofy request with mapped return value'
|
1772
|
+
end
|
1721
1773
|
end
|
1722
1774
|
end
|
1723
1775
|
|
@@ -1873,6 +1925,18 @@ describe Cronofy::Client do
|
|
1873
1925
|
|
1874
1926
|
it_behaves_like 'a Cronofy request'
|
1875
1927
|
it_behaves_like 'a Cronofy request with mapped return value'
|
1928
|
+
|
1929
|
+
context "when passing query_periods instead" do
|
1930
|
+
before do
|
1931
|
+
args[:query_periods] = args[:available_periods]
|
1932
|
+
args.delete(:available_periods)
|
1933
|
+
request_body["query_periods"] = request_body["available_periods"]
|
1934
|
+
request_body.delete("available_periods")
|
1935
|
+
end
|
1936
|
+
|
1937
|
+
it_behaves_like 'a Cronofy request'
|
1938
|
+
it_behaves_like 'a Cronofy request with mapped return value'
|
1939
|
+
end
|
1876
1940
|
end
|
1877
1941
|
end
|
1878
1942
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cronofy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.37.
|
4
|
+
version: 0.37.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergii Paryzhskyi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-01-
|
12
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|