timetree 0.1.3 → 0.2.0

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
  SHA256:
3
- metadata.gz: 1a43c7c885e6f0f2e55fdcf9b6c145e13e981fea4fee23dc468f5f16923826c0
4
- data.tar.gz: b1dffa32b6a9d80ebca9e6de06a030e43e9d2bfe895bf9ac5ad4fa687d8f3b4a
3
+ metadata.gz: dd2a9142e5ee6614ec6e97f691d61a2b054d0db7616487efa84f7ecfa89aab82
4
+ data.tar.gz: f41663400a01d61da7e4cb26ef302c415ff238f8bc58c1b54b1d10156934ab6d
5
5
  SHA512:
6
- metadata.gz: be24215ef1f52ccb2b0c8a8ce87f29dc2132e5987ba99533c73017cbc6a669d45dd5d565c1ff3fa1824d66cadeeddaf91f36ccaf6abd1150c755e0f836383e18
7
- data.tar.gz: 1eb41d1864cabaf26293102c7a1b288da4e36930bce4599270e9e57e3b00e85a03e1d0bf2296f1d52ba0d26fcc4418ce287fc45a382da63c99c66209840890c3
6
+ metadata.gz: a7793feb335fcee92f1c19733206a67b3f2e94fcef7e809701db8fd31e80835689f4dbb604422223fcd9c2c6848a5a8ea8ece93dc401cfe65a2b99234c1dde65
7
+ data.tar.gz: ce9319e7839ce5663e2b15723b5492825332bab5265e7d57ba3d9bd84c59dd3a2b999ffb5de1c77c941e215c226a43699c4b5267aab790539c19e3ce11eb4a8d
@@ -0,0 +1,37 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+
7
+ jobs:
8
+ build:
9
+ name: Build + Publish
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby 2.6
15
+ uses: actions/setup-ruby@v1
16
+ with:
17
+ ruby-version: 2.6
18
+
19
+ - name: Build and test
20
+ run: |
21
+ gem install bundler
22
+ bundle install --jobs 4 --retry 3
23
+ bundle exec rake test
24
+ env:
25
+ CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
26
+
27
+ - name: Publish to RubyGems
28
+ run: |
29
+ mkdir -p $HOME/.gem
30
+ touch $HOME/.gem/credentials
31
+ chmod 0600 $HOME/.gem/credentials
32
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33
+ gem build *.gemspec
34
+ gem push *.gem
35
+ continue-on-error: true
36
+ env:
37
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -0,0 +1,21 @@
1
+ name: Test
2
+
3
+ on: pull_request
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.6
15
+ - name: Build and test
16
+ run: |
17
+ gem install bundler
18
+ bundle install --jobs 4 --retry 3
19
+ bundle exec rake test
20
+ env:
21
+ CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
data/.gitignore CHANGED
@@ -7,5 +7,4 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
 
10
- coverage
11
- Gemfile.lock
10
+ Gemfile.lock
@@ -1,3 +1,24 @@
1
+ # 0.2.0
2
+
3
+ - organize model classes.
4
+
5
+ # 0.1.7
6
+
7
+ - refs #16 correct a mistake codecov badge url on README
8
+
9
+ # 0.1.6
10
+
11
+ - refs #16 add code coverage to readme.
12
+ - refs #17 update deprecated `version` for `ruby-version` on gem-push.yml.
13
+
14
+ # 0.1.5
15
+
16
+ - refs #6 setup GitHub Actions.
17
+
18
+ # 0.1.4
19
+
20
+ - updates comments.
21
+
1
22
  # 0.1.3
2
23
 
3
24
  - refs #7 #9 make the code coverage 100%.
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Simple TimeTree APIs client
2
2
 
3
+ [![Test](https://github.com/koshilife/timetree-api-ruby-client/workflows/Test/badge.svg)](https://github.com/koshilife/timetree-api-ruby-client/actions?query=workflow%3ATest)
4
+ [![codecov](https://codecov.io/gh/koshilife/timetree-api-ruby-client/branch/master/graph/badge.svg)](https://codecov.io/gh/koshilife/timetree-api-ruby-client)
3
5
  [![Gem Version](https://badge.fury.io/rb/timetree.svg)](http://badge.fury.io/rb/timetree)
6
+ [![license](https://img.shields.io/github/license/koshilife/timetree-api-ruby-client)](https://github.com/koshilife/timetree-api-ruby-client/blob/master/LICENSE.txt)
4
7
 
5
8
  ## About
6
9
 
@@ -1,14 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "timetree"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
4
+ require 'bundler/setup'
5
+ require 'timetree'
6
+ require 'irb'
14
7
  IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -4,5 +4,3 @@ IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
6
  bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -5,6 +5,7 @@ loader = Zeitwerk::Loader.for_gem
5
5
  loader.inflector.inflect(
6
6
  'timetree' => 'TimeTree'
7
7
  )
8
+ loader.collapse('**/models')
8
9
  loader.setup
9
10
 
10
11
  # module for TimeTree apis client
@@ -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::ApiError] if the nhttp response status is not success.
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
@@ -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
 
@@ -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 not set.
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 not set.
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 not set.
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 not set.
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
@@ -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 not set.
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 not set.
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 not set.
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 not set.
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
 
File without changes
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TimeTree
4
- VERSION = '0.1.3'
4
+ VERSION = '0.2.0'
5
5
  end
@@ -33,9 +33,10 @@ Gem::Specification.new do |spec|
33
33
  spec.add_runtime_dependency 'zeitwerk', '~> 2.3.0'
34
34
 
35
35
  spec.add_development_dependency 'bundler', '~> 2.0'
36
+ spec.add_development_dependency 'codecov', '~> 0.1.17'
36
37
  spec.add_development_dependency 'minitest', '~> 5.14.0'
37
38
  spec.add_development_dependency 'minitest-reporters', '~> 1.4.2'
38
39
  spec.add_development_dependency 'rake', '~> 12.0'
39
- spec.add_development_dependency 'webmock', '~> 3.7.6'
40
40
  spec.add_development_dependency 'simplecov', '~> 0.18.5'
41
+ spec.add_development_dependency 'webmock', '~> 3.7.6'
41
42
  end
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.3
4
+ version: 0.2.0
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-29 00:00:00.000000000 Z
11
+ date: 2020-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: codecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.1.17
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.1.17
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: minitest
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -109,33 +123,33 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '12.0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: webmock
126
+ name: simplecov
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
129
  - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: 3.7.6
131
+ version: 0.18.5
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
136
  - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: 3.7.6
138
+ version: 0.18.5
125
139
  - !ruby/object:Gem::Dependency
126
- name: simplecov
140
+ name: webmock
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
143
  - - "~>"
130
144
  - !ruby/object:Gem::Version
131
- version: 0.18.5
145
+ version: 3.7.6
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
150
  - - "~>"
137
151
  - !ruby/object:Gem::Version
138
- version: 0.18.5
152
+ version: 3.7.6
139
153
  description: Client for accessing TimeTree APIs
140
154
  email:
141
155
  - koshikawa2009@gmail.com
@@ -143,9 +157,10 @@ executables: []
143
157
  extensions: []
144
158
  extra_rdoc_files: []
145
159
  files:
160
+ - ".github/workflows/gem-push.yml"
161
+ - ".github/workflows/test.yml"
146
162
  - ".gitignore"
147
163
  - ".rubocom.yml"
148
- - ".travis.yml"
149
164
  - CHANGELOG.md
150
165
  - CODE_OF_CONDUCT.md
151
166
  - Gemfile
@@ -155,16 +170,16 @@ files:
155
170
  - bin/console
156
171
  - bin/setup
157
172
  - lib/timetree.rb
158
- - lib/timetree/activity.rb
159
173
  - lib/timetree/api_error.rb
160
- - lib/timetree/base_model.rb
161
- - lib/timetree/calendar.rb
162
174
  - lib/timetree/client.rb
163
175
  - lib/timetree/configuration.rb
164
- - lib/timetree/event.rb
165
176
  - lib/timetree/http_command.rb
166
- - lib/timetree/label.rb
167
- - lib/timetree/user.rb
177
+ - lib/timetree/models/activity.rb
178
+ - lib/timetree/models/base_model.rb
179
+ - lib/timetree/models/calendar.rb
180
+ - lib/timetree/models/event.rb
181
+ - lib/timetree/models/label.rb
182
+ - lib/timetree/models/user.rb
168
183
  - lib/timetree/version.rb
169
184
  - timetree.gemspec
170
185
  homepage: https://github.com/koshilife/timetree-api-ruby-client
@@ -174,7 +189,7 @@ metadata:
174
189
  homepage_uri: https://github.com/koshilife/timetree-api-ruby-client
175
190
  source_code_uri: https://github.com/koshilife/timetree-api-ruby-client
176
191
  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.3
192
+ documentation_uri: https://www.rubydoc.info/gems/timetree/0.2.0
178
193
  post_install_message:
179
194
  rdoc_options: []
180
195
  require_paths:
@@ -190,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
205
  - !ruby/object:Gem::Version
191
206
  version: '0'
192
207
  requirements: []
193
- rubygems_version: 3.1.4
208
+ rubygems_version: 3.0.3
194
209
  signing_key:
195
210
  specification_version: 4
196
211
  summary: Client for accessing TimeTree APIs
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.3
6
- before_install: gem install bundler -v 2.1.4