timetree 0.1.7 → 0.3.2

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
  SHA256:
3
- metadata.gz: bffe4b8c7f5f0b823a2e9ea69366805c162b47c97a0ad38a3f244ac0d9d11362
4
- data.tar.gz: a9b07113a787279349db5840bbe10f48c1e9fef4523a3be6a79e7334b81f54d5
3
+ metadata.gz: 7b5824494b234019afe3260508db4d161c874771a65b041f005cda5e3d75ed3e
4
+ data.tar.gz: ef00a0a5c959255e10550c606a463fa9c4914aa95cd6f1dd864de5bbe990f697
5
5
  SHA512:
6
- metadata.gz: 51114aab5225929e87d24881ff392c65ea45271c80c93f70d46667d51a459c7776976e941b11a5759da1946f6d00d4169c1fc09c87aae4fd810fca60aaae54b7
7
- data.tar.gz: 5e82739d7134e02c937cb321e6d783784129188177a565be6f5f7f294d6df509e9444df21f1a2521456f9f0899e56102f9f22534ff3bde35a0e4a04fcf94504e
6
+ metadata.gz: aedb1c5f57d57426aad408626ee6b47adffeb1db0114a36679b5ef2958acd95308e7fd631dc93a2eb4fcf054ec7bed9eaeb1add8725086402a29439674ee15f2
7
+ data.tar.gz: 8587334f92c73d0247e19f44543af05d9a2bfdd7ecca7125f4d0f828ed53e51ec8bf5d9cc1b0b7f0816d4a70c0de7484614473a411141a54469d1229fb962e0d
@@ -32,5 +32,6 @@ jobs:
32
32
  printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33
33
  gem build *.gemspec
34
34
  gem push *.gem
35
+ continue-on-error: true
35
36
  env:
36
37
  GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_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
@@ -23,12 +23,11 @@ Metrics/BlockNesting:
23
23
  Max: 2
24
24
 
25
25
  Layout/LineLength:
26
- AllowURI: true
27
- Enabled: false
26
+ Max: 120
28
27
 
29
28
  Metrics/MethodLength:
30
29
  CountComments: false
31
- Max: 15
30
+ Max: 20
32
31
 
33
32
  Metrics/ParameterLists:
34
33
  Max: 4
@@ -39,10 +38,10 @@ Metrics/AbcSize:
39
38
 
40
39
  Style/CollectionMethods:
41
40
  PreferredMethods:
42
- map: 'collect'
43
- reduce: 'inject'
44
- find: 'detect'
45
- find_all: 'select'
41
+ map: "collect"
42
+ reduce: "inject"
43
+ find: "detect"
44
+ find_all: "select"
46
45
 
47
46
  Style/Documentation:
48
47
  Enabled: false
@@ -60,10 +59,13 @@ Style/ExpandPathArguments:
60
59
  Enabled: false
61
60
 
62
61
  Style/HashSyntax:
63
- EnforcedStyle: hash_rockets
62
+ EnforcedStyle: ruby19
64
63
 
65
64
  Style/Lambda:
66
65
  Enabled: false
67
66
 
68
67
  Style/RaiseArgs:
69
- EnforcedStyle: compact
68
+ EnforcedStyle: compact
69
+
70
+ Style/AsciiComments:
71
+ Enabled: false
@@ -1,36 +1,65 @@
1
- # 0.1.6
1
+ # CHANGELOG
2
+
3
+ ## 0.3.2
4
+
5
+ - remove zeitwerk dependency. (refs #29)
6
+
7
+ ## 0.3.1
8
+
9
+ - fix rubocop warnings.
10
+
11
+ ## 0.3.0
12
+
13
+ - refs #25 fix dependencies.
14
+ - remove minitest-reporter.
15
+
16
+ ## 0.2.1
17
+
18
+ - do refactor
19
+ - use `respond_to?(setter)` instead of `instance_methods.include?(setter)`.
20
+ - use getter method instead of instant variables if defined it.
21
+
22
+ ## 0.2.0
23
+
24
+ - organize model classes.
25
+
26
+ ## 0.1.7
27
+
28
+ - refs #16 correct a mistake codecov badge url on README
29
+
30
+ ## 0.1.6
2
31
 
3
32
  - refs #16 add code coverage to readme.
4
33
  - refs #17 update deprecated `version` for `ruby-version` on gem-push.yml.
5
34
 
6
- # 0.1.5
35
+ ## 0.1.5
7
36
 
8
37
  - refs #6 setup GitHub Actions.
9
38
 
10
- # 0.1.4
39
+ ## 0.1.4
11
40
 
12
41
  - updates comments.
13
42
 
14
- # 0.1.3
43
+ ## 0.1.3
15
44
 
16
45
  - refs #7 #9 make the code coverage 100%.
17
46
 
18
- # 0.1.2
47
+ ## 0.1.2
19
48
 
20
49
  - refs #1 fix typo Event#recurrences to recurrence
21
50
  - refs #2 add a note for debugging guide on README
22
51
 
23
- # 0.1.1
52
+ ## 0.1.1
24
53
 
25
54
  - set current version on this gem's documentation_uri.
26
55
  - fixed typo on README.
27
56
 
28
- # 0.1.0
57
+ ## 0.1.0
29
58
 
30
59
  - did refactor and wrote comments.
31
60
  - started to use zeitwerk.
32
61
  - wrote README.
33
62
 
34
- # 0.0.1
63
+ ## 0.0.1
35
64
 
36
65
  - Initial release
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Simple TimeTree APIs client
1
+ # TimeTree APIs client
2
2
 
3
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
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)
@@ -99,6 +99,8 @@ I, [2020-06-24T10:05:07.294807] INFO -- : GET https://timetreeapis.com/calendar
99
99
  D, [2020-06-24T10:05:07.562038] DEBUG -- : Response status:404, body:{:type=>"https://developers.timetreeapp.com/en/docs/api#client-failure", :title=>"Not Found", :status=>404, :errors=>"Event not found"}
100
100
  ```
101
101
 
102
+ More in-depth method documentation can be found at [RubyDoc.info](https://www.rubydoc.info/gems/timetree/).
103
+
102
104
  ## Contributing
103
105
 
104
106
  Bug reports and pull requests are welcome on [GitHub](https://github.com/koshilife/timetree-api-ruby-client). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/Rakefile CHANGED
@@ -1,10 +1,12 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
3
5
 
4
6
  Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
8
10
  end
9
11
 
10
- task :default => :test
12
+ task default: :test
@@ -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
@@ -1,11 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'zeitwerk'
4
- loader = Zeitwerk::Loader.for_gem
5
- loader.inflector.inflect(
6
- 'timetree' => 'TimeTree'
7
- )
8
- loader.setup
3
+ Dir[
4
+ File.join(
5
+ File.dirname(__FILE__),
6
+ 'timetree',
7
+ '**',
8
+ '*'
9
+ )
10
+ ].sort.each do |f|
11
+ next if File.directory? f
12
+
13
+ require f
14
+ end
9
15
 
10
16
  # module for TimeTree apis client
11
17
  module TimeTree
@@ -23,7 +23,7 @@ module TimeTree
23
23
  end
24
24
 
25
25
  def inspect
26
- "\#<#{self.class}:#{object_id} title:#{@title}, status:#{@status}>"
26
+ "\#<#{self.class}:#{object_id} title:#{title}, status:#{status}>"
27
27
  end
28
28
  end
29
29
  end
@@ -28,7 +28,7 @@ module TimeTree
28
28
  # @since 0.0.1
29
29
  def current_user
30
30
  res = @http_cmd.get '/user'
31
- raise ApiError, res if res.status != 200
31
+ raise ApiError.new(res) if res.status != 200
32
32
 
33
33
  to_model res.body[:data]
34
34
  end
@@ -47,7 +47,7 @@ module TimeTree
47
47
  check_calendar_id cal_id
48
48
  params = relationships_params(include_relationships, Calendar::RELATIONSHIPS)
49
49
  res = @http_cmd.get "/calendars/#{cal_id}", params
50
- raise ApiError, res if res.status != 200
50
+ raise ApiError.new(res) if res.status != 200
51
51
 
52
52
  to_model(res.body[:data], included: res.body[:included])
53
53
  end
@@ -63,7 +63,7 @@ module TimeTree
63
63
  def calendars(include_relationships: nil)
64
64
  params = relationships_params(include_relationships, Calendar::RELATIONSHIPS)
65
65
  res = @http_cmd.get '/calendars', params
66
- raise ApiError, res if res.status != 200
66
+ raise ApiError.new(res) if res.status != 200
67
67
 
68
68
  included = res.body[:included]
69
69
  res.body[:data].map { |item| to_model(item, included: included) }
@@ -80,7 +80,7 @@ module TimeTree
80
80
  def calendar_labels(cal_id)
81
81
  check_calendar_id cal_id
82
82
  res = @http_cmd.get "/calendars/#{cal_id}/labels"
83
- raise ApiError, res if res.status != 200
83
+ raise ApiError.new(res) if res.status != 200
84
84
 
85
85
  res.body[:data].map { |item| to_model(item) }
86
86
  end
@@ -96,7 +96,7 @@ module TimeTree
96
96
  def calendar_members(cal_id)
97
97
  check_calendar_id cal_id
98
98
  res = @http_cmd.get "/calendars/#{cal_id}/members"
99
- raise ApiError, res if res.status != 200
99
+ raise ApiError.new(res) if res.status != 200
100
100
 
101
101
  res.body[:data].map { |item| to_model item }
102
102
  end
@@ -118,7 +118,7 @@ module TimeTree
118
118
  check_event_id event_id
119
119
  params = relationships_params(include_relationships, Event::RELATIONSHIPS)
120
120
  res = @http_cmd.get "/calendars/#{cal_id}/events/#{event_id}", params
121
- raise ApiError, res if res.status != 200
121
+ raise ApiError.new(res) if res.status != 200
122
122
 
123
123
  ev = to_model(res.body[:data], included: res.body[:included])
124
124
  ev.calendar_id = cal_id
@@ -142,7 +142,7 @@ module TimeTree
142
142
  params = relationships_params(include_relationships, Event::RELATIONSHIPS)
143
143
  params.merge!(days: days, timezone: timezone)
144
144
  res = @http_cmd.get "/calendars/#{cal_id}/upcoming_events", params
145
- raise ApiError, res if res.status != 200
145
+ raise ApiError.new(res) if res.status != 200
146
146
 
147
147
  included = res.body[:included]
148
148
  res.body[:data].map do |item|
@@ -164,7 +164,7 @@ module TimeTree
164
164
  def create_event(cal_id, params)
165
165
  check_calendar_id cal_id
166
166
  res = @http_cmd.post "/calendars/#{cal_id}/events", params
167
- raise ApiError, res if res.status != 201
167
+ raise ApiError.new(res) if res.status != 201
168
168
 
169
169
  ev = to_model res.body[:data]
170
170
  ev.calendar_id = cal_id
@@ -187,7 +187,7 @@ module TimeTree
187
187
  check_calendar_id cal_id
188
188
  check_event_id event_id
189
189
  res = @http_cmd.put "/calendars/#{cal_id}/events/#{event_id}", params
190
- raise ApiError, res if res.status != 200
190
+ raise ApiError.new(res) if res.status != 200
191
191
 
192
192
  ev = to_model res.body[:data]
193
193
  ev.calendar_id = cal_id
@@ -208,7 +208,7 @@ module TimeTree
208
208
  check_calendar_id cal_id
209
209
  check_event_id event_id
210
210
  res = @http_cmd.delete "/calendars/#{cal_id}/events/#{event_id}"
211
- raise ApiError, res if res.status != 204
211
+ raise ApiError.new(res) if res.status != 204
212
212
 
213
213
  true
214
214
  end
@@ -229,7 +229,7 @@ module TimeTree
229
229
  check_calendar_id cal_id
230
230
  check_event_id event_id
231
231
  res = @http_cmd.post "/calendars/#{cal_id}/events/#{event_id}/activities", params
232
- raise ApiError, res if res.status != 201
232
+ raise ApiError.new(res) if res.status != 201
233
233
 
234
234
  activity = to_model res.body[:data]
235
235
  activity.calendar_id = cal_id
@@ -240,10 +240,10 @@ module TimeTree
240
240
  def inspect
241
241
  limit_info = nil
242
242
  if defined?(@ratelimit_limit) && @ratelimit_limit
243
- limit_info = " ratelimit:#{@ratelimit_remaining}/#{@ratelimit_limit}"
243
+ limit_info = " ratelimit:#{ratelimit_remaining}/#{ratelimit_limit}"
244
244
  end
245
245
  if defined?(@ratelimit_reset_at) && @ratelimit_reset_at
246
- limit_info = "#{limit_info}, reset_at:#{@ratelimit_reset_at.strftime('%m/%d %R')}"
246
+ limit_info = "#{limit_info}, reset_at:#{ratelimit_reset_at.strftime('%m/%d %R')}"
247
247
  end
248
248
  "\#<#{self.class}:#{object_id}#{limit_info}>"
249
249
  end
@@ -262,7 +262,7 @@ module TimeTree
262
262
  @ratelimit_reset_at = Time.at reset.to_i if reset
263
263
  end
264
264
 
265
- private
265
+ private
266
266
 
267
267
  def check_token
268
268
  check_required_property(@token, 'token')
@@ -11,9 +11,8 @@ module TimeTree
11
11
  attr_accessor :logger
12
12
 
13
13
  def initialize
14
- logger = Logger.new(STDOUT)
15
- logger.level = :warn
16
- @logger = logger
14
+ @logger = Logger.new(STDOUT)
15
+ @logger.level = :warn
17
16
  end
18
17
  end
19
18
  end
@@ -15,10 +15,10 @@ module TimeTree
15
15
  # @param path [String] String or URI to access.
16
16
  # @param params [Hash] Hash of URI query unencoded key/value pairs.
17
17
  def get(path, params = {})
18
- logger.info "GET #{connection.build_url("#{@host}#{path}", params)}"
18
+ @logger.info "GET #{connection.build_url("#{@host}#{path}", params)}"
19
19
  res = connection.get path, params
20
20
  @client.update_ratelimit(res)
21
- logger.debug "Response status:#{res.status}, body:#{res.body}"
21
+ @logger.debug "Response status:#{res.status}, body:#{res.body}"
22
22
  res
23
23
  end
24
24
 
@@ -27,10 +27,10 @@ module TimeTree
27
27
  # The request bodythat will eventually be converted to JSON.
28
28
  def post(path, body_params = {})
29
29
  @logger.debug "POST #{@host}#{path} body:#{body_params}"
30
- headers = { 'Content-Type' => 'application/json' }
30
+ headers = {'Content-Type' => 'application/json'}
31
31
  res = connection.run_request :post, path, body_params.to_json, headers
32
32
  @client.update_ratelimit(res)
33
- logger.debug "Response status:#{res.status}, body:#{res.body}"
33
+ @logger.debug "Response status:#{res.status}, body:#{res.body}"
34
34
  res
35
35
  end
36
36
 
@@ -38,11 +38,11 @@ module TimeTree
38
38
  # @param body_params [Hash]
39
39
  # The request bodythat will eventually be converted to JSON.
40
40
  def put(path, body_params = {})
41
- logger.debug "PUT #{@host}#{path} body:#{body_params}"
42
- headers = { 'Content-Type' => 'application/json' }
41
+ @logger.debug "PUT #{@host}#{path} body:#{body_params}"
42
+ headers = {'Content-Type' => 'application/json'}
43
43
  res = connection.run_request :put, path, body_params.to_json, headers
44
44
  @client.update_ratelimit(res)
45
- logger.debug "Response status:#{res.status}, body:#{res.body}"
45
+ @logger.debug "Response status:#{res.status}, body:#{res.body}"
46
46
  res
47
47
  end
48
48
 
@@ -52,20 +52,18 @@ module TimeTree
52
52
  @logger.debug "DELETE #{@host}#{path} params:#{params}"
53
53
  res = connection.delete path, params
54
54
  @client.update_ratelimit(res)
55
- logger.debug "Response status:#{res.status}, body:#{res.body}"
55
+ @logger.debug "Response status:#{res.status}, body:#{res.body}"
56
56
  res
57
57
  end
58
58
 
59
- private
60
-
61
- attr_reader :logger
59
+ private
62
60
 
63
61
  def connection
64
62
  Faraday.new(
65
63
  url: @host,
66
64
  headers: base_request_headers
67
65
  ) do |builder|
68
- builder.response :json, parser_options: { symbolize_names: true }, content_type: /\bjson$/
66
+ builder.response :json, parser_options: {symbolize_names: true}, content_type: /\bjson$/
69
67
  end
70
68
  end
71
69
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'timetree/models/base_model'
4
+
3
5
  module TimeTree
4
6
  # Model for TimeTree comment.
5
7
  class Activity < BaseModel
@@ -39,7 +41,7 @@ module TimeTree
39
41
  # @since 0.0.1
40
42
  def data_params
41
43
  {
42
- data: { attributes: { content: content } }
44
+ data: {attributes: {content: content}}
43
45
  }
44
46
  end
45
47
  end
@@ -4,7 +4,7 @@ require 'time'
4
4
 
5
5
  module TimeTree
6
6
  # TimeTree base model object.
7
- class BaseModel
7
+ class BaseModel # rubocop:disable Metrics/ClassLength
8
8
  # @return [Array<Hash<String,String>>]
9
9
  attr_accessor :relationships
10
10
  # @return [String]
@@ -20,10 +20,10 @@ module TimeTree
20
20
  # A TimeTree model object that be based on the type.
21
21
  # @raise [TimeTree::Error] if the type property is not set or unknown.
22
22
  # @since 0.0.1
23
- def self.to_model(data, included: nil, client: nil)
23
+ def self.to_model(data, included: nil, client: nil) # rubocop:disable all
24
24
  id = data[:id]
25
25
  type = data[:type]
26
- raise Error, 'type is required.' if type.nil?
26
+ raise Error.new('type is required.') if type.nil?
27
27
 
28
28
  attributes = data[:attributes] || {}
29
29
  relationships = data[:relationships] || {}
@@ -48,11 +48,11 @@ module TimeTree
48
48
  when 'activity'
49
49
  Activity.new(**params)
50
50
  else
51
- raise Error, "type '#{type}' is unknown."
51
+ raise Error.new("type '#{type}' is unknown.")
52
52
  end
53
53
  end
54
54
 
55
- def initialize(type:, id: nil, client: nil, attributes: nil, relationships: nil, included: nil)
55
+ def initialize(type:, id: nil, client: nil, attributes: nil, relationships: nil, included: nil) # rubocop:disable Metrics/ParameterLists
56
56
  @type = type
57
57
  @id = id
58
58
  @client = client
@@ -64,33 +64,29 @@ module TimeTree
64
64
  "\#<#{self.class}:#{object_id} id:#{id}>"
65
65
  end
66
66
 
67
- private
67
+ private
68
68
 
69
69
  def check_client
70
- raise Error, '@client is nil.' if @client.nil?
70
+ raise Error.new('@client is nil.') if @client.nil?
71
71
  end
72
72
 
73
73
  def to_model(data)
74
74
  self.class.to_model data, client: @client
75
75
  end
76
76
 
77
- def set_attributes(attributes)
77
+ def set_attributes(attributes) # rubocop:disable Naming/AccessorMethodName
78
78
  return unless attributes.is_a? Hash
79
79
  return if attributes.empty?
80
80
 
81
- setter_methods = self.class.instance_methods.select { |method| method.to_s.end_with? '=' }
82
81
  attributes.each do |key, value|
83
- setter = "#{key.to_sym}=".to_sym
84
- next unless setter_methods.include? setter
82
+ next unless respond_to?("#{key}=".to_sym)
85
83
 
86
- if defined?(self.class::TIME_FIELDS) && self.class::TIME_FIELDS.include?(key)
87
- value = Time.parse value
88
- end
84
+ value = Time.parse value if defined?(self.class::TIME_FIELDS) && self.class::TIME_FIELDS.include?(key)
89
85
  instance_variable_set "@#{key}", value
90
86
  end
91
87
  end
92
88
 
93
- def set_relationships(relationships, included)
89
+ def set_relationships(relationships, included) # rubocop:disable all
94
90
  return unless relationships.is_a? Hash
95
91
  return if relationships.empty?
96
92
  return unless defined? self.class::RELATIONSHIPS
@@ -112,7 +108,7 @@ module TimeTree
112
108
  set_relationship_data_if_included(included)
113
109
  end
114
110
 
115
- def set_relationship_data_if_included(included)
111
+ def set_relationship_data_if_included(included) # rubocop:disable all
116
112
  @_relation_data_dic = {}
117
113
  included.each do |data|
118
114
  item = to_model(data)
@@ -126,7 +122,7 @@ module TimeTree
126
122
 
127
123
  @_relation_data_dic[type][id]
128
124
  }
129
- @relationships.each do |key, id_data|
125
+ relationships.each do |key, id_data|
130
126
  relation_data = nil
131
127
  if id_data.is_a? Array
132
128
  relation_data = []
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'timetree/models/base_model'
4
+
3
5
  module TimeTree
4
6
  # Model for TimeTree calendar.
5
7
  class Calendar < BaseModel
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'timetree/models/base_model'
4
+
3
5
  module TimeTree
4
6
  # Model for TimeTree event or keep.
5
7
  class Event < BaseModel
@@ -90,7 +92,7 @@ module TimeTree
90
92
  # @since 0.0.1
91
93
  def create_comment(message)
92
94
  check_client
93
- params = { type: 'activity', attributes: { calendar_id: calendar_id, event_id: id, content: message } }
95
+ params = {type: 'activity', attributes: {calendar_id: calendar_id, event_id: id, content: message}}
94
96
  activity = to_model params
95
97
  activity.create
96
98
  end
@@ -120,14 +122,14 @@ module TimeTree
120
122
  }
121
123
  end
122
124
 
123
- private
125
+ private
124
126
 
125
127
  def relationships_params
126
- current_label = label ? { type: 'label', id: label.id } : @relationships[:label]
127
- current_attendees = attendees ? attendees.map { |u| { type: 'user', id: u.id } } : @relationships[:attendees]
128
+ current_label = label ? {type: 'label', id: label.id} : relationships[:label]
129
+ current_attendees = attendees ? attendees.map { |u| {type: 'user', id: u.id} } : relationships[:attendees]
128
130
  {
129
- label: { data: current_label },
130
- attendees: { data: current_attendees }
131
+ label: {data: current_label},
132
+ attendees: {data: current_attendees}
131
133
  }
132
134
  end
133
135
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'timetree/models/base_model'
4
+
3
5
  module TimeTree
4
6
  # Model for TimeTree color theme.
5
7
  class Label < BaseModel
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'timetree/models/base_model'
4
+
3
5
  module TimeTree
4
6
  # Model for TimeTree user.
5
7
  class User < BaseModel
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TimeTree
4
- VERSION = '0.1.7'
4
+ VERSION = '0.3.2'
5
5
  end
@@ -28,15 +28,13 @@ Gem::Specification.new do |spec|
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ['lib']
30
30
 
31
- spec.add_runtime_dependency 'faraday', '~> 1.0.1'
32
- spec.add_runtime_dependency 'faraday_middleware', '~> 1.0.0'
33
- spec.add_runtime_dependency 'zeitwerk', '~> 2.3.0'
31
+ spec.add_runtime_dependency 'faraday', '>= 1.0.1'
32
+ spec.add_runtime_dependency 'faraday_middleware', '>= 1.0.0'
34
33
 
35
- spec.add_development_dependency 'bundler', '~> 2.0'
36
- spec.add_development_dependency 'codecov', '~> 0.1.17'
37
- spec.add_development_dependency 'minitest', '~> 5.14.0'
38
- spec.add_development_dependency 'minitest-reporters', '~> 1.4.2'
39
- spec.add_development_dependency 'rake', '~> 12.0'
40
- spec.add_development_dependency 'simplecov', '~> 0.18.5'
41
- spec.add_development_dependency 'webmock', '~> 3.7.6'
34
+ spec.add_development_dependency 'bundler'
35
+ spec.add_development_dependency 'codecov'
36
+ spec.add_development_dependency 'minitest'
37
+ spec.add_development_dependency 'rake'
38
+ spec.add_development_dependency 'simplecov'
39
+ spec.add_development_dependency 'webmock'
42
40
  end
metadata CHANGED
@@ -1,155 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timetree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.3.2
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-07-02 00:00:00.000000000 Z
11
+ date: 2020-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.0.0
41
- - !ruby/object:Gem::Dependency
42
- name: zeitwerk
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 2.3.0
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 2.3.0
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: bundler
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '2.0'
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '2.0'
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: codecov
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: 0.1.17
61
+ version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - "~>"
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: 0.1.17
68
+ version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: minitest
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 5.14.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 5.14.0
97
- - !ruby/object:Gem::Dependency
98
- name: minitest-reporters
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
73
+ - - ">="
102
74
  - !ruby/object:Gem::Version
103
- version: 1.4.2
75
+ version: '0'
104
76
  type: :development
105
77
  prerelease: false
106
78
  version_requirements: !ruby/object:Gem::Requirement
107
79
  requirements:
108
- - - "~>"
80
+ - - ">="
109
81
  - !ruby/object:Gem::Version
110
- version: 1.4.2
82
+ version: '0'
111
83
  - !ruby/object:Gem::Dependency
112
84
  name: rake
113
85
  requirement: !ruby/object:Gem::Requirement
114
86
  requirements:
115
- - - "~>"
87
+ - - ">="
116
88
  - !ruby/object:Gem::Version
117
- version: '12.0'
89
+ version: '0'
118
90
  type: :development
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
93
  requirements:
122
- - - "~>"
94
+ - - ">="
123
95
  - !ruby/object:Gem::Version
124
- version: '12.0'
96
+ version: '0'
125
97
  - !ruby/object:Gem::Dependency
126
98
  name: simplecov
127
99
  requirement: !ruby/object:Gem::Requirement
128
100
  requirements:
129
- - - "~>"
101
+ - - ">="
130
102
  - !ruby/object:Gem::Version
131
- version: 0.18.5
103
+ version: '0'
132
104
  type: :development
133
105
  prerelease: false
134
106
  version_requirements: !ruby/object:Gem::Requirement
135
107
  requirements:
136
- - - "~>"
108
+ - - ">="
137
109
  - !ruby/object:Gem::Version
138
- version: 0.18.5
110
+ version: '0'
139
111
  - !ruby/object:Gem::Dependency
140
112
  name: webmock
141
113
  requirement: !ruby/object:Gem::Requirement
142
114
  requirements:
143
- - - "~>"
115
+ - - ">="
144
116
  - !ruby/object:Gem::Version
145
- version: 3.7.6
117
+ version: '0'
146
118
  type: :development
147
119
  prerelease: false
148
120
  version_requirements: !ruby/object:Gem::Requirement
149
121
  requirements:
150
- - - "~>"
122
+ - - ">="
151
123
  - !ruby/object:Gem::Version
152
- version: 3.7.6
124
+ version: '0'
153
125
  description: Client for accessing TimeTree APIs
154
126
  email:
155
127
  - koshikawa2009@gmail.com
@@ -160,7 +132,7 @@ files:
160
132
  - ".github/workflows/gem-push.yml"
161
133
  - ".github/workflows/test.yml"
162
134
  - ".gitignore"
163
- - ".rubocom.yml"
135
+ - ".rubocop.yml"
164
136
  - CHANGELOG.md
165
137
  - CODE_OF_CONDUCT.md
166
138
  - Gemfile
@@ -170,16 +142,16 @@ files:
170
142
  - bin/console
171
143
  - bin/setup
172
144
  - lib/timetree.rb
173
- - lib/timetree/activity.rb
174
145
  - lib/timetree/api_error.rb
175
- - lib/timetree/base_model.rb
176
- - lib/timetree/calendar.rb
177
146
  - lib/timetree/client.rb
178
147
  - lib/timetree/configuration.rb
179
- - lib/timetree/event.rb
180
148
  - lib/timetree/http_command.rb
181
- - lib/timetree/label.rb
182
- - lib/timetree/user.rb
149
+ - lib/timetree/models/activity.rb
150
+ - lib/timetree/models/base_model.rb
151
+ - lib/timetree/models/calendar.rb
152
+ - lib/timetree/models/event.rb
153
+ - lib/timetree/models/label.rb
154
+ - lib/timetree/models/user.rb
183
155
  - lib/timetree/version.rb
184
156
  - timetree.gemspec
185
157
  homepage: https://github.com/koshilife/timetree-api-ruby-client
@@ -189,7 +161,7 @@ metadata:
189
161
  homepage_uri: https://github.com/koshilife/timetree-api-ruby-client
190
162
  source_code_uri: https://github.com/koshilife/timetree-api-ruby-client
191
163
  changelog_uri: https://github.com/koshilife/timetree-api-ruby-client/blob/master/CHANGELOG.md
192
- documentation_uri: https://www.rubydoc.info/gems/timetree/0.1.7
164
+ documentation_uri: https://www.rubydoc.info/gems/timetree/0.3.2
193
165
  post_install_message:
194
166
  rdoc_options: []
195
167
  require_paths: