togglv8 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: f78f0515e742e278468d6265c6841df07f164230
4
- data.tar.gz: f78a57c6e31c97ddc5b54679957228e7afac77ed
3
+ metadata.gz: f08bb5759304ca1a721e28f335d5db0108f5539a
4
+ data.tar.gz: ec94cd237fe7db781fec895b50caf7015ef56a8f
5
5
  SHA512:
6
- metadata.gz: bd36c398494606943d6ba8793a3035864e155a1aae42bfc3844289a362f82e3cf58b9cb16bbc0b72539b3913e886dda59bc9fb7200b5d58dfd1e54935f08a570
7
- data.tar.gz: fb47297ebb39ab70d08dd80b9e6380f6fdfd306a5aa9d746de1c37ed19f93ba3afb13fb7ac5a170056ccb04613c7694bb11dc77256ff1737268e615dfdbb58e2
6
+ metadata.gz: 76c25d3b0534bc3f6b4c50b95d3151d1ef5a054fd4397836bd66258634312f938d2ae0e6c14f598c245be3aaeee0ed7684216b2442887a0b3335463b054ffd05
7
+ data.tar.gz: e7a5d4be646c46db1313ae5ea512f5e2654ebe6ba41f2284cd3053f5750e89dc40335278ef8f07849fa4f89b5c4364ba88f53bc888c956d103c7002280011a95
data/lib/togglv8.rb CHANGED
@@ -50,6 +50,14 @@ module TogglV8
50
50
  @conn = TogglV8::API.connection(username, password, opts)
51
51
  end
52
52
 
53
+ def debug(debug=true)
54
+ if debug
55
+ @logger.level = Logger::DEBUG
56
+ else
57
+ @logger.level = Logger::WARN
58
+ end
59
+ end
60
+
53
61
  #---------#
54
62
  # Private #
55
63
  #---------#
@@ -85,7 +93,7 @@ module TogglV8
85
93
  loop do
86
94
  i += 1
87
95
  full_resp = procs[:api_call].call
88
- # @logger.ap(full_resp.env, :debug)
96
+ @logger.ap(full_resp.env, :debug)
89
97
  break if full_resp.status != 429 || i >= MAX_RETRIES
90
98
  sleep(DELAY_SEC)
91
99
  end
@@ -1,4 +1,4 @@
1
1
  module TogglV8
2
2
  # :section:
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togglv8
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-13 00:00:00.000000000 Z
11
+ date: 2016-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -176,7 +176,6 @@ files:
176
176
  - ".rdoc_options"
177
177
  - ".rspec"
178
178
  - ".travis.yml"
179
- - API calls.md
180
179
  - Gemfile
181
180
  - LICENSE.txt
182
181
  - README.md
data/API calls.md DELETED
@@ -1,330 +0,0 @@
1
- # Toggl v8 API calls
2
-
3
- These API calls with [curl](http://curl.haxx.se/) were useful when prototyping togglv8.
4
-
5
- The calls have since been converted to use [resty](https://github.com/micha/resty) (a wrapper for curl). They are included here only for reference.
6
-
7
- See [Toggl API Documentation](https://github.com/toggl/toggl_api_docs) for more authoritative, comprehensive, and up-to-date information.
8
-
9
- As of 2013-08-11, the calls listed here cover almost the entire [Toggl API](https://github.com/toggl/toggl_api_docs/blob/master/toggl_api.md) section. The following calls are not yet supported by [togglv8](/):
10
- * [Add multiple users to a project](/API%20calls.md#add-multiple-users-to-a-project)
11
- * [Update multiple project users](/API%20calls.md#update-multiple-project-users)
12
- * [Delete multiple project users](/API%20calls.md#delete-multiple-project-users)
13
- * [Sign up new user](/API%20calls.md#sign-up-new-user) (Will increase the cost of your Toggl account.)
14
- * [Invite users to workspace](/API%20calls.md#invite-users-to-workspace)
15
- * [Delete workspace user](/API%20calls.md#delete-workspace-user)
16
- * [Get workspace users for a workspace](/API%20calls.md#get-workspace-users-for-a-workspace)
17
-
18
- # Authentication
19
-
20
- Toggl API uses Basic Auth. Resty is initialized with basic auth info (-u), as well as headers (-H).
21
-
22
- ### HTTP Basic Auth with API token
23
- The user API Token for an account is available under [My Profile](https://www.toggl.com/user/edit) after logging into [Toggl.com](https://www.toggl.com).
24
-
25
- When using an API Token, the user is your API Token and the password is "api_token".
26
- ```
27
- resty https://www.toggl.com/api/v8 -u 1971800d4d82861d8f2c1651fea4d212:api_token -H "Content-type: application/json"
28
- ```
29
-
30
- ### (Alternative method) HTTP Basic Auth with e-mail and password
31
- It is also possible to use your email address and Toggl password.
32
- ```
33
- resty https://www.toggl.com/api/v8 -u your.email@example.com:SuperSecretPassword -H "Content-type: application/json"
34
- ```
35
-
36
- # Displaying JSON
37
- It is helpful to use a JSON parsing tool such as [Jazor](https://github.com/mconigliaro/jazor).
38
-
39
- For example, ```GET /me | jazor -c``` outputs
40
-
41
- ```
42
- {
43
- since: 1370938972,
44
- data: {
45
- id: {<user_id>},
46
- api_token: "<api_token>",
47
- default_wid: <wid>,
48
- email: "<email_address>",
49
- fullname: "<fullname>",
50
- jquery_timeofday_format: H:i,
51
- jquery_date_format: "m/d/Y",
52
- timeofday_format: H:mm,
53
- date_format: "MM/DD/YYYY",
54
- store_start_and_stop_time: true,
55
- beginning_of_week: 1,
56
- language: "en_US",
57
- image_url: https://www.toggl.com/system/avatars/<image.jpg>,
58
- sidebar_piechart: false,
59
- at: "2013-06-11T07:00:44+00:00",
60
- created_at: "2012-08-01T12:41:56+00:00",
61
- retention: 9,
62
- record_timeline: true,
63
- render_timeline: true,
64
- timeline_enabled: true,
65
- timeline_experiment: true,
66
- manual_mode: true,
67
- new_blog_post: {
68
- },
69
- invitation: {
70
- }
71
- }
72
- }
73
- ```
74
-
75
- rather than
76
-
77
- ```
78
- {"since":1370938972,"data":{"id":<user_id>},"api_token":"<api_token>","default_wid":<wid>,"email":"<email_address>","fullname":"<fullname>","jquery_timeofday_format":"H:i","jquery_date_format":"m/d/Y","timeofday_format":"H:mm","date_format":"MM/DD/YYYY","store_start_and_stop_time":true,"beginning_of_week":1,"language":"en_US","image_url":"https://www.toggl.com/system/avatars/<image.jpg>","sidebar_piechart":false,"at":"2013-06-11T07:00:44+00:00","created_at":"2012-08-01T12:41:56+00:00","retention":9,"record_timeline":true,"render_timeline":true,"timeline_enabled":true,"timeline_experiment":true,"manual_mode":true,"new_blog_post":{},"invitation":{}}}
79
- ```
80
-
81
- ---
82
-
83
- # Clients
84
-
85
- ### Create client
86
- ```
87
- POST /clients -d '{"client":{"name":"Very Big Company","wid":282224}}'
88
- ```
89
-
90
- ### Read client
91
- ```
92
- GET /clients/1101632
93
- ```
94
-
95
- ### Update client
96
- ```
97
- PUT /clients/1150638 -d '{"client":{"notes":"this client must go!"}}'
98
- ```
99
-
100
- ### Delete client
101
- ```
102
- DELETE /clients/1150758
103
- ```
104
-
105
- ### Get clients visible to user
106
- ```
107
- GET /clients
108
- ```
109
-
110
- ### Get client projects
111
- ```
112
- GET /clients/1150488/projects
113
- ```
114
-
115
- # Projects
116
-
117
- ### Create project
118
- ```
119
- POST /projects -d '{"project":{"name":"TEST project","wid":282224,"is_private":true}}'
120
- ```
121
-
122
- ### Read project
123
- ```
124
- GET /projects/2882160
125
- ```
126
-
127
- ### Update project
128
- ```
129
- PUT /projects/2931253 -d '{"project":{"name":"Changed the name","is_private":false,"template":true}}'
130
- ```
131
-
132
- ### Get project users
133
- ```
134
- GET /projects/2883126/project_users
135
- ```
136
-
137
- # Project users
138
-
139
- ### Create project user
140
- ```
141
- POST /project_users -d '{"project_user":{"pid":2931296,"uid":509726,"rate":30.0,"manager":true}}'
142
- ```
143
-
144
- ### Update project user
145
- ```
146
- PUT /project_users/8310314 -d '{"project_user":{"manager":false,"rate":15,"fields":"fullname"}}'
147
- ```
148
-
149
- ### Delete project user
150
- ```
151
- DELETE /project_users/8310314
152
- ```
153
- ### Add multiple users to a project
154
- **Note:** Not yet supported by [togglv8](/)
155
-
156
- ### Update multiple project users
157
- **Note:** Not yet supported by [togglv8](/)
158
-
159
- ### Delete multiple project users
160
- **Note:** Not yet supported by [togglv8](/)
161
-
162
- # Tags
163
-
164
- ### Create tag
165
- ```
166
- POST /tags -d '{"tag":{"name":"tag"}}'
167
- ```
168
-
169
- ### Update tag
170
- ```
171
- PUT /tags/294414 -d '{"tag":{"name":"taggggg"}}'
172
- ```
173
-
174
- ### Delete tag
175
- ```
176
- DELETE /tags/294414
177
- ```
178
-
179
- # Tasks
180
-
181
- ### Create task
182
- ```
183
- POST /tasks -d '{"task":{"name":"A new task","pid":2883129}}'
184
- ```
185
-
186
- ### Get task details
187
- ```
188
- GET /tasks/1894675
189
- ```
190
-
191
- ### Update task
192
- ```
193
- PUT /tasks/1894675 -d '{"task":{"id": 1894675, "active": true, "estimated_seconds": 7200, "fields": "done_seconds,uname"}}'
194
- ```
195
-
196
- ### Delete task
197
- ```
198
- DELETE /tasks/1893464
199
- ```
200
-
201
- ### Update multiple tasks
202
- ```
203
- PUT /tasks/1894758,1894751 -d '{"task":{"active":false,"fields":"done_seconds,uname"}}'
204
- ```
205
-
206
- ### Delete multiple Tasks
207
- ```
208
- DELETE /tasks/1922656,1922683,1922684
209
- ```
210
-
211
- # Time entries
212
-
213
- ### Create time entry
214
- ```
215
- POST /time_entries -d '{"time_entry":{"description":"Meeting with possible clients","tags":["billed"],"duration":1200,"start":"2013-03-05T07:58:58.000Z","pid":2931296}}'
216
- ```
217
-
218
- ### Get time entry details
219
- ```
220
- GET /time_entries/77628973
221
- ```
222
-
223
- ### Start a time entry
224
- ```
225
- POST /time_entries/start -d '{"time_entry":{"description":"New time entry","wid":282224}}'
226
- ```
227
-
228
- ### Stop a time entry
229
- ```
230
- PUT /time_entries/86229778/stop
231
- ```
232
-
233
- ### Update time entry
234
- ```
235
- PUT /time_entries/86229778 -d '{"time_entry":{"description":"Renamed new time entry","duration":180}}'
236
- ```
237
-
238
- ### Delete time entry
239
- ```
240
- DELETE /time_entries/86229778
241
- ```
242
-
243
- ### Get time entries started in a specific time range
244
- **Note:**
245
-
246
- - `start_date` and `end_date` are in [ISO 8601 date and time format](http://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations), (e.g. "2013-03-10T15:42:46+02:00")
247
- - It is necessary to use the encoded value %2B for '+' in order to avoid JSON parsing error. (Using %3A for ':' is not strictly necessary.)
248
-
249
- ```
250
- GET /time_entries -q 'start_date=2013-05-22T15:42:46%2B02:00&end_date=2013-05-22T16:42:46%2B02:00'
251
- ```
252
-
253
- ```
254
- GET /time_entries -q 'start_date=2013-06-04T18:32:12%2B00:00'
255
- ```
256
-
257
- # Users
258
-
259
- ### Get current user data
260
- ```
261
- GET /me
262
- ```
263
-
264
- ### Get current user with related data
265
- ```
266
- GET /me?with_related_data=true -Q
267
- ```
268
- or
269
- ```
270
- GET /me -q 'with_related_data=true'
271
- ```
272
-
273
- ### Sign up new user
274
- **Note:** This is not implemented in [togglv8](/) wrapper because it will increase the cost of your Toggl account. See [Toggl Pricing and Payments](http://support.toggl.com/pricing-and-payments/) for details.
275
- ```
276
- POST /signups -d '{"user":{"email":"<email_address>","password":"<password>"}}'
277
- ```
278
-
279
- # Workspaces
280
-
281
- ### Get user workspaces
282
- ```
283
- GET /workspaces
284
- ```
285
-
286
- ### Get workspace users
287
- ```
288
- GET /workspaces/282224/users
289
- ```
290
-
291
- ### Get workspace clients
292
- ```
293
- GET /workspaces/282224/clients
294
- ```
295
-
296
- ### Get workspace projects
297
- ```
298
- GET /workspaces/282224/projects
299
- ```
300
-
301
- ### Get workspace tasks
302
- ```
303
- GET /workspaces/282224/tasks
304
- ```
305
- ```
306
- GET /workspaces/282224/tasks?active=true
307
- ```
308
- ```
309
- GET /workspaces/282224/tasks?active=false
310
- ```
311
- ```
312
- GET /workspaces/282224/tasks?active=both
313
- ```
314
-
315
- # Workspace Users
316
-
317
- ### Invite users to workspace
318
- **Note:** Not yet supported by [togglv8](/)
319
-
320
- ### Update workspace user (can only update admin flag)
321
- **Note:** Call fails with error message "Cannot access workspace users"
322
- ```
323
- PUT /workspace_users/282224 -d '{"workspace_user":{"admin":true}}'
324
- ```
325
-
326
- ### Delete workspace user
327
- **Note:** Not yet supported by [togglv8](/)
328
-
329
- ### Get workspace users for a workspace
330
- **Note:** Not yet supported by [togglv8](/)