IBMhifive 0.0.01 → 0.0.02
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 +4 -4
- data/bin/console +3 -5
- data/lib/IBMhifive/endpoints/_endpoint.rb +7 -1
- data/lib/IBMhifive/endpoints/loan.rb +8 -2
- data/lib/IBMhifive/fetch.rb +2 -1
- data/lib/IBMhifive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e493483571fc07149db1eee8a7a1cb8f92c1a27d
|
4
|
+
data.tar.gz: 8feb5d6e9e074f69e6791cb795ddd5a9eded28db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b31a25af254be00dcbf881b961b2cc6745719df31123e3795eec6a6d9c1e86d0bb73323a03dd9bb57abbb80e14c03d5359547f309cfa320aab71868716bfd40
|
7
|
+
data.tar.gz: dfbb3f5c1dc6014cc264d28888803fd712fbdb383caeb064111c6b2f85314d4f8d8c86d3e07b6edd4187f03555334816b7ca6314d6b96a0c0345b40809d0ca9f
|
data/bin/console
CHANGED
@@ -2,13 +2,11 @@
|
|
2
2
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "IBMhifive"
|
5
|
+
require 'faker'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
8
9
|
|
9
10
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
11
|
+
require "pry"
|
12
|
+
Pry.start
|
@@ -80,7 +80,13 @@ module IBMhifive
|
|
80
80
|
|
81
81
|
def method_missing(m, *args, &block)
|
82
82
|
if @response.is_a?(Hash)
|
83
|
-
@response.keys.include?(m.to_s)
|
83
|
+
if @response.keys.include?(m.to_s)
|
84
|
+
@response.send(m)
|
85
|
+
elsif @response.data.keys.include?(m.to_s)
|
86
|
+
@response.data.send(m)
|
87
|
+
else
|
88
|
+
super
|
89
|
+
end
|
84
90
|
else
|
85
91
|
super
|
86
92
|
end
|
@@ -21,13 +21,19 @@ module IBMhifive
|
|
21
21
|
# IBMhifive::Loan.create(loan_attributes)
|
22
22
|
def create(options={})
|
23
23
|
url = "/loans"
|
24
|
-
# bp
|
25
24
|
response = IBMhifive::Fetch.post(url,options.to_json)
|
26
|
-
loan = new(options.merge!(id:response.loan_id ,response:response)) rescue response
|
25
|
+
loan = new(options.merge!(id:response.data.loan_id ,response:response)) rescue response
|
27
26
|
end
|
28
27
|
|
29
28
|
end
|
30
29
|
|
30
|
+
# loan.update(name:new_name)
|
31
|
+
def update(options)
|
32
|
+
url = "/loans/#{self.id}"
|
33
|
+
response = IBMhifive::Fetch.put(url,options.to_json)
|
34
|
+
self.response = response.data
|
35
|
+
end
|
36
|
+
|
31
37
|
# options = transaction = {amount_paid: "5000", balance: "25000", pay_date: "2015-10-07 14:52:57"}
|
32
38
|
# IBMhifive::Loan.find(20284).create_transaction(options)
|
33
39
|
def create_transaction(options={})
|
data/lib/IBMhifive/fetch.rb
CHANGED
@@ -21,7 +21,8 @@ module IBMhifive
|
|
21
21
|
res = perform_request Net::HTTP::Get, path, options, &block if m == 'get'
|
22
22
|
res = perform_request Net::HTTP::Delete, path, options, &block if m == 'delete'
|
23
23
|
save_json(res) if load_json?
|
24
|
-
res
|
24
|
+
res
|
25
|
+
# res.data rescue res
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
data/lib/IBMhifive/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: IBMhifive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.02
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kariuki Gathitu
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|