musoni_ruby 0.0.04 → 0.0.05
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 +4 -4
- data/lib/musoni_ruby/configuration.rb +17 -3
- data/lib/musoni_ruby/endpoints/loan.rb +2 -2
- data/lib/musoni_ruby/endpoints/savings_account.rb +2 -2
- data/lib/musoni_ruby/endpoints/transaction.rb +1 -1
- data/lib/musoni_ruby/support/test_helper.rb +7 -7
- data/lib/musoni_ruby/version.rb +1 -1
- data/lib/musoni_ruby.rb +1 -0
- data/musoni_ruby.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1683775625a3b47b14e389e4d340c82b5b5bf7ab
|
4
|
+
data.tar.gz: 4ea507e633de21bf402f0d2eae422f6aaf575db5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5deb24e35931f5028a39aea3b459722d36ae475054b95d52269618bab6934cc385c73a4b65b81731acac0ae0490b628ae637f6cf4880f348c2af1a6699b13133
|
7
|
+
data.tar.gz: 72a35010fdcd7c93b6d2ac90ee6417dfc5600794ad1113d087ea77c4c2fde79b0f5da88ba8b0da5208f5f603b6d9b2851f20660760fa9f6f7fce20e2ef7fef26
|
data/bin/console
CHANGED
@@ -7,8 +7,8 @@ require "musoni_ruby"
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
|
11
|
-
|
10
|
+
require "pry"
|
11
|
+
Pry.start
|
12
12
|
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
13
|
+
# require "irb"
|
14
|
+
# IRB.start
|
@@ -1,16 +1,30 @@
|
|
1
1
|
module Musoni
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :tenant, :token, :base_url
|
3
|
+
attr_accessor :tenant, :token, :base_url, :time_zone
|
4
4
|
|
5
|
-
def initialize(tenant:nil,token:nil,base_url:'https://demo.musonisystem.com:8443/api/v1')
|
6
|
-
|
5
|
+
def initialize(tenant:nil,token:nil,time_zone:nil,base_url:'https://demo.musonisystem.com:8443/api/v1')
|
6
|
+
@base_url ||= base_url
|
7
7
|
@tenant ||= tenant
|
8
8
|
@token ||= token
|
9
|
+
@time_zone ||= time_zone
|
10
|
+
set_time_zone
|
11
|
+
end
|
12
|
+
|
13
|
+
def time_zone=(value)
|
14
|
+
set_time_zone(value)
|
15
|
+
@time_zone = value
|
9
16
|
end
|
10
17
|
|
11
18
|
def header
|
12
19
|
{'Content-Type'=> 'application/json', 'Accept' => 'application/json', 'X-Mifos-Platform-TenantId' => tenant.to_s, 'Authorization' => "Basic #{token}"}
|
13
20
|
end
|
14
21
|
|
22
|
+
private
|
23
|
+
|
24
|
+
def set_time_zone(tz=nil)
|
25
|
+
time_zone = tz || @time_zone || Time.zone || 'UTC'
|
26
|
+
Time.zone = time_zone unless time_zone.nil?
|
27
|
+
end
|
28
|
+
|
15
29
|
end
|
16
30
|
end
|
@@ -31,7 +31,7 @@ module Musoni
|
|
31
31
|
# # Musoni::Loan.find(loan.id, fetch:false).activate(activation)
|
32
32
|
%w{approve}.each do |m|
|
33
33
|
define_method m do |options={}|
|
34
|
-
options[:"#{m}dOnDate"] ||= Time.now
|
34
|
+
options[:"#{m}dOnDate"] ||= Time.zone.now
|
35
35
|
url = "/loans/#{self.id}?command=#{m}"
|
36
36
|
response = Musoni::Fetch.post(url,options)
|
37
37
|
new(options.merge!(id:response.loanId ,response:response)) rescue response
|
@@ -42,7 +42,7 @@ module Musoni
|
|
42
42
|
# # Musoni::Loan.find(loan.id, fetch:false).disburse(disbursement)
|
43
43
|
%w{disburse}.each do |m|
|
44
44
|
define_method m do |options={}|
|
45
|
-
options[:actualDisbursementDate] ||= Time.now
|
45
|
+
options[:actualDisbursementDate] ||= Time.zone.now
|
46
46
|
url = "/loans/#{self.id}?command=#{m}"
|
47
47
|
response = Musoni::Fetch.post(url,options)
|
48
48
|
new(options.merge!(id:response.loanId ,response:response)) rescue response
|
@@ -31,7 +31,7 @@ module Musoni
|
|
31
31
|
# # account.activate(date)
|
32
32
|
%w{approve activate}.each do |m|
|
33
33
|
define_method m do |options={}|
|
34
|
-
options[:"#{m}dOnDate"] ||= Time.now
|
34
|
+
options[:"#{m}dOnDate"] ||= Time.zone.now
|
35
35
|
url = "/savingsaccounts/#{self.id}?command=#{m}"
|
36
36
|
response = Musoni::Fetch.post(url,options)
|
37
37
|
new(options.merge!(id:response.savingsId ,response:response)) rescue response
|
@@ -42,7 +42,7 @@ module Musoni
|
|
42
42
|
# # account.activate(date)
|
43
43
|
%w{deposit withdrawal}.each do |m|
|
44
44
|
define_method m do |options={}|
|
45
|
-
options[:transactionDate] ||= Time.now
|
45
|
+
options[:transactionDate] ||= Time.zone.now
|
46
46
|
url = "/savingsaccounts/#{self.id}/transactions?command=#{m}"
|
47
47
|
response = Musoni::Fetch.post(url,options)
|
48
48
|
new(options.merge!(id:response.savingsId ,response:response)) rescue response
|
@@ -20,7 +20,7 @@ module Musoni
|
|
20
20
|
def transfer(options={})
|
21
21
|
options = transfer_options(options)
|
22
22
|
url = "/accounttransfers"
|
23
|
-
options[:transferDate] = Time.now
|
23
|
+
options[:transferDate] = Time.zone.now
|
24
24
|
response = Musoni::Fetch.post(url,options)
|
25
25
|
new(options.merge!(id:response.resourceId ,response:response)) rescue response
|
26
26
|
end
|
@@ -16,9 +16,9 @@ module Musoni::TestHelper
|
|
16
16
|
middlename: Faker::Name.first_name,
|
17
17
|
externalId: rand(100000),
|
18
18
|
mobileNo: "07234#{rand(10000)}",
|
19
|
-
submittedOnDate: Time.now,
|
19
|
+
submittedOnDate: Time.zone.now,
|
20
20
|
active: "true",
|
21
|
-
activationDate: Time.now
|
21
|
+
activationDate: Time.zone.now
|
22
22
|
}
|
23
23
|
end
|
24
24
|
|
@@ -35,7 +35,7 @@ module Musoni::TestHelper
|
|
35
35
|
{
|
36
36
|
clientId: client.id,
|
37
37
|
productId: "1",
|
38
|
-
submittedOnDate: Time.now,
|
38
|
+
submittedOnDate: Time.zone.now,
|
39
39
|
fieldOfficerId: "1",
|
40
40
|
charges: [],
|
41
41
|
allowOverdraft: false
|
@@ -44,8 +44,8 @@ module Musoni::TestHelper
|
|
44
44
|
|
45
45
|
def create_musoni_loan
|
46
46
|
client = create_musoni_client
|
47
|
-
now = Time.now
|
48
|
-
tomorrow = (Time.now + 86400)
|
47
|
+
now = Time.zone.now
|
48
|
+
tomorrow = (Time.zone.now + 86400)
|
49
49
|
loan_options = {
|
50
50
|
submittedOnDate: now,
|
51
51
|
clientId: client.id,
|
@@ -118,7 +118,7 @@ module Musoni::TestHelper
|
|
118
118
|
Response_Statuscode: "300",
|
119
119
|
dateFormat: "dd-MM-yyyy",
|
120
120
|
locale: "en_GB",
|
121
|
-
submittedon_date: Time.now,
|
121
|
+
submittedon_date: Time.zone.now,
|
122
122
|
submittedon_userid: 1
|
123
123
|
}
|
124
124
|
@@musoni_transunion_datatable ||= Musoni::Datatable.create(:cct_TransUnion,client.id,datatable_attributes)
|
@@ -133,7 +133,7 @@ module Musoni::TestHelper
|
|
133
133
|
Interest_Rate: "10.05",
|
134
134
|
dateFormat: "dd-MM-yyyy",
|
135
135
|
locale: "en_GB",
|
136
|
-
submittedon_date: Time.now,
|
136
|
+
submittedon_date: Time.zone.now,
|
137
137
|
submittedon_userid: 1
|
138
138
|
}
|
139
139
|
@@musoni_firstaccess_datatable ||= Musoni::Datatable.create(:cct_First_Access_Score,client.id,datatable_attributes)
|
data/lib/musoni_ruby/version.rb
CHANGED
data/lib/musoni_ruby.rb
CHANGED
data/musoni_ruby.gemspec
CHANGED
@@ -42,6 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_development_dependency "sinatra", '~> 1.4'
|
43
43
|
spec.add_development_dependency "faker", '~> 1.4'
|
44
44
|
|
45
|
+
spec.add_dependency 'activesupport', "~> 4.2"
|
45
46
|
spec.add_dependency 'httparty', "~> 0.13"
|
46
47
|
spec.add_dependency 'hashie', "~> 3.4"
|
47
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: musoni_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.05
|
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-08-
|
11
|
+
date: 2015-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -192,6 +192,20 @@ dependencies:
|
|
192
192
|
- - "~>"
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '1.4'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: activesupport
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '4.2'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '4.2'
|
195
209
|
- !ruby/object:Gem::Dependency
|
196
210
|
name: httparty
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|