camper 0.0.7 → 0.1.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: fa90563f8a1f1cc3ba09a874f10130511620dbe0afb687aedf2a70f7d97bde14
4
- data.tar.gz: 753c1ca3bedeff92690f267e75c045357535fcc10bedc7b7df42f64ca9f9d7b8
3
+ metadata.gz: a55ed04d219593d0ed46a16a84c1993eab9b51d1cbc6b55386bd23068f002668
4
+ data.tar.gz: 1bf654df624233c32289b132ee58dabe05158088f4fc970a8b2ebdf7ddfae229
5
5
  SHA512:
6
- metadata.gz: 179b1ecd4431b2049ddbb135a260f6b47ade0a8e3a3aef021f8027e4ba7b8ff0561567179fd503fe317a66099ca30b46296e6e99c3deead27a9e0ee347aed9c5
7
- data.tar.gz: a976b84f32e91336a0be556417098de9218aec0d1f05c632c9bc41d4f99f699364d152ec4caf1b89917a32ccf13c61ac447529930e57ca0ab127250f954d096f
6
+ metadata.gz: 1a56723911f5687789ae0078d62dd2ffc3ce5df0af7edd844ec2a4942098f26dcec1931a21d9731983af62134d331e6958526d910df68a1959e5794e3fd9a292
7
+ data.tar.gz: c076b430f753ab8b2021b64e7811b05bfb9e7669a842638df47a7fd2ab6a0536c54ccdc449bbdf81b2a3be86950c3554e11866e45dbd8f2dd612fe18d499f2d5
data/.gitignore CHANGED
@@ -57,4 +57,4 @@ build-iPhoneSimulator/
57
57
 
58
58
  .rspec_status
59
59
 
60
- .env
60
+ .env*
@@ -7,6 +7,7 @@ AllCops:
7
7
  NewCops: enable
8
8
  Exclude:
9
9
  - 'camper.gemspec'
10
+ - 'lib/camper/core_extensions/object.rb'
10
11
 
11
12
  Layout/LineLength:
12
13
  Max: 120
@@ -14,6 +15,9 @@ Layout/LineLength:
14
15
  - 'lib/camper/client/*'
15
16
  - 'spec/**/*'
16
17
 
18
+ Layout/FirstHashElementIndentation:
19
+ EnforcedStyle: consistent
20
+
17
21
  Metrics/BlockLength:
18
22
  Exclude:
19
23
  - 'spec/**/*'
@@ -24,6 +28,12 @@ Metrics/AbcSize:
24
28
  Style/Documentation:
25
29
  Enabled: false
26
30
 
31
+ Style/AsciiComments:
32
+ Enabled: false
33
+
34
+ Style/ParallelAssignment:
35
+ Enabled: false
36
+
27
37
  Style/ClassAndModuleChildren:
28
38
  Exclude:
29
39
  - 'lib/camper/*'
@@ -1,6 +1,67 @@
1
1
  # Changelog
2
2
 
3
- ## [v0.0.6](https://github.com/renehernandez/camper/tree/v0.0.6) (2020-10-01)
3
+ ## [Unreleased](https://github.com/renehernandez/camper/tree/HEAD)
4
+
5
+ **Implemented enhancements:**
6
+
7
+ - Complete messages and message types APIs [\#66](https://github.com/renehernandez/camper/pull/66)
8
+ - Complete comments api [\#65](https://github.com/renehernandez/camper/pull/65)
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Refactor check for valid basecamp url [\#67](https://github.com/renehernandez/camper/pull/67)
13
+ - Bump rspec from 3.9.0 to 3.10.0 [\#64](https://github.com/renehernandez/camper/pull/64)
14
+ - Rewrite API modules to use module nesting [\#63](https://github.com/renehernandez/camper/pull/63)
15
+ - Bump rubocop from 1.0.0 to 1.1.0 [\#48](https://github.com/renehernandez/camper/pull/48)
16
+
17
+ ## [v0.0.11](https://github.com/renehernandez/camper/tree/v0.0.11) (2020-11-01)
18
+
19
+ **Implemented enhancements:**
20
+
21
+ - Implement trash\_todo endpoint [\#58](https://github.com/renehernandez/camper/issues/58)
22
+ - Implement trash\_todolist endpoint [\#57](https://github.com/renehernandez/camper/issues/57)
23
+ - To-do API is missing update\_todo endpoint [\#49](https://github.com/renehernandez/camper/issues/49)
24
+ - update\_todolist endpoint now sends the current description if none is specified [\#62](https://github.com/renehernandez/camper/pull/62)
25
+ - Add trash\_todolist endpoint [\#61](https://github.com/renehernandez/camper/pull/61)
26
+ - Add trash\_todo endpoint implementation [\#60](https://github.com/renehernandez/camper/pull/60)
27
+ - Add recordings api [\#53](https://github.com/renehernandez/camper/pull/53)
28
+ - Add update\_todo implementation [\#52](https://github.com/renehernandez/camper/pull/52)
29
+
30
+ **Fixed bugs:**
31
+
32
+ - return tag should mention PaginatedResponse instead of Array [\#56](https://github.com/renehernandez/camper/issues/56)
33
+ - Get endpoints params need to be set under query field [\#54](https://github.com/renehernandez/camper/issues/54)
34
+ - Update endpoints documentation to use PaginatedResponse [\#59](https://github.com/renehernandez/camper/pull/59)
35
+ - Fix query string generation in get endpoints [\#55](https://github.com/renehernandez/camper/pull/55)
36
+
37
+ **Documentation:**
38
+
39
+ - update\_todolist needs to call out that description will be cleared if not specified [\#50](https://github.com/renehernandez/camper/issues/50)
40
+
41
+ ## [v0.0.10](https://github.com/renehernandez/camper/tree/v0.0.10) (2020-10-30)
42
+
43
+ **Implemented enhancements:**
44
+
45
+ - Complete projects api [\#51](https://github.com/renehernandez/camper/pull/51)
46
+
47
+ ## [v0.0.9](https://github.com/renehernandez/camper/tree/v0.0.9) (2020-10-28)
48
+
49
+ **Implemented enhancements:**
50
+
51
+ - Split todos and todolists APIs [\#47](https://github.com/renehernandez/camper/pull/47)
52
+
53
+ **Merged pull requests:**
54
+
55
+ - Bump rubocop from 0.92.0 to 1.0.0 [\#44](https://github.com/renehernandez/camper/pull/44)
56
+
57
+ ## [v0.0.8](https://github.com/renehernandez/camper/tree/v0.0.8) (2020-10-27)
58
+
59
+ **Implemented enhancements:**
60
+
61
+ - Add people API [\#46](https://github.com/renehernandez/camper/pull/46)
62
+ - Raise error if resource can't be commented [\#45](https://github.com/renehernandez/camper/pull/45)
63
+
64
+ ## [v0.0.7](https://github.com/renehernandez/camper/tree/v0.0.7) (2020-10-04)
4
65
 
5
66
  **Implemented enhancements:**
6
67
 
@@ -1,14 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- camper (0.0.5)
4
+ camper (0.0.11)
5
+ concurrent-ruby (~> 1.1)
5
6
  httparty (~> 0.18)
6
7
  rack-oauth2 (~> 1.14)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- activesupport (6.0.3.3)
12
+ activesupport (6.0.3.4)
12
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
14
  i18n (>= 0.7, < 2)
14
15
  minitest (~> 5.1)
@@ -20,7 +21,7 @@ GEM
20
21
  bindata (2.4.8)
21
22
  coderay (1.1.3)
22
23
  concurrent-ruby (1.1.7)
23
- diff-lcs (1.3)
24
+ diff-lcs (1.4.4)
24
25
  httparty (0.18.1)
25
26
  mime-types (~> 3.0)
26
27
  multi_xml (>= 0.5.2)
@@ -38,7 +39,7 @@ GEM
38
39
  minitest (5.14.2)
39
40
  multi_xml (0.6.0)
40
41
  parallel (1.19.2)
41
- parser (2.7.1.5)
42
+ parser (2.7.2.0)
42
43
  ast (~> 2.4.1)
43
44
  pry (0.13.1)
44
45
  coderay (~> 1.1)
@@ -52,44 +53,42 @@ GEM
52
53
  rack (>= 2.1.0)
53
54
  rainbow (3.0.0)
54
55
  rake (13.0.1)
55
- regexp_parser (1.8.0)
56
+ regexp_parser (1.8.2)
56
57
  rexml (3.2.4)
57
- rspec (3.9.0)
58
- rspec-core (~> 3.9.0)
59
- rspec-expectations (~> 3.9.0)
60
- rspec-mocks (~> 3.9.0)
61
- rspec-core (3.9.2)
62
- rspec-support (~> 3.9.3)
63
- rspec-expectations (3.9.2)
58
+ rspec (3.10.0)
59
+ rspec-core (~> 3.10.0)
60
+ rspec-expectations (~> 3.10.0)
61
+ rspec-mocks (~> 3.10.0)
62
+ rspec-core (3.10.0)
63
+ rspec-support (~> 3.10.0)
64
+ rspec-expectations (3.10.0)
64
65
  diff-lcs (>= 1.2.0, < 2.0)
65
- rspec-support (~> 3.9.0)
66
- rspec-mocks (3.9.1)
66
+ rspec-support (~> 3.10.0)
67
+ rspec-mocks (3.10.0)
67
68
  diff-lcs (>= 1.2.0, < 2.0)
68
- rspec-support (~> 3.9.0)
69
- rspec-support (3.9.3)
70
- rubocop (0.92.0)
69
+ rspec-support (~> 3.10.0)
70
+ rspec-support (3.10.0)
71
+ rubocop (1.1.0)
71
72
  parallel (~> 1.10)
72
73
  parser (>= 2.7.1.5)
73
74
  rainbow (>= 2.2.2, < 4.0)
74
- regexp_parser (>= 1.7)
75
+ regexp_parser (>= 1.8)
75
76
  rexml
76
- rubocop-ast (>= 0.5.0)
77
+ rubocop-ast (>= 1.0.1)
77
78
  ruby-progressbar (~> 1.7)
78
79
  unicode-display_width (>= 1.4.0, < 2.0)
79
- rubocop-ast (0.7.0)
80
+ rubocop-ast (1.1.0)
80
81
  parser (>= 2.7.1.5)
81
- strscan (>= 1.0.0)
82
82
  rubocop-performance (1.8.1)
83
83
  rubocop (>= 0.87.0)
84
84
  rubocop-ast (>= 0.4.0)
85
85
  ruby-progressbar (1.10.1)
86
- strscan (1.0.3)
87
86
  thread_safe (0.3.6)
88
87
  tzinfo (1.2.7)
89
88
  thread_safe (~> 0.1)
90
89
  unicode-display_width (1.7.0)
91
90
  yard (0.9.25)
92
- zeitwerk (2.4.0)
91
+ zeitwerk (2.4.1)
93
92
 
94
93
  PLATFORMS
95
94
  ruby
data/README.md CHANGED
@@ -24,6 +24,22 @@ Or install it yourself as:
24
24
  $ gem install camper
25
25
  ```
26
26
 
27
+ ## Status of API endpoints
28
+
29
+ The up-to-date list of Basecamp API endpoints can be found at [here](https://github.com/basecamp/bc3-api#api-endpoints).
30
+
31
+ Currently, Camper supports the following endpoints:
32
+
33
+ * [Comments](https://github.com/basecamp/bc3-api/blob/master/sections/comments.md): Implementation at [comments.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/comments.rb) (Complete)
34
+ * [Message Types](https://github.com/basecamp/bc3-api/blob/master/sections/message_types.md): Implementation at [messages.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/message_types.rb) (Complete)
35
+ * [Message Boards](https://github.com/basecamp/bc3-api/blob/master/sections/message_boards.md): Implementation at [message_boards.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/message_boards.rb) (Complete)
36
+ * [Messages](https://github.com/basecamp/bc3-api/blob/master/sections/messages.md): Implementation at [messages.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/messages.rb) (Complete)
37
+ * [People](https://github.com/basecamp/bc3-api/blob/master/sections/people.md): Implementation at [people.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/people.rb) (Complete)
38
+ * [Projects](https://github.com/basecamp/bc3-api/blob/master/sections/projects.md): Implementation at [projects.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/projects.rb) (Complete)
39
+ * [Recordings](https://github.com/basecamp/bc3-api/blob/master/sections/recordings.md): Implementation at [recordings.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/recordings.rb) (Complete)
40
+ * [To-do list](https://github.com/basecamp/bc3-api/blob/master/sections/todolists.md): Implementation at [todolists.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/todolists.rb) (Complete)
41
+ * [To-dos](https://github.com/basecamp/bc3-api/blob/master/sections/todos.md): Implementation at [todos.rb](https://github.com/renehernandez/camper/blob/main/lib/camper/api/todos.rb) (Complete)
42
+
27
43
  ## Usage
28
44
 
29
45
  ### Configuration
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency 'httparty', '~> 0.18'
30
30
  spec.add_dependency 'rack-oauth2', '~> 1.14'
31
+ spec.add_dependency 'concurrent-ruby', '~> 1.1'
31
32
 
32
33
  spec.add_development_dependency 'rake', '~> 13.0'
33
34
  spec.add_development_dependency 'rspec', '~> 3.9'
@@ -25,11 +25,22 @@ projects.auto_paginate do |p|
25
25
  # Adds a comment on the first todolist
26
26
  list = client.todolists(todoset).first
27
27
  puts "Todolist: #{list.title}, can be commented on: #{list.can_be_commented?}"
28
- client.create_comment(list, 'New <b>comment</b> with <i>HTML support</i>')
28
+
29
+ puts 'Create a new comment'
30
+ new_comment = client.create_comment(list, 'New temporary comment')
29
31
  comments = client.comments(list)
30
32
  idx = 0
31
33
  comments.auto_paginate do |c|
32
34
  puts "Comment #{idx} content: #{c.content}"
33
35
  idx += 1
34
36
  end
37
+
38
+ puts 'Get single comment'
39
+ single_comment = client.comment(list, new_comment.id)
40
+
41
+ puts 'Update comment'
42
+ client.update_comment(single_comment, 'New content')
43
+
44
+ puts 'Delete comment'
45
+ client.trash_comment(single_comment)
35
46
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'camper'
4
+
5
+ client = Camper.client
6
+
7
+ project = client.projects.first
8
+
9
+ puts 'List all messages types'
10
+ client.message_types(project).auto_paginate do |type|
11
+ puts "Name: #{type.name}; Icon: #{type.icon}"
12
+ end
13
+
14
+ puts 'Create new message type'
15
+ type = client.create_message_type(project, 'Farewell', '👋')
16
+ puts "Message Type:\n#{type.inspect}"
17
+
18
+ puts 'Update message type name'
19
+ type = client.update_message_type(project, type, name: 'Bye bye')
20
+ puts "Message Type:\n#{type.inspect}"
21
+
22
+ puts 'Update message type icon'
23
+ type = client.update_message_type(project, type, icon: '🙌')
24
+ puts "Message Type:\n#{type.inspect}"
25
+
26
+ puts 'Delete message type'
27
+ client.delete_message_type(project, type)
28
+
29
+
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'camper'
2
4
 
3
5
  client = Camper.configure do |config|
@@ -16,9 +18,18 @@ projects.auto_paginate do |p|
16
18
  message_board = client.message_board(p)
17
19
  puts "Message Board: #{message_board.title}"
18
20
 
21
+ puts 'List messages using the message board'
19
22
  messages = client.messages(message_board)
20
23
 
21
24
  messages.auto_paginate do |msg|
22
- puts msg.inspect
25
+ puts "Title: #{msg.title}; Content: #{msg.content}"
26
+ end
27
+
28
+ puts 'List messages using the project'
29
+ messages = client.messages(p)
30
+
31
+ messages.auto_paginate do |msg|
32
+ puts "Title: #{msg.title}; Content: #{msg.content}"
33
+ puts "Message:\n#{msg.inspect}"
23
34
  end
24
- end
35
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'camper'
4
+
5
+ client = Camper.client
6
+
7
+ current_user = client.profile
8
+
9
+ puts "Current User:\n#{current_user.inspect}"
10
+
11
+ puts "People:\n#{client.people.inspect}"
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'camper'
4
+
5
+ client = Camper.client
6
+
7
+ project = client.project(ENV['PROJECT_ID'])
8
+
9
+ puts "Project name: #{project.name}"
10
+ puts "Project description: #{project.description}"
11
+
12
+ client.update_project(project, name: 'Hermes Testing', description: 'Hermes integration testing')
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'camper'
4
+
5
+ client = Camper.client
6
+
7
+ recordings = client.recordings(
8
+ Camper::RecordingTypes::TODO
9
+ )
10
+
11
+ recordings.auto_paginate do |rec|
12
+ puts "Todo content: #{rec.content}"
13
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'camper'
4
+
5
+ client = Camper.client
6
+
7
+ projects = client.projects
8
+
9
+ projects.auto_paginate do |p|
10
+ puts "Project: #{p.name}"
11
+
12
+ todoset = client.todoset(p)
13
+
14
+ puts "Ratio of completed Todos in Todoset: #{todoset.completed_ratio}"
15
+
16
+ puts 'Listing active todolists'
17
+ client.todolists(todoset).auto_paginate(5) do |list|
18
+ puts "Todolist: #{list.title}"
19
+
20
+ client.todos(list).auto_paginate do |todo|
21
+ puts "Todo: #{todo.title}"
22
+ puts "Get Todo using project id: #{client.todo(p.id, todo.id).title}"
23
+ puts "Get Todo using project resource: #{client.todo(p, todo.id).title}"
24
+ puts "Get Todo using todolist resource: #{client.todo(list, todo.id).title}"
25
+ end
26
+ end
27
+
28
+ begin
29
+ client.todolists(p)
30
+ rescue Camper::Error::InvalidParameter, NoMethodError
31
+ puts 'Cannot use a project p to get the todolists'
32
+ end
33
+
34
+ puts 'Listing archived todolists'
35
+ client.todolists(todoset, status: :archived).auto_paginate do |list|
36
+ client.todos(list).auto_paginate do |todo|
37
+ puts "Todo: #{todo.title}"
38
+ puts "Can be commented: #{todo.can_be_commented?}"
39
+ puts "It's completed: #{todo.completed}"
40
+
41
+ client.complete_todo(todo)
42
+ end
43
+ end
44
+
45
+ puts 'Create a new todolist'
46
+ new_list = client.create_todolist(todoset, 'Temporary list')
47
+ puts "Todolist title: #{new_list.title}"
48
+ puts 'Trash list'
49
+ client.trash_todolist(new_list)
50
+ end
@@ -10,18 +10,33 @@ end
10
10
 
11
11
  projects = client.projects
12
12
 
13
- projects.auto_paginate do |p|
14
- puts "Project: #{p.inspect}"
13
+ selected_todo = nil
15
14
 
16
- puts "Todo set: #{p.todoset.inspect}"
15
+ projects.auto_paginate do |p|
16
+ puts "Project: #{p.name}"
17
17
 
18
18
  todoset = client.todoset(p)
19
19
 
20
+ puts "Ratio of completed Todos in Todoset: #{todoset.completed_ratio}"
21
+
20
22
  client.todolists(todoset).auto_paginate(5) do |list|
21
23
  puts "Todolist: #{list.title}"
22
24
 
23
- client.todos(list).auto_paginate do |todo|
24
- puts todo.inspect
25
+ client.todos(list).auto_paginate(1) do |todo|
26
+ puts "Todo: #{todo.title}"
27
+ puts "Get Todo using project id: #{client.todo(p.id, todo.id).title}"
28
+ puts "Get Todo using project resource: #{client.todo(p, todo.id).title}"
29
+ puts "Get Todo using todolist resource: #{client.todo(list, todo.id).title}"
30
+
31
+ selected_todo = todo
25
32
  end
33
+
34
+ puts 'Create new todo'
35
+ new_todo = client.create_todo(list, 'new todo')
36
+ puts "New Todo title: #{new_todo.title}"
37
+ puts 'Trash new todo'
38
+ client.trash_todo(new_todo)
26
39
  end
27
- end
40
+ end
41
+
42
+ client.update_todo(selected_todo, { description: 'New Description' })