global_collect 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY ADDED
@@ -0,0 +1,11 @@
1
+ v0.1.1 (2010-04-28)
2
+ ===================
3
+ * Bug fixes
4
+ * GlobalCollect::Const::PaymentStatus.from_sym was broken (added tests too)
5
+ * Added fakeweb as a development dependency
6
+ * Added history (this doc)
7
+
8
+ v0.1.0 (2010-04-27)
9
+ ===================
10
+ * First publication
11
+ * basic features for Hosted MerchantLink usage.
data/Rakefile CHANGED
@@ -24,9 +24,11 @@ END
24
24
  gemspec.email = "timon.karnezos@gmail.com"
25
25
  gemspec.homepage = "http://github.com/timonk/global_collect"
26
26
  gemspec.authors = ["Timon Karnezos"]
27
- gemspec.version = "0.1.0"
27
+ gemspec.version = "0.1.1"
28
28
  gemspec.add_dependency('httparty', '>= 0.5.2')
29
29
  gemspec.add_dependency('builder', '>= 2.0')
30
+
31
+ gemspec.add_development_dependency('fakeweb', '>= 1.2.8')
30
32
  end
31
33
  rescue LoadError
32
34
  warn "Jeweler not available. Install it with:"
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{global_collect}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Timon Karnezos"]
12
- s.date = %q{2010-04-27}
12
+ s.date = %q{2010-04-28}
13
13
  s.description = %q{Gives minimally intrusive access to Global Collect's payment processing API.
14
14
  Currently implements a very small segment of the full API but is built with
15
15
  extensibility in mind.
@@ -20,6 +20,7 @@ extensibility in mind.
20
20
  ]
21
21
  s.files = [
22
22
  "COPYING",
23
+ "HISTORY",
23
24
  "README.markdown",
24
25
  "Rakefile",
25
26
  "VERSION",
@@ -78,6 +79,8 @@ extensibility in mind.
78
79
  "spec/builders/insert_order_with_payment/order_spec.rb",
79
80
  "spec/builders/insert_order_with_payment/payment_spec.rb",
80
81
  "spec/builders/set_payment/payment_spec.rb",
82
+ "spec/const/payment_product_spec.rb",
83
+ "spec/const/payment_status_spec.rb",
81
84
  "spec/field_validator_spec.rb",
82
85
  "spec/global_collect_spec.rb",
83
86
  "spec/request_models/base_spec.rb",
@@ -123,6 +126,8 @@ extensibility in mind.
123
126
  "spec/builders/insert_order_with_payment/order_spec.rb",
124
127
  "spec/builders/insert_order_with_payment/payment_spec.rb",
125
128
  "spec/builders/set_payment/payment_spec.rb",
129
+ "spec/const/payment_product_spec.rb",
130
+ "spec/const/payment_status_spec.rb",
126
131
  "spec/field_validator_spec.rb",
127
132
  "spec/global_collect_spec.rb",
128
133
  "spec/request_models/base_spec.rb",
@@ -158,13 +163,16 @@ extensibility in mind.
158
163
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
159
164
  s.add_runtime_dependency(%q<httparty>, [">= 0.5.2"])
160
165
  s.add_runtime_dependency(%q<builder>, [">= 2.0"])
166
+ s.add_development_dependency(%q<fakeweb>, [">= 1.2.8"])
161
167
  else
162
168
  s.add_dependency(%q<httparty>, [">= 0.5.2"])
163
169
  s.add_dependency(%q<builder>, [">= 2.0"])
170
+ s.add_dependency(%q<fakeweb>, [">= 1.2.8"])
164
171
  end
165
172
  else
166
173
  s.add_dependency(%q<httparty>, [">= 0.5.2"])
167
174
  s.add_dependency(%q<builder>, [">= 2.0"])
175
+ s.add_dependency(%q<fakeweb>, [">= 1.2.8"])
168
176
  end
169
177
  end
170
178
 
@@ -1,17 +1,20 @@
1
1
  module GlobalCollect::Const
2
2
  module PaymentStatus
3
3
  def self.from_code(code)
4
- code = code.to_i
5
- raise ArgumentError.new("Invalid payment status code!") unless STATUSES.key?(code)
6
- Status.new(code, *STATUSES[code])
4
+ info(code.to_i)
7
5
  end
8
6
 
9
7
  def self.from_name(name)
10
8
  code, strings = STATUSES.detect{|k,v| v.first == name }
11
- status(code) if code
9
+ info(code) if code
12
10
  end
13
11
 
14
12
  private
13
+
14
+ def self.info(code)
15
+ raise ArgumentError.new("Invalid payment status code!") unless STATUSES.key?(code)
16
+ Status.new(code, *STATUSES[code])
17
+ end
15
18
 
16
19
  STATUSES = {
17
20
  0 => ["CREATED" , "The payment attempt was created." ],
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'the payment product constants' do
4
+ it "should fetch a product by sym" do
5
+ visa = GlobalCollect::Const::PaymentProduct.from_sym(:visa)
6
+ visa.should_not be_nil
7
+ visa.symbol.should be(:visa)
8
+ visa.code.should be(1)
9
+ end
10
+
11
+ it "should fetch a product by code" do
12
+ visa = GlobalCollect::Const::PaymentProduct.from_code("1")
13
+ visa.should_not be_nil
14
+ visa.symbol.should be(:visa)
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'the payment status constants' do
4
+ it "should fetch a status by name" do
5
+ status = GlobalCollect::Const::PaymentStatus.from_name("READY")
6
+ status.should_not be_nil
7
+ status.code.should be(800)
8
+ end
9
+
10
+ it "should fetch a product by code" do
11
+ status = GlobalCollect::Const::PaymentStatus.from_code(800)
12
+ status.should_not be_nil
13
+ status.name.should == "READY"
14
+ end
15
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Timon Karnezos
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-27 00:00:00 -07:00
17
+ date: 2010-04-28 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -44,6 +44,20 @@ dependencies:
44
44
  version: "2.0"
45
45
  type: :runtime
46
46
  version_requirements: *id002
47
+ - !ruby/object:Gem::Dependency
48
+ name: fakeweb
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 1
56
+ - 2
57
+ - 8
58
+ version: 1.2.8
59
+ type: :development
60
+ version_requirements: *id003
47
61
  description: |
48
62
  Gives minimally intrusive access to Global Collect's payment processing API.
49
63
  Currently implements a very small segment of the full API but is built with
@@ -58,6 +72,7 @@ extra_rdoc_files:
58
72
  - README.markdown
59
73
  files:
60
74
  - COPYING
75
+ - HISTORY
61
76
  - README.markdown
62
77
  - Rakefile
63
78
  - VERSION
@@ -116,6 +131,8 @@ files:
116
131
  - spec/builders/insert_order_with_payment/order_spec.rb
117
132
  - spec/builders/insert_order_with_payment/payment_spec.rb
118
133
  - spec/builders/set_payment/payment_spec.rb
134
+ - spec/const/payment_product_spec.rb
135
+ - spec/const/payment_status_spec.rb
119
136
  - spec/field_validator_spec.rb
120
137
  - spec/global_collect_spec.rb
121
138
  - spec/request_models/base_spec.rb
@@ -185,6 +202,8 @@ test_files:
185
202
  - spec/builders/insert_order_with_payment/order_spec.rb
186
203
  - spec/builders/insert_order_with_payment/payment_spec.rb
187
204
  - spec/builders/set_payment/payment_spec.rb
205
+ - spec/const/payment_product_spec.rb
206
+ - spec/const/payment_status_spec.rb
188
207
  - spec/field_validator_spec.rb
189
208
  - spec/global_collect_spec.rb
190
209
  - spec/request_models/base_spec.rb