webmoney 0.0.4.4 → 0.0.4.5

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.
data/ChangeLog CHANGED
@@ -1,5 +1,12 @@
1
1
  ChangeLog
2
2
 
3
+ Thu Jun 11 2009 13:05:00 + 0400
4
+ ----------------------------
5
+ V 0.0.4.5
6
+ * Fix unexistent WMID passport request error
7
+ * Fix zero microsecounds error in reqn()
8
+
9
+
3
10
  Sun Mar 15 2009 14:55:18 +0400
4
11
  ----------------------------
5
12
  V 0.0.4.4
data/lib/passport.rb CHANGED
@@ -10,6 +10,7 @@ class Webmoney
10
10
  root = doc.at('/response')
11
11
  if root && root['retval'] && root['retval'].to_i == 0
12
12
  super(doc.at('/response/certinfo')['wmid'])
13
+ raise NonExistentWmidError unless doc.at('/response/certinfo/attestat')
13
14
  tid = doc.at('/response/certinfo/attestat/row')['tid'].to_i
14
15
  recalled = doc.at('/response/certinfo/attestat/row')['recalled'].to_i
15
16
  locked = doc.at('/response/certinfo/userinfo/value/row')['locked'].to_i
data/lib/webmoney.rb CHANGED
@@ -32,9 +32,11 @@ class Webmoney
32
32
  class RequestError < WebmoneyError; end
33
33
  class ResultError < WebmoneyError; end
34
34
  class IncorrectWmidError < WebmoneyError; end
35
+ class NonExistentWmidError < WebmoneyError; end
35
36
  class CaCertificateError < WebmoneyError; end
36
37
 
37
38
  attr_reader :wmid, :error, :errormsg, :last_request, :messenger
39
+ attr_accessor :interfaces
38
40
 
39
41
  # Required options:
40
42
  #
@@ -191,7 +193,8 @@ class Webmoney
191
193
  # return 16 digits string
192
194
  def reqn
193
195
  t = Time.now
194
- t.strftime('%Y%m%d%H%M%S') + t.to_f.to_s.match(/\.(\d\d)/)[1]
196
+ msec = t.to_f.to_s.match(/\.(\d\d)/)[1] rescue '00'
197
+ t.strftime('%Y%m%d%H%M%S') + msec
195
198
  end
196
199
 
197
200
  def make_xml(iface, opt) # :nodoc:
data/rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/clean'
4
4
  require 'tools/rakehelp'
5
5
  require 'spec/rake/spectask'
6
6
 
7
- GEM_VERSION="0.0.4.4"
7
+ GEM_VERSION="0.0.4.5"
8
8
 
9
9
  setup_extension('wmsigner', 'wmsigner')
10
10
 
@@ -24,6 +24,16 @@ class Webmoney
24
24
  (t2 > t1).should be_true
25
25
  end
26
26
 
27
+ it "should correct reqn" do
28
+ Time.stub!(:now).and_return(Time.at(1244704683.69677))
29
+ @wm.send(:reqn).should == '2009061111180369'
30
+ end
31
+
32
+ it "should correct reqn with zero microsec" do
33
+ Time.stub!(:now).and_return(Time.at(1244704683))
34
+ @wm.send(:reqn).should == '2009061111180300'
35
+ end
36
+
27
37
  it "should raise error on incorrect arg" do
28
38
  lambda { @wm.send(:request, :check_sign, 1) }.
29
39
  should raise_error(ArgumentError)
@@ -89,6 +99,14 @@ class Webmoney
89
99
  @wm.request(:get_passport, :wmid => @wm.wmid).should be_instance_of(Passport)
90
100
  end
91
101
 
102
+ it "should raise exception on bad WMID" do
103
+ lambda {@wm.request(:get_passport, :wmid => '111')}.should raise_error(Webmoney::ResultError)
104
+ end
105
+
106
+ it "should raise exception on non existent WMID" do
107
+ lambda {@wm.request(:get_passport, :wmid => '012345678901')}.should raise_error(Webmoney::NonExistentWmidError)
108
+ end
109
+
92
110
  it "should return correct BL" do
93
111
  wmid = '370860915669'
94
112
  @wm.request(:bussines_level, :wmid => wmid).should == 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmoney
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.4
4
+ version: 0.0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Oryol
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-15 00:00:00 +03:00
12
+ date: 2009-08-12 00:00:00 +04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -71,6 +71,8 @@ files:
71
71
  - tools/rakehelp.rb
72
72
  has_rdoc: true
73
73
  homepage: http://github.com/eagleas/webmoney
74
+ licenses: []
75
+
74
76
  post_install_message:
75
77
  rdoc_options: []
76
78
 
@@ -91,9 +93,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
93
  requirements: []
92
94
 
93
95
  rubyforge_project: webmoney
94
- rubygems_version: 1.3.1
96
+ rubygems_version: 1.3.4
95
97
  signing_key:
96
- specification_version: 2
98
+ specification_version: 3
97
99
  summary: Webmoney interfaces and native wmsigner
98
100
  test_files:
99
101
  - spec/spec_helper.rb