sraas 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sraas.rb +17 -1
- data/lib/sraas/consumer.rb +1 -3
- data/lib/sraas/version.rb +1 -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: 01764c6541459c2412b6590b3b38d8d00c3eed18
|
4
|
+
data.tar.gz: 50d65e6c3f4c8744e3ec4b368c1349a81f7faeba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30369331637831b470ef195f07688f32e876a2a01d6c073f963f148134eb820dce95a57a1cb6320e7e672882fb6f1d26d94f576af8394986cea64fe0a1a63db7
|
7
|
+
data.tar.gz: 86c61bdcdf956befd36ab27ca4639a8b019528baf3b1215e5a32aec8e40d478a1605e65051bee002a79998d46883802152da062327cacd41f38d61694a0e924c
|
data/lib/sraas.rb
CHANGED
@@ -58,7 +58,8 @@ module Sraas
|
|
58
58
|
|
59
59
|
# This returns template cards "index" json
|
60
60
|
# if limit is > 100, do paging here.
|
61
|
-
def template_cards(template_deck_id, offset: 0, limit: 100)
|
61
|
+
def template_cards(template_deck_id=self.default_template_deck_id, offset: 0, limit: 100)
|
62
|
+
puts template_deck_id
|
62
63
|
template_cards = []
|
63
64
|
remainder = limit
|
64
65
|
while remainder > 0 do
|
@@ -78,6 +79,21 @@ module Sraas
|
|
78
79
|
JSON.parse(Sraas.api_resource(:get, "#{self.template_cards_endpoint}/#{template_card_id}"))
|
79
80
|
end
|
80
81
|
|
82
|
+
# This gets the deck id from Sraas for the default deck (which is specified by name)
|
83
|
+
def default_template_deck_id
|
84
|
+
return @default_template_deck_id if @default_template_deck_id
|
85
|
+
template_deck = self.template_decks({name_start: configuration.default_deck_name}).last
|
86
|
+
@default_template_deck_id = template_deck['id'] if template_deck
|
87
|
+
end
|
88
|
+
|
89
|
+
# TODO: accept not only title and kind. sraas needs to use ransack for it.
|
90
|
+
# This search template_card with title and kind.
|
91
|
+
def search_template_card(template_deck_id=self.default_template_deck_id, title, kind)
|
92
|
+
url = "#{Sraas.template_decks_endpoint}/#{template_deck_id}/template_cards/search"
|
93
|
+
params = {title: title, kind: kind}
|
94
|
+
JSON.parse(Sraas.api_resource(:get, url, params))
|
95
|
+
end
|
96
|
+
|
81
97
|
# This returns template card's children's "index" json
|
82
98
|
def template_card_children(template_card_id)
|
83
99
|
JSON.parse(Sraas.api_resource(:get, "#{self.template_cards_endpoint}/#{template_card_id}/children"))
|
data/lib/sraas/consumer.rb
CHANGED
@@ -129,9 +129,7 @@ module Sraas
|
|
129
129
|
# This search template_card with title and kind.
|
130
130
|
def search_template_card(title, kind)
|
131
131
|
template_deck_id = template_deck['id']
|
132
|
-
|
133
|
-
params = {title: title, kind: kind}
|
134
|
-
JSON.parse(Sraas.api_resource(:get, url, params))
|
132
|
+
Sraas.search_template_card(template_deck_id, title, kind)
|
135
133
|
end
|
136
134
|
|
137
135
|
# return all template_decks without name and fingerprint
|
data/lib/sraas/version.rb
CHANGED