timetree 0.2.0 → 0.2.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/timetree/api_error.rb +1 -1
- data/lib/timetree/client.rb +2 -2
- data/lib/timetree/configuration.rb +2 -3
- data/lib/timetree/http_command.rb +6 -8
- data/lib/timetree/models/base_model.rb +2 -4
- data/lib/timetree/models/event.rb +2 -2
- data/lib/timetree/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd742156da72043bdb3d549064a3ea4c560fc8ef2c60c340c53647b6cc0ea43b
|
4
|
+
data.tar.gz: 828100939eadee2275fa189f34dfe9fdd86b58113941cee0eaaabea26a161753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f13a82f70529e872f34026d733875f05ef783c9dc5b89b23b6fc989b3256acf6f5640a8c5a377707b6adec96aa04a659cfab8ebd8a83bc9866a626179566a772
|
7
|
+
data.tar.gz: 38bf4a08b7e0bb92275ed0a9d20cf31f1623ba5955a560f3491625080e1b0ffdf2075c5e753d916f5aba64f860465582bf46f01a391af15b6c8c712211f9c168
|
data/CHANGELOG.md
CHANGED
data/lib/timetree/api_error.rb
CHANGED
data/lib/timetree/client.rb
CHANGED
@@ -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:#{
|
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:#{
|
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
|
@@ -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
|
|
@@ -30,7 +30,7 @@ module TimeTree
|
|
30
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}"
|
41
|
+
@logger.debug "PUT #{@host}#{path} body:#{body_params}"
|
42
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,14 +52,12 @@ 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
59
|
private
|
60
60
|
|
61
|
-
attr_reader :logger
|
62
|
-
|
63
61
|
def connection
|
64
62
|
Faraday.new(
|
65
63
|
url: @host,
|
@@ -78,10 +78,8 @@ module TimeTree
|
|
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
|
-
|
84
|
-
next unless setter_methods.include? setter
|
82
|
+
next unless respond_to?("#{key}=".to_sym)
|
85
83
|
|
86
84
|
if defined?(self.class::TIME_FIELDS) && self.class::TIME_FIELDS.include?(key)
|
87
85
|
value = Time.parse value
|
@@ -126,7 +124,7 @@ module TimeTree
|
|
126
124
|
|
127
125
|
@_relation_data_dic[type][id]
|
128
126
|
}
|
129
|
-
|
127
|
+
relationships.each do |key, id_data|
|
130
128
|
relation_data = nil
|
131
129
|
if id_data.is_a? Array
|
132
130
|
relation_data = []
|
@@ -123,8 +123,8 @@ module TimeTree
|
|
123
123
|
private
|
124
124
|
|
125
125
|
def relationships_params
|
126
|
-
current_label = label ? { type: 'label', id: label.id } :
|
127
|
-
current_attendees = attendees ? attendees.map { |u| { type: 'user', id: u.id } } :
|
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
128
|
{
|
129
129
|
label: { data: current_label },
|
130
130
|
attendees: { data: current_attendees }
|
data/lib/timetree/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timetree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Koshikawa
|
@@ -189,7 +189,7 @@ metadata:
|
|
189
189
|
homepage_uri: https://github.com/koshilife/timetree-api-ruby-client
|
190
190
|
source_code_uri: https://github.com/koshilife/timetree-api-ruby-client
|
191
191
|
changelog_uri: https://github.com/koshilife/timetree-api-ruby-client/blob/master/CHANGELOG.md
|
192
|
-
documentation_uri: https://www.rubydoc.info/gems/timetree/0.2.
|
192
|
+
documentation_uri: https://www.rubydoc.info/gems/timetree/0.2.1
|
193
193
|
post_install_message:
|
194
194
|
rdoc_options: []
|
195
195
|
require_paths:
|