camper 0.0.5 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rubocop.yml +5 -1
- data/.yardopts +4 -0
- data/CHANGELOG.md +44 -1
- data/Gemfile.lock +14 -11
- data/README.md +53 -22
- data/camper.gemspec +2 -0
- data/examples/comments.rb +1 -1
- data/examples/create_and_complete_todo.rb +24 -0
- data/examples/people.rb +11 -0
- data/examples/projects.rb +12 -0
- data/examples/todolists.rb +32 -0
- data/examples/todos.rb +8 -5
- data/lib/camper.rb +1 -0
- data/lib/camper/api/{comment.rb → comments.rb} +5 -3
- data/lib/camper/api/{message.rb → messages.rb} +1 -1
- data/lib/camper/api/people.rb +97 -0
- data/lib/camper/api/projects.rb +120 -0
- data/lib/camper/api/resource.rb +1 -3
- data/lib/camper/api/todolists.rb +81 -0
- data/lib/camper/api/todos.rb +133 -0
- data/lib/camper/authorization.rb +1 -1
- data/lib/camper/client.rb +37 -33
- data/lib/camper/configuration.rb +4 -6
- data/lib/camper/core_extensions/object.rb +156 -0
- data/lib/camper/error.rb +15 -4
- data/lib/camper/pagination_data.rb +0 -3
- data/lib/camper/request.rb +49 -20
- data/lib/camper/resource.rb +0 -2
- data/lib/camper/url_utils.rb +26 -0
- data/lib/camper/version.rb +1 -1
- metadata +44 -7
- data/lib/camper/api/project.rb +0 -20
- data/lib/camper/api/todo.rb +0 -14
data/lib/camper/resource.rb
CHANGED
@@ -63,11 +63,9 @@ module Camper
|
|
63
63
|
@data.key?(method_name.to_s) ? @data[method_name.to_s] : super
|
64
64
|
end
|
65
65
|
|
66
|
-
# rubocop:disable Style/OptionalBooleanParameter
|
67
66
|
def respond_to_missing?(method_name, include_private = false)
|
68
67
|
@hash.keys.map(&:to_sym).include?(method_name.to_sym) || super
|
69
68
|
end
|
70
|
-
# rubocop:enable Style/OptionalBooleanParameter
|
71
69
|
|
72
70
|
def self.detect_type(url)
|
73
71
|
case url
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Camper
|
4
|
+
# Defines methods related to url operations.
|
5
|
+
module UrlUtils
|
6
|
+
def self.basecamp_url?(url)
|
7
|
+
return false if url.nil? || !url.is_a?(String) || url == ''
|
8
|
+
|
9
|
+
transformed_url = UrlUtils.transform(url)
|
10
|
+
|
11
|
+
transformed_url.match?(%r{#{Configuration.base_api_endpoint}/\d+/.*})
|
12
|
+
end
|
13
|
+
|
14
|
+
# Utility method for transforming Basecamp Web URLs into API URIs
|
15
|
+
# e.g 'https://3.basecamp.com/1/buckets/2/todos/3' will be
|
16
|
+
# converted into 'https://3.basecampapi.com/1/buckets/2/todos/3.json'
|
17
|
+
#
|
18
|
+
# @param url [String] url to test
|
19
|
+
# @return [String]
|
20
|
+
def self.transform(url)
|
21
|
+
api_url = url.gsub('3.basecamp.com', '3.basecampapi.com')
|
22
|
+
api_url.gsub!('.json', '')
|
23
|
+
"#{api_url}.json"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/camper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: camper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- renehernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: concurrent-ruby
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '3.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
69
97
|
description:
|
70
98
|
email:
|
71
99
|
executables: []
|
@@ -82,6 +110,7 @@ files:
|
|
82
110
|
- ".rubocop.yml"
|
83
111
|
- ".rubocop_todo.yml"
|
84
112
|
- ".ruby-version"
|
113
|
+
- ".yardopts"
|
85
114
|
- CHANGELOG.md
|
86
115
|
- CONTRIBUTING.md
|
87
116
|
- Gemfile
|
@@ -93,19 +122,26 @@ files:
|
|
93
122
|
- bin/setup
|
94
123
|
- camper.gemspec
|
95
124
|
- examples/comments.rb
|
125
|
+
- examples/create_and_complete_todo.rb
|
96
126
|
- examples/messages.rb
|
97
127
|
- examples/oauth.rb
|
98
128
|
- examples/obtain_acces_token.rb
|
129
|
+
- examples/people.rb
|
130
|
+
- examples/projects.rb
|
131
|
+
- examples/todolists.rb
|
99
132
|
- examples/todos.rb
|
100
133
|
- lib/camper.rb
|
101
|
-
- lib/camper/api/
|
102
|
-
- lib/camper/api/
|
103
|
-
- lib/camper/api/
|
134
|
+
- lib/camper/api/comments.rb
|
135
|
+
- lib/camper/api/messages.rb
|
136
|
+
- lib/camper/api/people.rb
|
137
|
+
- lib/camper/api/projects.rb
|
104
138
|
- lib/camper/api/resource.rb
|
105
|
-
- lib/camper/api/
|
139
|
+
- lib/camper/api/todolists.rb
|
140
|
+
- lib/camper/api/todos.rb
|
106
141
|
- lib/camper/authorization.rb
|
107
142
|
- lib/camper/client.rb
|
108
143
|
- lib/camper/configuration.rb
|
144
|
+
- lib/camper/core_extensions/object.rb
|
109
145
|
- lib/camper/error.rb
|
110
146
|
- lib/camper/logging.rb
|
111
147
|
- lib/camper/paginated_response.rb
|
@@ -113,6 +149,7 @@ files:
|
|
113
149
|
- lib/camper/request.rb
|
114
150
|
- lib/camper/resource.rb
|
115
151
|
- lib/camper/resources/project.rb
|
152
|
+
- lib/camper/url_utils.rb
|
116
153
|
- lib/camper/version.rb
|
117
154
|
homepage: https://github.com/renehernandez/camper
|
118
155
|
licenses:
|
@@ -136,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
173
|
- !ruby/object:Gem::Version
|
137
174
|
version: '0'
|
138
175
|
requirements: []
|
139
|
-
rubygems_version: 3.1.
|
176
|
+
rubygems_version: 3.1.4
|
140
177
|
signing_key:
|
141
178
|
specification_version: 4
|
142
179
|
summary: Ruby client for Basecamp 3 API
|
data/lib/camper/api/project.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Camper::Client
|
4
|
-
module ProjectAPI
|
5
|
-
|
6
|
-
def projects(options = {})
|
7
|
-
get("/projects", options)
|
8
|
-
end
|
9
|
-
|
10
|
-
def message_board(project)
|
11
|
-
board = project.message_board
|
12
|
-
get(board.url, override_path: true)
|
13
|
-
end
|
14
|
-
|
15
|
-
def todoset(project)
|
16
|
-
todoset = project.todoset
|
17
|
-
get(todoset.url, override_path: true)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/camper/api/todo.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class Camper::Client
|
4
|
-
module TodoAPI
|
5
|
-
|
6
|
-
def todolists(todoset)
|
7
|
-
get(todoset.todolists_url, override_path: true)
|
8
|
-
end
|
9
|
-
|
10
|
-
def todos(todolist, options={})
|
11
|
-
get(todolist.todos_url, options.merge(override_path: true))
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|