trello_client_lite 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +11 -0
- data/README.md +149 -0
- data/Rakefile +11 -0
- data/VERSION +1 -0
- data/lib/trello.rb +8 -0
- data/lib/trello/client.rb +41 -0
- data/lib/trello/exceptions.rb +12 -0
- data/lib/trello/version.rb +7 -0
- metadata +246 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b0e399125cb65919ae25688cf9a3c1ca27eb00fd6681c71a2585655b37f5c61c
|
4
|
+
data.tar.gz: 350f887da04a472c43879270cc5a1ec692f9085b7aa3f5c69242ef12c14b6bce
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7cd21758d4d126b6fd3698b2bbb9919e91f221702743dd7c1361812ce00d4a26c13eced3c45c45659a1df5d4df6c6c48abd62e8d830c11e54a3aaea66d8e1904
|
7
|
+
data.tar.gz: c86c68df7197e3248eea0d18868c2fe0af3303d9e75a5389cc11a09750c234778a418af282748da41c583d90082b4e765cb771422e11e3dc6b489986855f7a01
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
# Trello Client
|
2
|
+
|
3
|
+
A simple gem for interacting with basic endpoints of the Trello RestAPI
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'trello_client_lite',
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```bash
|
22
|
+
gem install trello_client_lite
|
23
|
+
```
|
24
|
+
|
25
|
+
And require it:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'trello_client_lite'
|
29
|
+
```
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
### Client
|
34
|
+
|
35
|
+
For any interaction with the Trello API you'll need to new up a Trello Client.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
client = Trello::Client.new(
|
39
|
+
key: ENV.fetch('TRELLO_KEY'),
|
40
|
+
token: ENV.fetch('TRELLO_TOKEN')
|
41
|
+
)
|
42
|
+
```
|
43
|
+
|
44
|
+
### Get Board by Name
|
45
|
+
|
46
|
+
To get a board by name, use the client and pass in the name of the board you
|
47
|
+
want to return.
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
client.get_board_by_name(name: 'My Trello Board')
|
51
|
+
```
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
This project has a few rules which applies to all contributions:
|
56
|
+
|
57
|
+
1. All commits must follow the [Convention
|
58
|
+
Commits](https://www.conventionalcommits.org/) specification. This is less
|
59
|
+
scary than it sounds:
|
60
|
+
- It mostly involves adding a small prefix to each commit message that
|
61
|
+
indicates what type of commit it is. Common types are `feat:`, `fix:`,
|
62
|
+
`chore:`, `test:`, `docs:`, `refactor:`. See
|
63
|
+
[here](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional#type-enum)
|
64
|
+
for a complete list.
|
65
|
+
- A optional scope can also be provided. For example if adding a feature
|
66
|
+
within the "server" scope, the commit message prefix would be
|
67
|
+
`feat(server):`.
|
68
|
+
- Commits which introduce breaking changes MUST have a `!` before the `:` in
|
69
|
+
the commit message type prefix, or MUST format its main body as
|
70
|
+
`BREAKING CHANGE: <description>`. Ideally, do both for good measure.
|
71
|
+
2. All changes must be added to `master` via Pull Requests.
|
72
|
+
3. All Pull Requests must be merged by doing a fast-forward only merge. The
|
73
|
+
repository should already be setup to enforce this.
|
74
|
+
|
75
|
+
Following these rules enables automatic version bumping and changelog
|
76
|
+
generation, based on the commit history alone. And it also leads to a cleaner
|
77
|
+
and more structured commit history overall, as each commit needs to fit into a
|
78
|
+
specific type.
|
79
|
+
|
80
|
+
## Development
|
81
|
+
|
82
|
+
### Local Machine
|
83
|
+
|
84
|
+
1. Ensure you have Ruby version 2.5.0 or later installed.
|
85
|
+
2. Clone / checkout the repository.
|
86
|
+
3. Run `bundle install` to install dependencies.
|
87
|
+
4. Run `bundle exec rspec` to run test suite. Or alternatively, `make test` to
|
88
|
+
run the test suite in an isolated Docker environment.
|
89
|
+
5. Run `bundle exec rubocop` to run linter. Or alternatively, `make lint` to run
|
90
|
+
the linter in an isolated Docker environment.
|
91
|
+
6. Run `reek` to run another linter.... more details TODO
|
92
|
+
7. Make changes.
|
93
|
+
|
94
|
+
### Docker Environment
|
95
|
+
|
96
|
+
1. Clone / checkout the repository.
|
97
|
+
2. Ensure you have Docker installed with the `docker` CLI client in your `PATH`.
|
98
|
+
3. Run `make shell` to get a `sh` shell within a Alpine-based Ruby container,
|
99
|
+
with `bundle install` already executed.
|
100
|
+
4. Test suite and linter can be run within this environment with
|
101
|
+
`bundle exec rspec` and `bundle exec rubocop`, just like in the Local Machine
|
102
|
+
environment.
|
103
|
+
5. Make changes.
|
104
|
+
|
105
|
+
## Release
|
106
|
+
|
107
|
+
Once enough changes have made it into `master` that it's worthy a of new
|
108
|
+
release, it's time to bump the version.
|
109
|
+
|
110
|
+
### Requirements
|
111
|
+
|
112
|
+
- Node.js
|
113
|
+
- On macOS this can be installed with:
|
114
|
+
|
115
|
+
```bash
|
116
|
+
brew install node
|
117
|
+
```
|
118
|
+
|
119
|
+
- standard-version NPM package — Installed with:
|
120
|
+
|
121
|
+
```bash
|
122
|
+
npm install -g standard-version
|
123
|
+
```
|
124
|
+
|
125
|
+
### Cutting a Release
|
126
|
+
|
127
|
+
1. From the `master` branch, create a new branch called `release`:
|
128
|
+
`git checkout -b release`
|
129
|
+
2. Run: `make new-version` — Under the hood this runs `npx standard-version`,
|
130
|
+
which will:
|
131
|
+
- Read the current version from the `VERSION` file.
|
132
|
+
- Look at all commits since the most recent git tag to determine if those
|
133
|
+
changes yield a MAJOR, MINOR or PATCH change.
|
134
|
+
- Determine what the new version number is, and write said new version number
|
135
|
+
too the `VERSION` file.
|
136
|
+
- Update `CHANGELOG.md` with the new version, listing all `feat:` and `fix:`
|
137
|
+
commits as items changed since the previous version.
|
138
|
+
- Commit the changes to `VERSION` and `CHANGELOG.md` as a `chore(release):`
|
139
|
+
type commit.
|
140
|
+
- Create a git tag on the `chore(release):` commit matching the new version,
|
141
|
+
with a `v` prefix.
|
142
|
+
3. Push the `release` branch, but not the git tag: `git push origin release`
|
143
|
+
4. Open a Pull Request.
|
144
|
+
5. When Pull Request has been approved, merge it WITHOUT deleting the branch.
|
145
|
+
6. Run the release target for ruby gems `make release`
|
146
|
+
7. Push the git tag: `git push origin v<VERSION>`
|
147
|
+
8. Delete the `release` branch from the remote:
|
148
|
+
`git push origin --delete release`
|
149
|
+
9. All done.
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/lib/trello.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'httparty'
|
4
|
+
|
5
|
+
module Trello
|
6
|
+
class Client
|
7
|
+
def initialize(key:, token:)
|
8
|
+
@key = key
|
9
|
+
@token = token
|
10
|
+
@base_url = 'https://api.trello.com/1'
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_board_by_name(name:)
|
14
|
+
boards.select { |value| value['name'] == name }.first
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def request(endpoint)
|
20
|
+
url = "#{@base_url}/#{endpoint}"
|
21
|
+
response = yield(url)
|
22
|
+
|
23
|
+
return JSON.parse(response.body) if response.code.eql?(200)
|
24
|
+
|
25
|
+
raise_request_error(response)
|
26
|
+
end
|
27
|
+
|
28
|
+
def raise_request_error(response)
|
29
|
+
raise Trello::Exceptions::RequestError.new(
|
30
|
+
message: response.body,
|
31
|
+
http_code: response.code
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def boards
|
36
|
+
options = { query: { key: @key, token: @token } }
|
37
|
+
|
38
|
+
request('members/me/boards') { |url| HTTParty.get(url, options) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,246 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: trello_client_lite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Charlie Campbell
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.15.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.15.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler-audit
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.6'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.6'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: byebug
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '11.0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '11.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '12.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '12.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: reek
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 6.0.1
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 6.0.1
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: rspec
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '3.0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '3.0'
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: rspec_junit_formatter
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.4'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.4'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rubocop
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0.78'
|
124
|
+
type: :development
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0.78'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: rubocop-performance
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '1.5'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '1.5'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: rubocop-rspec
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '1.37'
|
152
|
+
- - "!="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: 1.38.0
|
155
|
+
type: :development
|
156
|
+
prerelease: false
|
157
|
+
version_requirements: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - "~>"
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '1.37'
|
162
|
+
- - "!="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 1.38.0
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: simplecov
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - "~>"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: 0.16.1
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 0.16.1
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: simplecov-console
|
181
|
+
requirement: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - "~>"
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: 0.7.2
|
186
|
+
type: :development
|
187
|
+
prerelease: false
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - "~>"
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: 0.7.2
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: httparty
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - "~>"
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 0.18.1
|
200
|
+
type: :runtime
|
201
|
+
prerelease: false
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - "~>"
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 0.18.1
|
207
|
+
description: Client gem for Trello API
|
208
|
+
email:
|
209
|
+
- charlie.campbell14@gmail.com
|
210
|
+
executables: []
|
211
|
+
extensions: []
|
212
|
+
extra_rdoc_files: []
|
213
|
+
files:
|
214
|
+
- Gemfile
|
215
|
+
- README.md
|
216
|
+
- Rakefile
|
217
|
+
- VERSION
|
218
|
+
- lib/trello.rb
|
219
|
+
- lib/trello/client.rb
|
220
|
+
- lib/trello/exceptions.rb
|
221
|
+
- lib/trello/version.rb
|
222
|
+
homepage: https://gitlab.com/charlescampbell1/trello_client
|
223
|
+
licenses: []
|
224
|
+
metadata:
|
225
|
+
homepage_uri: https://gitlab.com/charlescampbell1/trello_client
|
226
|
+
source_code_uri: https://gitlab.com/charlescampbell1/trello_client
|
227
|
+
post_install_message:
|
228
|
+
rdoc_options: []
|
229
|
+
require_paths:
|
230
|
+
- lib
|
231
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: 2.7.1
|
236
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: '0'
|
241
|
+
requirements: []
|
242
|
+
rubygems_version: 3.1.2
|
243
|
+
signing_key:
|
244
|
+
specification_version: 4
|
245
|
+
summary: Client gem for Trello API
|
246
|
+
test_files: []
|