clubhouse2 0.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 +4 -4
- data/README.md +29 -17
- data/VERSION +1 -1
- data/lib/clubhouse2/client.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d4671759a9bb2c2702d1b3e236f8b46127dc5ed
|
4
|
+
data.tar.gz: 7edbf8d76327399603dce7c2c50002095c11ba1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4735bbe5697325758b252859a42748c9fea3394ef26c4f44dd6a361cb2ce5ef0088d3f511e1f5eb872ebebfb5c561703babcd86098c0e1ccef1ed7a35595e46
|
7
|
+
data.tar.gz: 0da00f45ceb285c2ad6a5ec6c0d378c2668b92477e710f36d8c5c51ed54c415754d51996c2f9f439b23290c03b4aaab5e5ddbf36ca6fe92eed3101f3fe00e3c0
|
data/README.md
CHANGED
@@ -5,28 +5,39 @@ This is a resource-oriented ruby library for interacting with the Clubhouse v2 A
|
|
5
5
|
## How to use
|
6
6
|
|
7
7
|
### Initializing the client
|
8
|
-
|
9
|
-
|
8
|
+
```ruby
|
9
|
+
require 'clubhouse2'
|
10
|
+
client = Clubhouse::Client.new(api_key: 'your_api_key')
|
11
|
+
```
|
10
12
|
|
11
|
-
###
|
12
|
-
|
13
|
-
#### Quick-start
|
13
|
+
### Quick-start
|
14
14
|
Get all stories being followed by a user called 'James'.
|
15
|
-
|
15
|
+
```ruby
|
16
|
+
client.stories(follower_ids: client.member(name: 'James'))
|
17
|
+
```
|
16
18
|
|
17
19
|
Get all stories in the 'Testing' project in the 'Completed' state.
|
18
|
-
|
20
|
+
```ruby
|
21
|
+
client.project(name: 'Testing').stories(workflow_state_id: client.workflow.state(name: 'Completed'))
|
22
|
+
```
|
19
23
|
|
20
24
|
Get the names of all stories in the 'Testing' project
|
21
|
-
|
25
|
+
```ruby
|
26
|
+
client.project(name: 'Testing').stories.collect(&:name)
|
27
|
+
```
|
22
28
|
|
23
29
|
Get all non-archived stories with the label 'Out Of Hours'
|
24
|
-
|
30
|
+
```ruby
|
31
|
+
client.stories(archived: false, labels: client.label(name: 'Out Of Hours'))
|
32
|
+
```
|
25
33
|
|
26
34
|
Get all stories last updated more than 30 days ago
|
27
|
-
|
35
|
+
```ruby
|
36
|
+
client.stories.select { |story| story.updated_at < Date.today - 30 }
|
37
|
+
```
|
28
38
|
|
29
|
-
|
39
|
+
### Methods returning arrays of resources
|
40
|
+
```ruby
|
30
41
|
client.projects # list all projects
|
31
42
|
client.milestones # list all milestones
|
32
43
|
client.members # list all members (users)
|
@@ -36,8 +47,9 @@ Get all stories last updated more than 30 days ago
|
|
36
47
|
client.workflows # list all workflows and states
|
37
48
|
client.labels # list all labels
|
38
49
|
client.teams # list all teams
|
39
|
-
|
40
|
-
|
50
|
+
```
|
51
|
+
### Methods returning single resources
|
52
|
+
```ruby
|
41
53
|
client.project # list the first matching project
|
42
54
|
client.milestone # list the first matching milestone
|
43
55
|
client.member # list the first matching member (user)
|
@@ -47,15 +59,15 @@ Get all stories last updated more than 30 days ago
|
|
47
59
|
client.workflow # list the first matching workflow (usually Default)
|
48
60
|
client.label # list the first matching label
|
49
61
|
client.team # list the first matching team
|
50
|
-
|
51
|
-
|
62
|
+
```
|
63
|
+
### Filtering
|
52
64
|
It's possible to filter by any resource property provided by the API. Multiple property filters can be specified.
|
53
|
-
|
65
|
+
```ruby
|
54
66
|
client.project(id: 123) # get a specific project
|
55
67
|
client.project(name: 'blah') # get a project by name
|
56
68
|
client.projects(archived: true) # get all archived projects
|
57
69
|
client.project(id: 123).stories # get stories belonging to a project
|
58
70
|
client.story(archived: false) # get all non-archived stories
|
59
|
-
|
71
|
+
```
|
60
72
|
### Notes
|
61
73
|
Note that querying for stories is quicker when performed on a Project, rather than using the `client.projects` method. This is because stories are only available as children of a project, so building the global story array requires making an API call to every project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
1.0.3
|
data/lib/clubhouse2/client.rb
CHANGED
@@ -33,8 +33,10 @@ module Clubhouse
|
|
33
33
|
@resources[resource_class] = nil
|
34
34
|
end
|
35
35
|
|
36
|
+
# Take all the provided properties, and filter out any resources that don't match.
|
37
|
+
# If the value of a property is an object with an ID, match on that ID instead (makes for tidier queries)
|
36
38
|
def filter(object_array, args)
|
37
|
-
object_array.reject { |s| args.collect { |k, v| not [ *s.send(k) ].include? v }.reduce(:|) }
|
39
|
+
object_array.reject { |s| args.collect { |k, v| not [ *s.send(k) ].include? v.respond_to?(:id) ? v.id : v }.reduce(:|) }
|
38
40
|
end
|
39
41
|
|
40
42
|
# or v.empty? if v.respond_to?(:empty?)
|