bps-google-api 0.4.1 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +1 -1
- data/Readme.md +3 -0
- data/bps-google-api.gemspec +1 -1
- data/lib/google_api/calendar.rb +1 -2
- data/lib/google_api/calendar/conference.rb +7 -0
- data/lib/google_api/config.rb +1 -1
- data/lib/google_api/configured/calendar.rb +4 -0
- data/lib/google_api/configured/event.rb +4 -0
- data/spec/lib/google_api/calendar_spec.rb +28 -13
- data/spec/lib/google_api/event_spec.rb +13 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 723824ab2925aa6bc8778e59f3e6be268e50bf3b
|
4
|
+
data.tar.gz: a5d1a77bf89d357b1134aa1dbd5a8568128f041a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20cc6578a559490cd3303963b815b9fca1af009a1283d8a375e174c639123b5d4ecb60b07029842d0d58c75653335337a3248cdcaed664f17a79e0116819d7ce
|
7
|
+
data.tar.gz: b5c762bc067c09a2d0aa723570716e6d26a7c0a21e07e3d9523aa20cbb34ca18dd91135aa72c7ecff8318314a0d5c226f6be9bd0f7d71614b7e4000a8a2189c2
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
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
|
|
data/bps-google-api.gemspec
CHANGED
data/lib/google_api/calendar.rb
CHANGED
@@ -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)
|
data/lib/google_api/config.rb
CHANGED
@@ -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
|
-
|
89
|
-
|
90
|
-
|
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
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
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
|
-
|
44
|
-
|
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
|