22# encoding: utf-8
33
44module Github
5- class Client ::Projects ::Columns :: Cards < API
5+ class Client ::Projects ::Cards < API
66 REQUIRED_MOVE_CARD_PARAMS = %w( position ) . freeze
77
88 # List project cards for a column
99 #
1010 # @example
1111 # github = Github.new
12- # github.projects.columns. cards.list :column_id
12+ # github.projects.cards.list :column_id
1313 #
1414 # @see https://developer.github.com/v3/projects/cards/#list-project-cards
1515 #
@@ -20,15 +20,18 @@ def list(*args)
2020
2121 params [ "accept" ] ||= ::Github ::Client ::Projects ::PREVIEW_MEDIA
2222
23- get_request ( "/projects/columns/#{ arguments . column_id } /cards" , params )
23+ response = get_request ( "/projects/columns/#{ arguments . column_id } /cards" , params )
24+
25+ return response unless block_given?
26+ response . each { |el | yield el }
2427 end
2528 alias all list
2629
2730 # Get a project card
2831 #
2932 # @example
3033 # github = Github.new
31- # github.projects.columns. cards.get :card_id
34+ # github.projects.cards.get :card_id
3235 #
3336 # @see https://developer.github.com/v3/projects/cards/#get-a-project-card
3437 #
@@ -58,11 +61,11 @@ def get(*args)
5861 #
5962 # @example
6063 # github = Github.new
61- # github.projects.columns. cards.create :column_id, note: 'Card Note'
64+ # github.projects.cards.create :column_id, note: 'Card Note'
6265 #
6366 # @example
6467 # github = Github.new
65- # github.projects.columns. cards.create :column_id, id: <content-id>, content_type: 'content-type'
68+ # github.projects.cards.create :column_id, id: <content-id>, content_type: 'content-type'
6669 #
6770 # @see https://developer.github.com/v3/projects/cards/#create-a-project-card
6871 #
@@ -86,7 +89,7 @@ def create(*args)
8689 #
8790 # @example
8891 # github = Github.new
89- # github.projects.columns. cards.update :card_id, note: 'New card note'
92+ # github.projects.cards.update :card_id, note: 'New card note'
9093 #
9194 # @see https://developer.github.com/v3/projects/cards/#update-a-project-card
9295 #
@@ -104,7 +107,7 @@ def update(*args)
104107 #
105108 # @example
106109 # github = Github.new
107- # github.projects.columns. cards.delete :card_id
110+ # github.projects.cards.delete :card_id
108111 #
109112 # @see https://developer.github.com/v3/projects/cards/#delete-a-project-card
110113 #
@@ -117,6 +120,7 @@ def delete(*args)
117120
118121 delete_request ( "/projects/columns/cards/#{ arguments . card_id } " , params )
119122 end
123+ alias remove delete
120124
121125 # Move a project card
122126 #
@@ -128,11 +132,11 @@ def delete(*args)
128132 #
129133 # @example
130134 # github = Github.new
131- # github.projects.columns. cards.move :card_id, position: 'bottom'
135+ # github.projects.cards.move :card_id, position: 'bottom'
132136 #
133137 # @example
134138 # github = Github.new
135- # github.projects.columns. cards.move :card_id, position: 'after:<card-id>', column_id: <column-id>
139+ # github.projects.cards.move :card_id, position: 'after:<card-id>', column_id: <column-id>
136140 #
137141 # @see https://developer.github.com/v3/projects/cards/#move-a-project-card
138142 #
0 commit comments