bps-google-api 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e879f7388cbb93030b4c0ebb10ba8a7f0ebbce2
4
- data.tar.gz: 2db793f99ffe1de7c5170b95e3c7d14278f30681
3
+ metadata.gz: b77040196a93c3ed682e0bcd28b1db7ef594bb49
4
+ data.tar.gz: 9aa7deb73ce20a9dea1ecc582c627d7120c76fae
5
5
  SHA512:
6
- metadata.gz: 15b9400b2a26b43ea093798a9129115d61d3106b21f4d491075aaf191f2f86a729ff024fd39b7ba8ac341e9bf1bc85d664a9bc613c1f89279583e186501b005b
7
- data.tar.gz: 22b09c587f8b7f831d31e586e1118660b1a7d1dca4d1ba88240209a6b38b413f4b9913d2eedb4aedd6a127f8a35973af71207ca16c5c6098cb484b8f7ac34b15
6
+ metadata.gz: 9c017f0c3170205f69642fce1e107ce705a76bf7b2d233ad60a3c63425aa24ea4db3599063cdcc209366043399178173cbc992e7931a97600752d129b11e2539
7
+ data.tar.gz: b659861c968fc28453cd7b1e4cc467445aade4c60356ddf19a2d44c96fd52ec1f566bc1ef5ac15ff2179e10e4a1ed5b3734661ba36cd133b95b197eee24e4a6c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bps-google-api (0.4.0)
4
+ bps-google-api (0.4.1)
5
5
  exp_retry (~> 0.0.11)
6
6
  fileutils (~> 1.2)
7
7
  google-api-client (~> 0.23.4)
data/Readme.md CHANGED
@@ -62,13 +62,20 @@ TZ # Timezone
62
62
  By default, if no configuration is available, `.new` will automatically run
63
63
  `.authorize!` and return a URL to generate an authorization token.
64
64
 
65
+ ### Configured Classes
66
+
67
+ There are configured classes for both calendars and groups. This allows you to
68
+ only specify the parent id once.
69
+
65
70
  ```ruby
66
71
  calendar = GoogleAPI::Configured::Calendar.new(calendar_id)
67
72
 
68
73
  calendar.create(event_options)
69
74
  calendar.list(max_results: 2500, page_token: nil)
70
75
  calendar.get(event_id)
71
- calendar.update(event_id, event_options)
76
+ calendar.patch(event_id, patch_options)
77
+ calendar.update(event_id, updated_event_options)
78
+ calendar.add_conference(event_id)
72
79
  calendar.delete(event_id)
73
80
 
74
81
  calendar.permit(user)
@@ -84,6 +91,18 @@ group.add('somebody@example.com')
84
91
  group.remove('somebody@example.com')
85
92
  ```
86
93
 
94
+ There is also an event-specific configured class:
95
+
96
+ ```ruby
97
+ event = GoogleAPI::Configured::Calendar::Event.new(calendar_id, event_id)
98
+
99
+ event.get
100
+ event.patch(patch_options)
101
+ event.update(updated_event_options)
102
+ event.add_conference
103
+ event.delete
104
+ ```
105
+
87
106
  ### Event Options
88
107
 
89
108
  Available event options are listed in `GoogleAPI::Calendar::VALID_EVENT_KEYS`.
@@ -104,3 +123,32 @@ To add a Meet call to an event, merge the following into `event_options`:
104
123
  ```ruby
105
124
  { conference: { id: meeting_id, signature: meeting_signature } }
106
125
  ```
126
+
127
+ To create a new Meet call on an event, merge the following into
128
+ `event_options` instead:
129
+
130
+ ```ruby
131
+ { conference: { id: :new } }
132
+ ```
133
+
134
+ ## Testing
135
+
136
+ ### Rspec
137
+
138
+ Rspec testing is available:
139
+
140
+ `bundle exec rspec`
141
+
142
+ The spec suite will fail if under 100% coverage.
143
+
144
+ ### Rubocop
145
+
146
+ Rubocop formatting validation is available:
147
+
148
+ `bundle exec rubocop`
149
+
150
+ ### Automatic Builds
151
+
152
+ Builds are generated automatically by [Travis CI](https://travis-ci.org/jfiander/bps-google-api).
153
+
154
+ Build success requires both `rspec` and `rubocop` to pass.
@@ -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.0'
5
+ s.version = '0.4.1'
6
6
  s.date = '2019-06-27'
7
7
  s.summary = 'Configured Google API'
8
8
  s.description = 'A configured Google API wrapper.'
@@ -30,6 +30,22 @@ class GoogleAPI
30
30
  call(:list_events, calendar_id, max_results: max_results, page_token: page_token)
31
31
  end
32
32
 
33
+ def list_all(calendar_id, verbose: false)
34
+ events = []
35
+
36
+ list = call(:list_events, calendar_id)
37
+ events += list.items
38
+
39
+ while (page_token = list.next_page_token)
40
+ list = call(:list_events, calendar_id, page_token: page_token)
41
+ page_token = list.next_page_token
42
+ events += list.items
43
+ print('.') if verbose
44
+ end
45
+
46
+ events
47
+ end
48
+
33
49
  def get(calendar_id, event_id)
34
50
  call(:get_event, calendar_id, event_id)
35
51
  end
@@ -17,6 +17,10 @@ class GoogleAPI
17
17
  self.class.api.list(calendar_id, max_results: max_results, page_token: page_token)
18
18
  end
19
19
 
20
+ def list_all
21
+ self.class.api.list_all(calendar_id)
22
+ end
23
+
20
24
  def create(event_options = {})
21
25
  self.class.api.create(calendar_id, event_options)
22
26
  end
@@ -77,6 +77,10 @@ RSpec.describe GoogleAPI::Calendar do
77
77
  expect(subject.list).to be_a(Google::Apis::CalendarV3::Events)
78
78
  end
79
79
 
80
+ it 'returns the array of all events from list_all' do
81
+ expect(subject.list_all.map(&:class).uniq).to eql([Google::Apis::CalendarV3::Event])
82
+ end
83
+
80
84
  it 'creates an event' do
81
85
  expect(subject.create(test_event)).to be_a(Google::Apis::CalendarV3::Event)
82
86
  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.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander