timetree 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/timetree/base_model.rb +3 -1
- data/lib/timetree/calendar.rb +4 -4
- data/lib/timetree/client.rb +14 -1
- data/lib/timetree/event.rb +4 -8
- data/lib/timetree/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd16ab1a54faf7be5a951aa8472e997f791ab3dc1bdb06d1588f0630920c2a1
|
4
|
+
data.tar.gz: 0c2ba91f9b256c5011f053cdf831d35c905486097a6cb832635d25261fe3f77a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01db118d26095eed595b67747f51cd2203fc767378b1b2c39f5ef4985098bf53ba53a2c60d836717924281b603af09f24700bc9ac3ef1d4b63a0b71495baa932
|
7
|
+
data.tar.gz: 29ff89e03d4d9919fbd981f4b34b0fa2ae0a6df5ca57a61b29a50497fd56b3888739139ebd48c554ac120f5aa9369eb8e3658cefcddad19207ea1b42490a1112
|
data/CHANGELOG.md
CHANGED
data/lib/timetree/base_model.rb
CHANGED
@@ -18,7 +18,7 @@ module TimeTree
|
|
18
18
|
# @param client [TimeTree::Client]
|
19
19
|
# @return [TimeTree::User, TimeTree::Label, TimeTree::Calendar, TimeTree::Event, TimeTree::Activity]
|
20
20
|
# A TimeTree model object that be based on the type.
|
21
|
-
# @raise [TimeTree::Error] if the type property is not set.
|
21
|
+
# @raise [TimeTree::Error] if the type property is not set or unknown.
|
22
22
|
# @since 0.0.1
|
23
23
|
def self.to_model(data, included: nil, client: nil)
|
24
24
|
id = data[:id]
|
@@ -47,6 +47,8 @@ module TimeTree
|
|
47
47
|
Event.new(**params)
|
48
48
|
when 'activity'
|
49
49
|
Activity.new(**params)
|
50
|
+
else
|
51
|
+
raise Error, "type '#{type}' is unknown."
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
data/lib/timetree/calendar.rb
CHANGED
@@ -25,7 +25,7 @@ module TimeTree
|
|
25
25
|
# @param event_id [String]
|
26
26
|
# event's id.
|
27
27
|
# @return [TimeTree::Event]
|
28
|
-
# @raise [TimeTree::Error] if @client is
|
28
|
+
# @raise [TimeTree::Error] if @client, @id or the event_id arg is empty.
|
29
29
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
30
30
|
# @since 0.0.1
|
31
31
|
def event(event_id)
|
@@ -41,7 +41,7 @@ module TimeTree
|
|
41
41
|
# @param timezone [String]
|
42
42
|
# Timezone.
|
43
43
|
# @return [Array<TimeTree::Event>]
|
44
|
-
# @raise [TimeTree::Error] if @client is
|
44
|
+
# @raise [TimeTree::Error] if @client or @id is empty.
|
45
45
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
46
46
|
# @since 0.0.1
|
47
47
|
def upcoming_events(days: 7, timezone: 'UTC')
|
@@ -53,7 +53,7 @@ module TimeTree
|
|
53
53
|
# Get a calendar's member information.
|
54
54
|
#
|
55
55
|
# @return [Array<TimeTree::User>]
|
56
|
-
# @raise [TimeTree::Error] if @client is
|
56
|
+
# @raise [TimeTree::Error] if @client or @id is empty.
|
57
57
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
58
58
|
# @since 0.0.1
|
59
59
|
def members
|
@@ -67,7 +67,7 @@ module TimeTree
|
|
67
67
|
# Get a calendar's label information used in event.
|
68
68
|
#
|
69
69
|
# @return [Array<TimeTree::Label>]
|
70
|
-
# @raise [TimeTree::Error] if @client is
|
70
|
+
# @raise [TimeTree::Error] if @client or @id is empty.
|
71
71
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
72
72
|
# @since 0.0.1
|
73
73
|
def labels
|
data/lib/timetree/client.rb
CHANGED
@@ -40,6 +40,7 @@ module TimeTree
|
|
40
40
|
# @param include_relationships [Array<symbol>]
|
41
41
|
# includes association's object in the response.
|
42
42
|
# @return [TimeTree::Calendar]
|
43
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
43
44
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
44
45
|
# @since 0.0.1
|
45
46
|
def calendar(cal_id, include_relationships: nil)
|
@@ -73,6 +74,7 @@ module TimeTree
|
|
73
74
|
#
|
74
75
|
# @param cal_id [String] calendar's id.
|
75
76
|
# @return [Array<TimeTree::Label>]
|
77
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
76
78
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
77
79
|
# @since 0.0.1
|
78
80
|
def calendar_labels(cal_id)
|
@@ -88,6 +90,7 @@ module TimeTree
|
|
88
90
|
#
|
89
91
|
# @param cal_id [String] calendar's id.
|
90
92
|
# @return [Array<TimeTree::User>]
|
93
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
91
94
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
92
95
|
# @since 0.0.1
|
93
96
|
def calendar_members(cal_id)
|
@@ -106,6 +109,8 @@ module TimeTree
|
|
106
109
|
# @param include_relationships [Array<symbol>]
|
107
110
|
# includes association's object in the response.
|
108
111
|
# @return [TimeTree::Event]
|
112
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
113
|
+
# @raise [TimeTree::Error] if the event_id arg is empty.
|
109
114
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
110
115
|
# @since 0.0.1
|
111
116
|
def event(cal_id, event_id, include_relationships: nil)
|
@@ -129,6 +134,7 @@ module TimeTree
|
|
129
134
|
# @param include_relationships [Array<symbol>]
|
130
135
|
# includes association's object in the response.
|
131
136
|
# @return [Array<TimeTree::Event>]
|
137
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
132
138
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
133
139
|
# @since 0.0.1
|
134
140
|
def upcoming_events(cal_id, days: 7, timezone: 'UTC', include_relationships: nil)
|
@@ -152,6 +158,7 @@ module TimeTree
|
|
152
158
|
# @param cal_id [String] calendar's id.
|
153
159
|
# @param params [Hash] TimeTree request body format.
|
154
160
|
# @return [TimeTree::Event]
|
161
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
155
162
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
156
163
|
# @since 0.0.1
|
157
164
|
def create_event(cal_id, params)
|
@@ -172,6 +179,8 @@ module TimeTree
|
|
172
179
|
# @param params [Hash]
|
173
180
|
# event's information specified in TimeTree request body format.
|
174
181
|
# @return [TimeTree::Event]
|
182
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
183
|
+
# @raise [TimeTree::Error] if the event_id arg is empty.
|
175
184
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
176
185
|
# @since 0.0.1
|
177
186
|
def update_event(cal_id, event_id, params)
|
@@ -191,6 +200,8 @@ module TimeTree
|
|
191
200
|
# @param cal_id [String] calendar's id.
|
192
201
|
# @param event_id [String] event's id.
|
193
202
|
# @return [true] if the operation succeeded.
|
203
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
204
|
+
# @raise [TimeTree::Error] if the event_id arg is empty.
|
194
205
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
195
206
|
# @since 0.0.1
|
196
207
|
def delete_event(cal_id, event_id)
|
@@ -210,7 +221,9 @@ module TimeTree
|
|
210
221
|
# @param params [Hash]
|
211
222
|
# comment's information specified in TimeTree request body format.
|
212
223
|
# @return [TimeTree::Activity]
|
213
|
-
# @raise [TimeTree::
|
224
|
+
# @raise [TimeTree::Error] if the cal_id arg is empty.
|
225
|
+
# @raise [TimeTree::Error] if the event_id arg is empty.
|
226
|
+
# @raise [TimeTree::ApiError] if the http response status is not success.
|
214
227
|
# @since 0.0.1
|
215
228
|
def create_activity(cal_id, event_id, params)
|
216
229
|
check_calendar_id cal_id
|
data/lib/timetree/event.rb
CHANGED
@@ -49,7 +49,7 @@ module TimeTree
|
|
49
49
|
# Creates an event to the associated calendar.
|
50
50
|
#
|
51
51
|
# @return [TimeTree::Event]
|
52
|
-
# @raise [TimeTree::Error] if @client is
|
52
|
+
# @raise [TimeTree::Error] if @client or @calendar_id is empty.
|
53
53
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
54
54
|
# @since 0.0.1
|
55
55
|
def create
|
@@ -61,8 +61,7 @@ module TimeTree
|
|
61
61
|
# Updates the event.
|
62
62
|
#
|
63
63
|
# @return [TimeTree::Event]
|
64
|
-
# @raise [TimeTree::Error] if @client is
|
65
|
-
# @raise [TimeTree::Error] if the id property is not set.
|
64
|
+
# @raise [TimeTree::Error] if @client, @calendar_id or @id is empty.
|
66
65
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
67
66
|
# @since 0.0.1
|
68
67
|
def update
|
@@ -74,8 +73,7 @@ module TimeTree
|
|
74
73
|
# Deletes the event.
|
75
74
|
#
|
76
75
|
# @return [true] if the operation succeeded.
|
77
|
-
# @raise [TimeTree::Error] if @client is
|
78
|
-
# @raise [TimeTree::Error] if the id property is not set.
|
76
|
+
# @raise [TimeTree::Error] if @client, @calendar_id or @id is empty.
|
79
77
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
80
78
|
# @since 0.0.1
|
81
79
|
def delete
|
@@ -87,15 +85,13 @@ module TimeTree
|
|
87
85
|
# Creates comment to the event.
|
88
86
|
#
|
89
87
|
# @return [TimeTree::Activity]
|
90
|
-
# @raise [TimeTree::Error] if @client is
|
88
|
+
# @raise [TimeTree::Error] if @client, @calendar_id or @id is empty.
|
91
89
|
# @raise [TimeTree::ApiError] if the http response status will not success.
|
92
90
|
# @since 0.0.1
|
93
91
|
def create_comment(message)
|
94
92
|
check_client
|
95
93
|
params = { type: 'activity', attributes: { calendar_id: calendar_id, event_id: id, content: message } }
|
96
94
|
activity = to_model params
|
97
|
-
return if activity.nil?
|
98
|
-
|
99
95
|
activity.create
|
100
96
|
end
|
101
97
|
|
data/lib/timetree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timetree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Koshikawa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -174,7 +174,7 @@ metadata:
|
|
174
174
|
homepage_uri: https://github.com/koshilife/timetree-api-ruby-client
|
175
175
|
source_code_uri: https://github.com/koshilife/timetree-api-ruby-client
|
176
176
|
changelog_uri: https://github.com/koshilife/timetree-api-ruby-client/blob/master/CHANGELOG.md
|
177
|
-
documentation_uri: https://www.rubydoc.info/gems/timetree/0.1.
|
177
|
+
documentation_uri: https://www.rubydoc.info/gems/timetree/0.1.4
|
178
178
|
post_install_message:
|
179
179
|
rdoc_options: []
|
180
180
|
require_paths:
|