kiva_api 0.1.2 → 0.1.3

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: 05a82aaa587d1ae16dcaea94230a200a3b5fd8f8
4
- data.tar.gz: f18e6f91f74c1e137e69420aa391a7064e948e56
3
+ metadata.gz: 563a0c4e52d54e3724b06c2609c7a8b52c09b37e
4
+ data.tar.gz: ffb829c4b4e5783611adf12f6e83cf41679e48df
5
5
  SHA512:
6
- metadata.gz: 857fb6ebf965b96388c5436902547ea68c53870f84190e72810d87fb49c4d634f76f590b1f1e6a865ec83c77ec374b9995ae1de8aa18f0437fa5771baf5b39ae
7
- data.tar.gz: 901a759e117cd5ebc7f3af8e88b6f4138487b4a0a40016c01976ec44ac2a35ebaa963b71a347f4ec3875299b3057bc113cf872b6fb144efc19db1a5016d68ff0
6
+ metadata.gz: fbe4f11b17dd2c4d479ba3289b58c67cbfa4731add9b5363df32f3b086e7eab5eb1c9268bcb7f1df059a78612e2e547969c644516a38686ef6df9688c48a1f8e
7
+ data.tar.gz: f31934edd6b465d8a3840ccd6d78dc8f4790bf88195b844a74fcfd7301243d45b19e26979aeece321949cb6f69a5e07694f34e96f7f55ba9bebc5014ea5dffa2
data/README.md CHANGED
@@ -7,7 +7,7 @@ Get Loan data from Kiva's API
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'kiva_api', ~> "0.1.2"
10
+ gem 'kiva_api', ~> "0.1.3"
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -49,6 +49,14 @@ loan_response.paid_amount
49
49
  # => 825.00
50
50
  loan_response.privately_fundraising?
51
51
  # => false
52
+ loan_response.required_pfp_lenders
53
+ # => 7
54
+ loan_response.purchased_amount
55
+ # => 825.00
56
+ loan_response.loan_amount_left_to_purchase
57
+ # => 0.00
58
+ loan_response.percent_purchased
59
+ # => 100.00
52
60
 
53
61
  terms = loan_api.terms_response
54
62
  terms.expected_payments
@@ -32,4 +32,20 @@ class KivaApi::LoanResponse
32
32
  def privately_fundraising?
33
33
  parsed_body['properties']['inPfp']
34
34
  end
35
+
36
+ def required_pfp_lenders
37
+ parsed_body['properties']['pfpMinLenders']
38
+ end
39
+
40
+ def loan_amount_left_to_purchase
41
+ loan_amount - purchased_amount
42
+ end
43
+
44
+ def purchased_amount
45
+ funded_amount + basket_amount
46
+ end
47
+
48
+ def percent_purchased
49
+ (purchased_amount / loan_amount) * 100.0
50
+ end
35
51
  end
@@ -1,3 +1,3 @@
1
1
  module KivaApi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiva_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Magelowitz