textme-jtj 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/textme-jtj.rb +14 -5
- 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: 2be280bb22422c826cc6b79bc628d25a254d68db
|
4
|
+
data.tar.gz: 795b2d470d624c1b167f02a8409aa9deb59a8db2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3d2b1ad028bcdb60d673dc6b6dcd34c96417aa3c2d7af029780ece3b8f6f5d658fbdaf69fbe40bec6d89f9d6c2cf2609a6d24174568ec2c1ad7f48953030031
|
7
|
+
data.tar.gz: b5d9758e8a9caa456e1fe41cfc97d3cd7f20023184a66ef4a2ebbe3b603c7128f8064bd937d2cfaae876fc370e320251b159a38ea288f157dec1b3cb65b0222b
|
data/lib/textme-jtj.rb
CHANGED
@@ -278,22 +278,34 @@ module TextMe
|
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
281
|
+
#Helper class to extract Join The Journey's (JTJ) daily devotion specific information
|
281
282
|
class JTJVerseExtractor
|
283
|
+
#Helper method
|
284
|
+
#What: Makes a HTTP Get request to the JTJ API
|
285
|
+
#Input: id of the JTJ entry
|
286
|
+
#Output: the API response in JSON format
|
282
287
|
def get_verse(entry_id)
|
283
288
|
url = 'https://jtj.watermark.org/api/entries/' + entry_id.to_s
|
284
289
|
result = Net::HTTP.get(URI.parse(url))
|
285
290
|
return JSON.parse(result)
|
286
291
|
end
|
287
292
|
|
293
|
+
#What: Called from Core class to get the verse name and image link for specific JTJ
|
294
|
+
#Input: id of the JTJ entry
|
295
|
+
#Output: Hash containing the verse name and verse lock screen image
|
288
296
|
def extract_data(entry_id)
|
297
|
+
#Getting the HTTP response in JSON format of the given JTJ entry
|
289
298
|
data = get_verse(entry_id)
|
290
|
-
result = Hash.new
|
291
299
|
|
300
|
+
result = Hash.new #Empty result hash
|
301
|
+
|
302
|
+
#Get the lock screen image from the JSON
|
292
303
|
if data["entry"]["links"]["lock_screen"]
|
293
304
|
image_link = data["entry"]["links"]["lock_screen"]
|
294
305
|
result["image"] = image_link
|
295
306
|
end
|
296
307
|
|
308
|
+
#Get the verse name from JSON
|
297
309
|
if data["entry"]["memory_verse"]["reference"]
|
298
310
|
verse_name = data["entry"]["memory_verse"]["reference"]
|
299
311
|
result["verse"] = verse_name
|
@@ -302,7 +314,4 @@ module TextMe
|
|
302
314
|
return result
|
303
315
|
end
|
304
316
|
end
|
305
|
-
end
|
306
|
-
|
307
|
-
twil = TextMe::Core.new('ACa9011dd6fa6cabf225303edd1bdb71be', 'a426a2ba3deca28af4f6b17a91aacb5f', '+16197730346', '+14696551861')
|
308
|
-
twil.send_message(376)
|
317
|
+
end
|