payme 0.0.1 → 0.0.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/payme/config.rb CHANGED
@@ -30,7 +30,9 @@ module Payme
30
30
  end
31
31
 
32
32
  def yaml_default
33
- @config ||= symbolize_keys YAML::load(File.open(@@config_path))[@@config_env] unless @@config_path.nil? or @@config_env.nil?
33
+ if !@@config_path.nil? and !@@config_env.nil?
34
+ @config ||= symbolize_keys YAML::load(ERB.new(IO.read(File.join(@@config_path))).result)[@@config_env]
35
+ end
34
36
  end
35
37
 
36
38
  def symbolize_keys arg
data/lib/payme/errors.rb CHANGED
@@ -3,12 +3,5 @@ module Payme
3
3
 
4
4
  class MissingPath < RuntimeError; end
5
5
  class InvalidFieldsNumber < RuntimeError; end
6
- class ApiCall < RuntimeError
7
- attr_reader :code, :error
8
- def initialize(code, error)
9
- @code, @error = code, error
10
- super("The error code ##{code} occured when making the request - #{error}")
11
- end
12
- end
13
6
  end
14
7
  end
@@ -12,7 +12,6 @@ module Payme
12
12
  result = exec.split('!')
13
13
 
14
14
  raise Payme::Errors::MissingPath if result.empty? or (result[1].empty? && result[2].empty?)
15
- raise Payme::Errors::ApiCall.new(result[1], result[2]) unless result[1].to_i == 0
16
15
  result
17
16
  end
18
17
 
@@ -12,7 +12,6 @@ module Payme
12
12
  result = exec.split('!')
13
13
 
14
14
  raise Payme::Errors::MissingPath if result.empty? or (result[1].empty? && result[2].empty?)
15
- raise Payme::Errors::ApiCall.new(result[1], result[2]) unless result[1].to_i == 0
16
15
  parse_result result
17
16
  end
18
17
 
data/lib/payme.rb CHANGED
@@ -1,6 +1,11 @@
1
- require "rubygems"
2
- require "bundler"
3
- Bundler.setup
1
+ begin
2
+ require "rubygems"
3
+ require "bundler"
4
+ Bundler.setup
5
+ rescue Bundler::GemfileNotFound
6
+ # There is no gemfile for this project (rails 2.3 ?)
7
+ end
8
+
4
9
 
5
10
  require 'payme/config'
6
11
  require 'payme/errors'
data/payme.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{payme}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["LIM SAS", "Damien MATHIEU", "Julien SANCHEZ", "Herv\303\251 GAUCHER"]
12
- s.date = %q{2010-07-02}
12
+ s.date = %q{2010-07-07}
13
13
  s.description = %q{Need online payment?}
14
14
  s.email = %q{damien.mathieu@lim.eu}
15
15
  s.extra_rdoc_files = [
@@ -32,7 +32,6 @@ Gem::Specification.new do |s|
32
32
  "lib/payme/response.rb",
33
33
  "lib/payme/response/binary.rb",
34
34
  "payme.gemspec",
35
- "sogenactif.gemspec",
36
35
  "spec/fixtures/config.yml",
37
36
  "spec/payme/config_spec.rb",
38
37
  "spec/payme/request/binary_spec.rb",
@@ -1,2 +1,3 @@
1
1
  test:
2
- merchant_id: 123456789
2
+ merchant_id: '123456789'
3
+ bin_path: <%= '/tmp/test' %>
@@ -21,7 +21,12 @@ describe Payme::Config do
21
21
 
22
22
  it 'should load the appropriate config when defined' do
23
23
  Payme::Config.set_config('spec/fixtures/config.yml', 'test')
24
- Payme::Request.new(300).options[:merchant_id].should eql(123456789)
24
+ Payme::Request.new(300).options[:merchant_id].should eql('123456789')
25
+ end
26
+
27
+ it 'should execute erb' do
28
+ Payme::Config.set_config('spec/fixtures/config.yml', 'test')
29
+ Payme::Request.new(300).options[:bin_path].should eql('/tmp/test')
25
30
  end
26
31
  end
27
32
  end
@@ -20,14 +20,6 @@ describe Payme::RequestBinary do
20
20
  end.should raise_error Payme::Errors::MissingPath
21
21
  end
22
22
 
23
- it 'should raise an error' do
24
- request = Payme::Request.new(300)
25
- request.expects(:exec).once.returns('!15!My Error!')
26
- lambda do
27
- request.launch
28
- end.should raise_error Payme::Errors::ApiCall
29
- end
30
-
31
23
  it 'should return the form' do
32
24
  request = Payme::Request.new(300)
33
25
  request.expects(:exec).once.returns('!0!!Some Form')
@@ -19,14 +19,6 @@ describe Payme::ResponseBinary do
19
19
  end.should raise_error Payme::Errors::MissingPath
20
20
  end
21
21
 
22
- it 'should raise an error' do
23
- response = Payme::Response.new('testing')
24
- response.expects(:exec).once.returns('!15!My Error!')
25
- lambda do
26
- response.launch
27
- end.should raise_error Payme::Errors::ApiCall
28
- end
29
-
30
22
  it 'should not raise an error if the number of elements is not equal to the number of fields' do
31
23
  response = Payme::Response.new('testing')
32
24
  response.expects(:exec).once.returns('!0!!!!!')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payme
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - LIM SAS
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-07-02 00:00:00 +02:00
21
+ date: 2010-07-07 00:00:00 +02:00
22
22
  default_executable:
23
23
  dependencies: []
24
24
 
@@ -47,7 +47,6 @@ files:
47
47
  - lib/payme/response.rb
48
48
  - lib/payme/response/binary.rb
49
49
  - payme.gemspec
50
- - sogenactif.gemspec
51
50
  - spec/fixtures/config.yml
52
51
  - spec/payme/config_spec.rb
53
52
  - spec/payme/request/binary_spec.rb
data/sogenactif.gemspec DELETED
@@ -1,61 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{sogenactif}
8
- s.version = "0.0.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["LIM SAS", "Damien MATHIEU", "Julien SANCHEZ", "Herv\303\251 GAUCHER"]
12
- s.date = %q{2010-07-01}
13
- s.description = %q{Need online payment?}
14
- s.email = %q{damien.mathieu@lim.eu}
15
- s.extra_rdoc_files = [
16
- "README.md"
17
- ]
18
- s.files = [
19
- "Gemfile",
20
- "README.md",
21
- "Rakefile",
22
- "VERSION",
23
- "lib/sogenactif.rb",
24
- "lib/sogenactif/errors.rb",
25
- "lib/sogenactif/request.rb",
26
- "lib/sogenactif/request/binary.rb",
27
- "lib/sogenactif/request/params.rb",
28
- "lib/sogenactif/response.rb",
29
- "lib/sogenactif/response/binary.rb",
30
- "spec/sogenactif/request/binary_spec.rb",
31
- "spec/sogenactif/request/params_spec.rb",
32
- "spec/sogenactif/request_spec.rb",
33
- "spec/sogenactif/response/binary_spec.rb",
34
- "spec/sogenactif/response_spec.rb",
35
- "spec/spec_helper.rb"
36
- ]
37
- s.homepage = %q{http://github.com/LIMSAS/sogenactif}
38
- s.rdoc_options = ["--charset=UTF-8"]
39
- s.require_paths = ["lib"]
40
- s.rubygems_version = %q{1.3.7}
41
- s.summary = %q{Process online payments through the Sogenactif gateway}
42
- s.test_files = [
43
- "spec/sogenactif/request_spec.rb",
44
- "spec/sogenactif/response/binary_spec.rb",
45
- "spec/sogenactif/response_spec.rb",
46
- "spec/sogenactif/request/params_spec.rb",
47
- "spec/sogenactif/request/binary_spec.rb",
48
- "spec/spec_helper.rb"
49
- ]
50
-
51
- if s.respond_to? :specification_version then
52
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
53
- s.specification_version = 3
54
-
55
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
56
- else
57
- end
58
- else
59
- end
60
- end
61
-