Skip to content

Commit

Permalink
Merge pull request #7 from ricardotulio/feature/cards
Browse files Browse the repository at this point in the history
cards: create card resource
  • Loading branch information
ricardotulio committed Jun 4, 2017
2 parents 01c5244 + 258092d commit 5c67b48
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 13 deletions.
10 changes: 8 additions & 2 deletions dist/resources/boards.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions dist/resources/cards.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions dist/resources/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions dist/routes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions lib/resources/boards.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const lists = curry((credentials, data = {}) =>
request.get(routes.boards.lists(data.id), merge(credentials, data))
)

const cards = curry((credentials, data = {}) =>
request.get(routes.boards.cards(data.id), merge(credentials, data))
)

export default {
all,
lists,
cards,
}
19 changes: 19 additions & 0 deletions lib/resources/cards.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import request from '../request'
import routes from '../routes'
import {
curry,
merge,
} from 'ramda'

const find = curry((credentials, data = {}) =>
request.get(routes.cards.find(data.id), merge(credentials, data))
)

const actions = curry((credentials, data = {}) =>
request.get(routes.cards.actions(data.id), merge(credentials, data))
)

export default {
find,
actions,
}
4 changes: 3 additions & 1 deletion lib/resources/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import boards from './boards'
import cards from './cards'

export default {
boards
boards,
cards,
}
11 changes: 9 additions & 2 deletions lib/routes.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
const boards = {
base: '/1/members/me/boards',
lists: id => `/1/boards/${id}/lists/`
lists: id => `/1/boards/${id}/lists/`,
cards: id => `/1/boards/${id}/cards`,
}

const cards = {
find: id => `/1/cards/${id}`,
actions: id => `/1/cards/${id}/actions`,
}

export default {
boards
boards,
cards,
}

0 comments on commit 5c67b48

Please sign in to comment.