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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/textme-jtj.rb +14 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efd3fad619042756034c858c54525da5cb78c31d
4
- data.tar.gz: 7902a3c58b792831d24f7dddef9d5f8ab772833d
3
+ metadata.gz: 2be280bb22422c826cc6b79bc628d25a254d68db
4
+ data.tar.gz: 795b2d470d624c1b167f02a8409aa9deb59a8db2
5
5
  SHA512:
6
- metadata.gz: 69ce99cff5ba49a80a6dc290894307b3adaa71c98f19c3f609222abc3ccabaeed90a092f7dd4576843db2cface2d66a3e73098e2ee71a42a2050288d8d1223ce
7
- data.tar.gz: 6b42f2c21262ce06995c7f9e596dec7f40cc3591e6ee946ffaba9af90366e34e8b620f1b1bd0439e43ef97d85a9cf0d5b77b1de1f0c20e08d60f9fcc07c4631b
6
+ metadata.gz: a3d2b1ad028bcdb60d673dc6b6dcd34c96417aa3c2d7af029780ece3b8f6f5d658fbdaf69fbe40bec6d89f9d6c2cf2609a6d24174568ec2c1ad7f48953030031
7
+ data.tar.gz: b5d9758e8a9caa456e1fe41cfc97d3cd7f20023184a66ef4a2ebbe3b603c7128f8064bd937d2cfaae876fc370e320251b159a38ea288f157dec1b3cb65b0222b
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textme-jtj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harsh Gosar