mpayer_ruby 0.0.14 → 0.0.15

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MmZlNDUwY2NmYjdmYTgyYTI2ZmY4NzAwY2Q3ZTBjZTk1MjQ5OThkZQ==
5
- data.tar.gz: !binary |-
6
- NjQ4NDYwNWNjYTVjZmQ3MWMyMjEwNGQ2NjgyNDE2ODRhYTM1ZTU1YQ==
2
+ SHA1:
3
+ metadata.gz: c39502abba587f0cbc2cdf9b8b9db04cfed225f4
4
+ data.tar.gz: 75de16e852aa1e2893f4741ede6a462d599e2cdb
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- YmI5NTEzOGRjNTUwNDllNzMwNWYxOTMyY2UxYzA4YzgxYjc1Mjk0YmE0ZjVk
10
- MmNjMGIyNTUzOWUwYjQ2YWIyYWYzYmJmZjI0NTU1MDk0YWYzM2YzOTk4MDcz
11
- M2M2ODRhYjA0NWZlODAwMTBmZDNjZmE3NTNhOWMwZDM5OGQ1Mzc=
12
- data.tar.gz: !binary |-
13
- YWQ2M2U1ZjEzY2I0Yjg1YmE3NzY1ZTdlZTcxOTRkNzg1ZDMwNjJiYzhmZDcz
14
- MzMzMTQwNjNlMzU2NDYyNTM3N2U1NGU5OTNmNmI5YTJlYmRmZmJjNDFiZGEz
15
- MmNkMTI1ZTdiNDBhNTA2NmZkZTkzODllNjE3OTQ2NzY4MmRlNjY=
6
+ metadata.gz: a63d53dff9597d60eb173cbf14dd7e13f1364253211e41645ec59c643a370093ad86182d0f384ef0aea45cd36e8850a8632ac4fec5a38d3134989033e25a270c
7
+ data.tar.gz: 0d6f7403fed1cbb61018a54590d15c7ffe8bbe2ee1472778c9e70fff1151da58a9bcbc1270c0da28d825e5d817e9e51130af3bb779a0796163086241b695fcf2
data/README.md CHANGED
@@ -102,7 +102,7 @@ clients = Mpayer::Client.all
102
102
  client = Mpayer::Client.find(id) #Instantiates and hits the api
103
103
  client = Mpayer::Client.find(id, fetch:false) #Instantiates only
104
104
 
105
- client_attributes = {client: { client_name: "Kiki Lolo", client_birthday: Time.now.iso8601, client_type: "ext", ac_type: "cu",client_mobile: '0733222222', client_email: 'lolo@kiki.com',currency: "kes", mandate:"s", sub_type: "od" }}
105
+ client_attributes = {client: { client_name: "Kiki Lolo", client_birthday: Time.zone.now.iso8601, client_type: "ext", ac_type: "cu",client_mobile: '0733222222', client_email: 'lolo@kiki.com',currency: "kes", mandate:"s", sub_type: "od" }}
106
106
  client = Mpayer::Client.create(client_attributes)
107
107
 
108
108
  client = Mpayer::Client.find(id:20284,fetch:false).account(account_id) # Get clients account with id
@@ -125,7 +125,7 @@ account = Mpayer::Account.find(1, fetch:false) #Instantiates only
125
125
  account = Mpayer::Account.find(1, fetch:false)
126
126
  account.update(name:'Lolo Kiki')
127
127
 
128
- options = {from_date: Time.now - (86400*365),to_date:nil, dr_cr:nil, ac_type:nil, category:nil}
128
+ options = {from_date: Time.zone.now - (86400*365),to_date:nil, dr_cr:nil, ac_type:nil, category:nil}
129
129
  accounts = Mpayer::Account.aggregates(options)
130
130
 
131
131
  members = Mpayer::Account.find(25735, fetch:false).members
@@ -163,7 +163,7 @@ options = {
163
163
  client_id: client_id,
164
164
  status: status,
165
165
  payable_type: payable_type,
166
- due_date: Time.now+(86400*31),
166
+ due_date: Time.zone.now+(86400*31),
167
167
  pay: payable_items,
168
168
  tags: tags,
169
169
  flags: flags,
@@ -182,7 +182,7 @@ payable.destroy# Delete a payable
182
182
  ```ruby
183
183
  # Note: cr_party is the recieving (credited) account while dr_party is paying (debited) account
184
184
 
185
- transactions = Mpayer::Transaction.all(from: Time.now - (86400*400))
185
+ transactions = Mpayer::Transaction.all(from: Time.zone.now - (86400*400))
186
186
 
187
187
  transaction = Mpayer::Transaction.where(ref_id:"KT00410000402")# Only ref_id supported currently
188
188
 
@@ -1,11 +1,18 @@
1
1
  module Mpayer
2
2
  class Configuration
3
- attr_accessor :user_no, :token, :base_url
3
+ attr_accessor :user_no, :token, :base_url, :time_zone
4
4
 
5
- def initialize(user_no:nil,token:nil,base_url:'https://app.mpayer.co.ke/api/')
5
+ def initialize(user_no:nil,token:nil,time_zone:nil,base_url:'https://app.mpayer.co.ke/api/')
6
6
  @base_url ||= base_url
7
7
  @user_no ||= user_no
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 auth
@@ -16,5 +23,12 @@ module Mpayer
16
23
  {'Content-Type'=> 'application/json', 'Accept' => 'application/json', 'X-WSSE' => auth.to_s}
17
24
  end
18
25
 
26
+ private
27
+
28
+ def set_time_zone(tz = nil)
29
+ time_zone = tz || @time_zone || Time.zone || 'UTC'
30
+ Time.zone = time_zone unless time_zone.nil?
31
+ end
32
+
19
33
  end
20
34
  end
@@ -17,7 +17,7 @@ module Mpayer
17
17
  client = new(id:client_id,response:response)
18
18
  end
19
19
 
20
- # client_attributes = {client: { client_name: "Kiki Lolo", client_birthday: Time.now.iso8601, client_type: "ext", ac_type: "cu",client_mobile: '073373932', client_email: 'lolo@kiki.com',currency: "kes", mandate:"s", sub_type: "od" }}
20
+ # client_attributes = {client: { client_name: "Kiki Lolo", client_birthday: Time.zone.now.iso8601, client_type: "ext", ac_type: "cu",client_mobile: '073373932', client_email: 'lolo@kiki.com',currency: "kes", mandate:"s", sub_type: "od" }}
21
21
  # Mpayer::Client.create(client_attributes)
22
22
  def create(options={})
23
23
  url = "/clients"
@@ -3,7 +3,7 @@ module Mpayer
3
3
 
4
4
  class << self
5
5
 
6
- # Mpayer::Transaction.all(from: Time.now - (86400*400))
6
+ # Mpayer::Transaction.all(from: Time.zone.now - (86400*400))
7
7
  def all(page:1,per_page:100,from: nil,to: nil)
8
8
  url = "/transactions/all"
9
9
  from = from.strftime("%F %T") unless from.nil?
@@ -16,7 +16,7 @@ module Mpayer::TestHelper
16
16
  client_attributes = {
17
17
  client: {
18
18
  client_name: Faker::Name.name,
19
- client_birthday: Time.now.iso8601,
19
+ client_birthday: Time.zone.now.iso8601,
20
20
  client_type: "ext",
21
21
  ac_type: "cu",
22
22
  client_mobile: Faker::Number.number(10) ,
@@ -71,7 +71,7 @@ module Mpayer::TestHelper
71
71
  # client_id: client_id,
72
72
  # status: @model.status,
73
73
  # payable_type: @model.payable_type,
74
- due_date: Time.now+(86400*31),
74
+ due_date: Time.zone.now+(86400*31),
75
75
  pay: payable_items
76
76
  # tags:@tags,
77
77
  # flags:@flags,
@@ -102,7 +102,7 @@ module Mpayer::TestHelper
102
102
  end
103
103
 
104
104
  def get_mpayer_transactions
105
- @@get_mpayer_transactions ||= Mpayer::Transaction.all(from: Time.now - (86400*400))
105
+ @@get_mpayer_transactions ||= Mpayer::Transaction.all(from: Time.zone.now - (86400*400))
106
106
  @@get_mpayer_transactions.any? ? @@get_mpayer_transactions : [create_mpayer_transaction]
107
107
  end
108
108
  end
@@ -1,3 +1,3 @@
1
1
  module Mpayer
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
data/lib/mpayer_ruby.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "active_support/time"
1
2
  require "wsse"
2
3
  require "httparty"
3
4
  require "hashie"
data/mpayer_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 'wsse', "~> 0.0"
47
48
  spec.add_dependency 'hashie', "~> 3.4"
metadata CHANGED
@@ -1,249 +1,263 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpayer_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
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-07-25 00:00:00.000000000 Z
11
+ date: 2015-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.9'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: guard
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.12'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.12'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '5.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-minitest
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '2.4'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest-reporters
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0.10'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.10'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry-nav
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0.2'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0.2'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry-alias
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: coveralls
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: webmock
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.21'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ~>
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.21'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: sinatra
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ~>
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
173
  version: '1.4'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ~>
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: '1.4'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: faker
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ~>
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
187
  version: '1.4'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
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
198
212
  requirements:
199
- - - ~>
213
+ - - "~>"
200
214
  - !ruby/object:Gem::Version
201
215
  version: '0.13'
202
216
  type: :runtime
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
- - - ~>
220
+ - - "~>"
207
221
  - !ruby/object:Gem::Version
208
222
  version: '0.13'
209
223
  - !ruby/object:Gem::Dependency
210
224
  name: wsse
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
- - - ~>
227
+ - - "~>"
214
228
  - !ruby/object:Gem::Version
215
229
  version: '0.0'
216
230
  type: :runtime
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
- - - ~>
234
+ - - "~>"
221
235
  - !ruby/object:Gem::Version
222
236
  version: '0.0'
223
237
  - !ruby/object:Gem::Dependency
224
238
  name: hashie
225
239
  requirement: !ruby/object:Gem::Requirement
226
240
  requirements:
227
- - - ~>
241
+ - - "~>"
228
242
  - !ruby/object:Gem::Version
229
243
  version: '3.4'
230
244
  type: :runtime
231
245
  prerelease: false
232
246
  version_requirements: !ruby/object:Gem::Requirement
233
247
  requirements:
234
- - - ~>
248
+ - - "~>"
235
249
  - !ruby/object:Gem::Version
236
250
  version: '3.4'
237
- description: ! 'Interfaces with Mpayer payment gateway api '
251
+ description: 'Interfaces with Mpayer payment gateway api '
238
252
  email:
239
253
  - kgathi2@gmail.com
240
254
  executables: []
241
255
  extensions: []
242
256
  extra_rdoc_files: []
243
257
  files:
244
- - .coveralls.yml
245
- - .gitignore
246
- - .travis.yml
258
+ - ".coveralls.yml"
259
+ - ".gitignore"
260
+ - ".travis.yml"
247
261
  - CODE_OF_CONDUCT.md
248
262
  - Gemfile
249
263
  - Guardfile
@@ -281,17 +295,17 @@ require_paths:
281
295
  - lib
282
296
  required_ruby_version: !ruby/object:Gem::Requirement
283
297
  requirements:
284
- - - ~>
298
+ - - "~>"
285
299
  - !ruby/object:Gem::Version
286
300
  version: '2.0'
287
301
  required_rubygems_version: !ruby/object:Gem::Requirement
288
302
  requirements:
289
- - - ! '>='
303
+ - - ">="
290
304
  - !ruby/object:Gem::Version
291
305
  version: '0'
292
306
  requirements: []
293
307
  rubyforge_project:
294
- rubygems_version: 2.2.2
308
+ rubygems_version: 2.4.5
295
309
  signing_key:
296
310
  specification_version: 4
297
311
  summary: Ruby client for interfacing with http://app.mpayer.co.ke/api