sraas 0.2.14 → 0.2.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d407823833658ffe8b28c0f49a259741e6b9cc37
4
- data.tar.gz: 5ee3444513c052742d5e517899a62857776d4b7b
3
+ metadata.gz: 8c84427806dfb1071fd9c71d0ca8cb5d45b65a95
4
+ data.tar.gz: 7cbe469cc7a2ca08663eab5b6eb8c4ec9a599fbc
5
5
  SHA512:
6
- metadata.gz: 5fcd44f675dc9064afaf963a25ce5a9ddcb339a39123bf3dca2bd7a5080ea160c0261cd9c46b36f9ce371f7478296b09c3e3c863453c64e6cd6fecf366d4cab2
7
- data.tar.gz: b0d4f0dcbb5bb172641e3cb9b9abeb799d03aa50ca82283ac20d62c0db88ab9a813d1402c07a515014594e4762a6a256272cd44e55d45151efb97c6c0386023c
6
+ metadata.gz: dccff92b0b9a51c4ecfad6bed55bb35c87c790cef5971ee06b96981d6c3ce92f7b1f5e9ace06843f01614ad4a0c91f03aeca58c2872f38f544fc9144ebe1f1e7
7
+ data.tar.gz: d89e0af70d6ef41055535686027d58f50185a9a6a639b527ce50b977356e8fe83668301dcf4c91c5878326810eb5b4ee10719e85820eb3a3b39208c0936fba79
@@ -42,6 +42,10 @@ module Sraas
42
42
  JSON.parse(api_resource(:get, template_decks_endpoint))
43
43
  end
44
44
 
45
+ def template_deck(id)
46
+ JSON.parse(api_resource(:get, "#{template_decks_endpoint}/#{id}"))
47
+ end
48
+
45
49
  # This returns template cards "index" json
46
50
  def template_cards(template_deck_id)
47
51
  JSON.parse(Sraas.api_resource(:get, "#{self.template_decks_endpoint}/#{template_deck_id}/template_cards"))
@@ -107,6 +107,23 @@ module Sraas
107
107
  parse_json { get("#{consumer_url}/report/#{ids}") }
108
108
  end
109
109
 
110
+ # template_deck accessor. specified by consumer
111
+ # Assume consumers/:consumer_id/decks has only one deck
112
+ # even though sraas can have more than one decks...
113
+ def template_deck
114
+ decks = parse_json { get("#{consumer_url}/decks") }
115
+ template_deck_id = decks.first['template_deck_id']
116
+ Sraas.template_deck(template_deck_id)
117
+ end
118
+
119
+ # This returns template_cards selected with lesson number.
120
+ # and progress: 0
121
+ def template_lesson(lesson)
122
+ template_deck_id = template_deck['id']
123
+ template_lesson = parse_json { get("#{Sraas.template_decks_endpoint}/#{template_deck_id}/template_lessons/#{lesson}") }
124
+ OpenStruct.new(progress: template_lesson['progress'], template_cards: template_lesson['template_cards'])
125
+ end
126
+
110
127
  def template_decks
111
128
  Sraas.template_decks
112
129
  end
@@ -1,3 +1,3 @@
1
1
  module Sraas
2
- VERSION = '0.2.14'
2
+ VERSION = '0.2.15'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sraas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel