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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4025359f98283885b1057f0c249994cbe1cc418c
4
- data.tar.gz: 0a4e2c48ccacc6a90176d5c9562a93cf7535b3ea
3
+ metadata.gz: e493483571fc07149db1eee8a7a1cb8f92c1a27d
4
+ data.tar.gz: 8feb5d6e9e074f69e6791cb795ddd5a9eded28db
5
5
  SHA512:
6
- metadata.gz: fc61c61dd0dccee892cc05e10f2c34f10d9202a62b2f74ba1f69cfe38515281211e2dab1122cfeb1205bebc17c12785072cdd6938e0f18ec54a83d4d317b1535
7
- data.tar.gz: c41f683bd2da902c6785902c7706c11540f40aaeaa760b00679e691644f6960c74e24d2b3ee576f8d165e06867d7a1a934e7b954fd071f4e0912faa25fd4d780
6
+ metadata.gz: 1b31a25af254be00dcbf881b961b2cc6745719df31123e3795eec6a6d9c1e86d0bb73323a03dd9bb57abbb80e14c03d5359547f309cfa320aab71868716bfd40
7
+ data.tar.gz: dfbb3f5c1dc6014cc264d28888803fd712fbdb383caeb064111c6b2f85314d4f8d8c86d3e07b6edd4187f03555334816b7ca6314d6b96a0c0345b40809d0ca9f
@@ -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
- # require "pry"
11
- # Pry.start
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) ? @response.send(m) : super
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={})
@@ -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.data rescue res
24
+ res
25
+ # res.data rescue res
25
26
  end
26
27
  end
27
28
 
@@ -1,3 +1,3 @@
1
1
  module IBMhifive
2
- VERSION = "0.0.01"
2
+ VERSION = "0.0.02"
3
3
  end
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.01
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-07 00:00:00.000000000 Z
11
+ date: 2015-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler