wcc-jtj-client 0.1.6 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0ea1a3299d67a7d701851090155bb5df2e34bafc43a97bbc6ff2a275636fd47
4
- data.tar.gz: 845f6b092e7d798317a8ada0d4caa988604b533ab14754a9c8f8c9275937fb7f
3
+ metadata.gz: fdb4d64889a26f6e53ddfff3e83dab47c1e91901702c0742e895ed0a70b0d663
4
+ data.tar.gz: 272d10469bd6d3c070d62120dd614f3ac47bb4165ec7d3b7711e351eb0cbf996
5
5
  SHA512:
6
- metadata.gz: c09609601756ddb10e15a4aca40b65a8e377d77a7fab2c941b7e1db02348ce897b3fe637b6a3e310b8fb4741defb116cd20aaac88bc36ad337c1c1f747abe6fb
7
- data.tar.gz: c952db0f2cdab14cb4d28083dce0f68086ecbafc350c8b0553443bdfc7bd9d4e981a6dc453231ce593719fb5838ff684c7db8d3d324fa5b109a1c70ee5127c8f
6
+ metadata.gz: 7980e36863a966b09bcb5d352d0f51db7c1b5cc6f66e30d33515ccd7f1823be3a159f6fbbf32f08e2190b8e10060e25399f0d81d62a6f77f2fbd901a38fd9983
7
+ data.tar.gz: 7865b6f47b76a52140ba22b3a1686e7ba93d0da6a76e7e4ef7c9544c8bcf84fe62e59712215e6f370758fceba687947f3b917697590f3b0d9074ba7b7cca1521
@@ -21,6 +21,7 @@ module WCC::JTJ::Client::Responses
21
21
  end
22
22
 
23
23
  define_camelcase_alias(
24
+ 'settings',
24
25
  'links'
25
26
  ) do |camelcase|
26
27
  OpenStruct.new(raw[camelcase]) if raw[camelcase]
@@ -6,14 +6,25 @@ module WCC::JTJ::Client::Schemas
6
6
  class CurriculumSummary < Base
7
7
  define_camelcase_alias(
8
8
  'id',
9
- 'title',
10
- 'start_date',
11
- 'end_date',
12
- 'days_of_week'
9
+ 'title'
13
10
  ) do |camelcase|
14
11
  raw[camelcase]
15
12
  end
16
13
 
14
+ # An oversight - in the response these are snake case when they ought to be camel
15
+ %w[
16
+ start_date
17
+ end_date
18
+ days_of_week
19
+ ].each do |snake_case|
20
+ define_method(snake_case) do
21
+ raw[snake_case]
22
+ end
23
+ end
24
+ alias startDate start_date
25
+ alias endDate end_date
26
+ alias daysOfWeek days_of_week
27
+
17
28
  def links
18
29
  OpenStruct.new(raw['links']) if raw['links']
19
30
  end
@@ -24,5 +24,19 @@ module WCC::JTJ::Client::Schemas
24
24
  def links
25
25
  OpenStruct.new(raw['links']) if raw['links']
26
26
  end
27
+
28
+ def scriptures
29
+ (raw['scriptures'] || []).map do |s|
30
+ EntrySummary::Scripture.new(s, client: @client)
31
+ end
32
+ end
33
+
34
+ class Scripture < Base
35
+ define_camelcase_alias(
36
+ 'reference'
37
+ ) do |camelcase|
38
+ raw[camelcase]
39
+ end
40
+ end
27
41
  end
28
42
  end
@@ -3,7 +3,7 @@
3
3
  module WCC
4
4
  module JTJ
5
5
  class Client
6
- VERSION = '0.1.6'
6
+ VERSION = '0.1.8'
7
7
  end
8
8
  end
9
9
  end
@@ -86,6 +86,8 @@ module WCC::JTJ
86
86
  end
87
87
 
88
88
  def get_curriculum(id_or_link)
89
+ raise ArgumentError, 'please provide curriculum ID' unless id_or_link
90
+
89
91
  path =
90
92
  if /^https?:\/\// =~ id_or_link.to_s
91
93
  id_or_link
@@ -110,6 +112,8 @@ module WCC::JTJ
110
112
  end
111
113
 
112
114
  def get_entry(id_or_link, preview_code: nil)
115
+ raise ArgumentError, 'please provide entry ID' unless id_or_link
116
+
113
117
  path =
114
118
  if /^https?:\/\// =~ id_or_link.to_s
115
119
  id_or_link
@@ -125,6 +129,8 @@ module WCC::JTJ
125
129
  end
126
130
 
127
131
  def get_legacy(id)
132
+ raise ArgumentError, 'please provide legacy ID' unless id
133
+
128
134
  path = File.join(base_path, 'entries', 'legacy', id.to_s)
129
135
  resp = get(path).assert_ok!
130
136
 
@@ -144,6 +150,8 @@ module WCC::JTJ
144
150
  end
145
151
 
146
152
  def get_memory_verse(id_or_link)
153
+ raise ArgumentError, 'please provide memory verse ID' unless id_or_link
154
+
147
155
  path =
148
156
  if /^https?:\/\// =~ id_or_link.to_s
149
157
  id_or_link
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wcc-jtj-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watermark Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-05 00:00:00.000000000 Z
11
+ date: 2022-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday