clubhouse2 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -1
- data/VERSION +1 -1
- data/lib/clubhouse2/client.rb +6 -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: 5c1c87518ad2656fbe60ddf10c0de8e82d6b4bac
|
4
|
+
data.tar.gz: fffdffbb63254d38b0673ce5dd91793b10ca928e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e45c073cb576d63d3cec7f02b44021bbd6d9d2a6cefde3377977da8876abb640082a444cf8c3d28c97bce28bdaf2fd01086608a48ff205eb4b732c555c8433a4
|
7
|
+
data.tar.gz: 4f70db02ea2d79866716220799038e78b1ce32f0cc4de03c1d89b6c786803c57ff77bcbdb9d9440ba7de91849bf0505a740c845bc1db217348e759a53d568d2c
|
data/README.md
CHANGED
@@ -98,6 +98,7 @@ client.project(name: 'Testing').stories.each(&:delete!)
|
|
98
98
|
client.workflows # list all workflows and states
|
99
99
|
client.labels # list all labels
|
100
100
|
client.teams # list all teams
|
101
|
+
client.story_links # list all story links
|
101
102
|
```
|
102
103
|
### Methods returning single resources
|
103
104
|
```ruby
|
@@ -110,11 +111,43 @@ client.project(name: 'Testing').stories.each(&:delete!)
|
|
110
111
|
client.workflow # list the first matching workflow (usually Default)
|
111
112
|
client.label # list the first matching label
|
112
113
|
client.team # list the first matching team
|
114
|
+
client.story_link # list the first matching story link
|
115
|
+
```
|
116
|
+
|
117
|
+
### Creation methods
|
118
|
+
```ruby
|
119
|
+
client.create_project # create a project
|
120
|
+
client.create_milestone # create a milestone
|
121
|
+
client.create_member # create a member
|
122
|
+
client.create_epic # create an epic
|
123
|
+
client.create_story # create a story
|
124
|
+
client.create_category # create a category
|
125
|
+
client.create_workflow # create a workflow
|
126
|
+
client.create_label # create a label
|
127
|
+
client.create_team # create a team
|
128
|
+
client.create_story_link # create a story link
|
129
|
+
client.story.create_comment # create a comment for a story
|
130
|
+
client.story.create_task # create a task for a story
|
131
|
+
client.epic.create_comment # create a comment for an epic
|
132
|
+
```
|
133
|
+
### Update methods
|
134
|
+
```ruby
|
135
|
+
client.update_project # update a project
|
136
|
+
client.update_milestone # update a milestone
|
137
|
+
client.update_member # update a member
|
138
|
+
client.update_epic # update an epic
|
139
|
+
client.update_story # update a story
|
140
|
+
client.update_category # update a category
|
141
|
+
client.update_workflow # update a workflow
|
142
|
+
client.update_label # update a label
|
143
|
+
client.update_team # update a team
|
144
|
+
client.update_story_link # update a story link
|
113
145
|
```
|
146
|
+
|
114
147
|
### Filtering
|
115
148
|
It's possible to filter by any resource property provided by the API. Multiple property filters can be specified. Filters match any member of an array, for example you can filter `stories` by `follower_ids`, which will match any stories for which the given member, or members, are followers.
|
116
149
|
```ruby
|
117
|
-
client.project(id: 123)
|
150
|
+
client.project(id: 123) # get a specific project
|
118
151
|
client.project(name: 'blah') # get a project by name
|
119
152
|
client.projects(archived: true) # get all archived projects
|
120
153
|
client.project(id: 123).stories # get stories belonging to a project
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
data/lib/clubhouse2/client.rb
CHANGED
@@ -36,7 +36,12 @@ module Clubhouse
|
|
36
36
|
# Take all the provided properties, and filter out any resources that don't match.
|
37
37
|
# If the value of a property is an object with an ID, match on that ID instead (makes for tidier queries)
|
38
38
|
def filter(object_array, args)
|
39
|
-
object_array.reject { |s| args.collect { |k, v| not [ *s.send(k) ].include? v
|
39
|
+
object_array.reject { |s| args.collect { |k, v| not resolve_to_ids([ *s.send(k) ]).include? resolve_to_ids(v) }.reduce(:|) }
|
40
|
+
end
|
41
|
+
|
42
|
+
def resolve_to_ids(object)
|
43
|
+
return object.collect { |o| resolve_to_ids(o) } if object.is_a? Array
|
44
|
+
(object.respond_to?(:id) ? object.id : object)
|
40
45
|
end
|
41
46
|
|
42
47
|
# or v.empty? if v.respond_to?(:empty?)
|