bps-google-api 0.4.1 → 0.4.3

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
  SHA1:
3
- metadata.gz: b77040196a93c3ed682e0bcd28b1db7ef594bb49
4
- data.tar.gz: 9aa7deb73ce20a9dea1ecc582c627d7120c76fae
3
+ metadata.gz: 723824ab2925aa6bc8778e59f3e6be268e50bf3b
4
+ data.tar.gz: a5d1a77bf89d357b1134aa1dbd5a8568128f041a
5
5
  SHA512:
6
- metadata.gz: 9c017f0c3170205f69642fce1e107ce705a76bf7b2d233ad60a3c63425aa24ea4db3599063cdcc209366043399178173cbc992e7931a97600752d129b11e2539
7
- data.tar.gz: b659861c968fc28453cd7b1e4cc467445aade4c60356ddf19a2d44c96fd52ec1f566bc1ef5ac15ff2179e10e4a1ed5b3734661ba36cd133b95b197eee24e4a6c
6
+ metadata.gz: 20cc6578a559490cd3303963b815b9fca1af009a1283d8a375e174c639123b5d4ecb60b07029842d0d58c75653335337a3248cdcaed664f17a79e0116819d7ce
7
+ data.tar.gz: b5c762bc067c09a2d0aa723570716e6d26a7c0a21e07e3d9523aa20cbb34ca18dd91135aa72c7ecff8318314a0d5c226f6be9bd0f7d71614b7e4000a8a2189c2
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  config/
2
2
  coverage/
3
- tmp/
3
+ tmp/
4
+ lib/google_api/tmp
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bps-google-api (0.4.1)
4
+ bps-google-api (0.4.3)
5
5
  exp_retry (~> 0.0.11)
6
6
  fileutils (~> 1.2)
7
7
  google-api-client (~> 0.23.4)
data/Readme.md CHANGED
@@ -72,10 +72,12 @@ calendar = GoogleAPI::Configured::Calendar.new(calendar_id)
72
72
 
73
73
  calendar.create(event_options)
74
74
  calendar.list(max_results: 2500, page_token: nil)
75
+ calendar.list_all
75
76
  calendar.get(event_id)
76
77
  calendar.patch(event_id, patch_options)
77
78
  calendar.update(event_id, updated_event_options)
78
79
  calendar.add_conference(event_id)
80
+ calendar.conference_info(event_id, all: false)
79
81
  calendar.delete(event_id)
80
82
 
81
83
  calendar.permit(user)
@@ -100,6 +102,7 @@ event.get
100
102
  event.patch(patch_options)
101
103
  event.update(updated_event_options)
102
104
  event.add_conference
105
+ event.conference_info(all: false)
103
106
  event.delete
104
107
  ```
105
108
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'bps-google-api'
5
- s.version = '0.4.1'
5
+ s.version = '0.4.3'
6
6
  s.date = '2019-06-27'
7
7
  s.summary = 'Configured Google API'
8
8
  s.description = 'A configured Google API wrapper.'
@@ -14,8 +14,7 @@ class GoogleAPI
14
14
 
15
15
  SERVICE_CLASS = Google::Apis::CalendarV3::CalendarService
16
16
  VALID_EVENT_KEYS ||= %i[
17
- summary start end description location recurrence conference
18
- conference_data
17
+ summary start end description location recurrence conference conference_data
19
18
  ].freeze
20
19
  VALID_PATCH_KEYS ||= %i[
21
20
  summary start end description location recurrence conference_data created reminders creator
@@ -15,6 +15,13 @@ class GoogleAPI
15
15
  call(:patch_event, calendar_id, event_id, patch_options, conference_data_version: 1)
16
16
  end
17
17
 
18
+ def conference_info(calendar_id, event_id, all: false)
19
+ conf = call(:get_event, calendar_id, event_id).conference_data
20
+ return conf if all
21
+
22
+ { id: conf.conference_id, signature: conf.signature }
23
+ end
24
+
18
25
  private
19
26
 
20
27
  def format_conference_data(event_options)
@@ -6,7 +6,7 @@ class GoogleAPI
6
6
  attr_writer :keys
7
7
 
8
8
  def initialize
9
- self.root = __dir__
9
+ self.root = File.join(__dir__, 'tmp')
10
10
 
11
11
  yield self if block_given?
12
12
  end
@@ -58,6 +58,10 @@ class GoogleAPI
58
58
  def add_conference(event_id)
59
59
  self.class.api.add_conference(calendar_id, event_id)
60
60
  end
61
+
62
+ def conference_info(event_id, all: false)
63
+ self.class.api.conference_info(calendar_id, event_id, all: all)
64
+ end
61
65
  end
62
66
  end
63
67
  end
@@ -34,6 +34,10 @@ class GoogleAPI
34
34
  def add_conference
35
35
  self.class.api.add_conference(calendar_id, event_id)
36
36
  end
37
+
38
+ def conference_info(all: false)
39
+ self.class.api.conference_info(calendar_id, event_id, all: all)
40
+ end
37
41
  end
38
42
  end
39
43
  end
@@ -78,6 +78,8 @@ RSpec.describe GoogleAPI::Calendar do
78
78
  end
79
79
 
80
80
  it 'returns the array of all events from list_all' do
81
+ subject.create(test_event) # Ensure at least one event exists
82
+
81
83
  expect(subject.list_all.map(&:class).uniq).to eql([Google::Apis::CalendarV3::Event])
82
84
  end
83
85
 
@@ -85,22 +87,35 @@ RSpec.describe GoogleAPI::Calendar do
85
87
  expect(subject.create(test_event)).to be_a(Google::Apis::CalendarV3::Event)
86
88
  end
87
89
 
88
- it 'creates an event with a new conference' do
89
- event = test_event.merge(conference: { id: :new })
90
- expect(subject.create(event)).to be_a(Google::Apis::CalendarV3::Event)
91
- end
90
+ describe 'conference data' do
91
+ it 'creates an event with a new conference' do
92
+ event = test_event.merge(conference: { id: :new })
92
93
 
93
- it 'creates an event with conference data' do
94
- event = subject.create(test_event)
95
- event = subject.add_conference(event.id)
96
- event_options = test_event.merge(
97
- conference: {
94
+ expect(subject.create(event)).to be_a(Google::Apis::CalendarV3::Event)
95
+ end
96
+
97
+ it 'creates an event with conference data' do
98
+ event = subject.create(test_event)
99
+ event = subject.add_conference(event.id)
100
+ event_options = test_event.merge(
101
+ conference: {
102
+ id: event.conference_data.conference_id,
103
+ signature: event.conference_data.signature
104
+ }
105
+ )
106
+
107
+ expect(subject.create(event_options)).to be_a(Google::Apis::CalendarV3::Event)
108
+ end
109
+
110
+ it 'returns valid conference information' do
111
+ event = subject.create(test_event)
112
+ event = subject.add_conference(event.id)
113
+
114
+ expect(subject.conference_info(event.id)).to eql(
98
115
  id: event.conference_data.conference_id,
99
116
  signature: event.conference_data.signature
100
- }
101
- )
102
-
103
- expect(subject.create(event_options)).to be_a(Google::Apis::CalendarV3::Event)
117
+ )
118
+ end
104
119
  end
105
120
 
106
121
  it 'gets an event ' do
@@ -40,7 +40,18 @@ RSpec.describe GoogleAPI::Configured::Calendar::Event do
40
40
  expect(subject.delete).to eql('')
41
41
  end
42
42
 
43
- it 'adds conference data' do
44
- expect(subject.add_conference).to be_a(Google::Apis::CalendarV3::Event)
43
+ describe 'conference data' do
44
+ it 'adds conference data' do
45
+ expect(subject.add_conference).to be_a(Google::Apis::CalendarV3::Event)
46
+ end
47
+
48
+ it 'returns valid conference information' do
49
+ event = subject.add_conference
50
+
51
+ expect(subject.conference_info).to eql(
52
+ id: event.conference_data.conference_id,
53
+ signature: event.conference_data.signature
54
+ )
55
+ end
45
56
  end
46
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bps-google-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander