pesapal 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v1.5.4
5
+ ------
6
+
7
+ * Renamed repo from `pesapal-rubygem` to `pesapal-gem` (breaks badge links in old READMEs)
8
+ * Write tests
9
+
4
10
  v1.5.3
5
11
  ------
6
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pesapal (1.5.2)
4
+ pesapal (1.5.3)
5
5
  htmlentities
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -2,8 +2,9 @@ Pesapal RubyGem
2
2
  ===============
3
3
 
4
4
  <a href="http://badge.fury.io/rb/pesapal"><img src="https://badge.fury.io/rb/pesapal@2x.png" alt="Gem Version" height="18"></a>
5
- [![Build Status](https://travis-ci.org/itsmrwave/pesapal-rubygem.png?branch=master)](https://travis-ci.org/itsmrwave/pesapal-rubygem)
6
- [![Dependency Status](https://gemnasium.com/itsmrwave/pesapal-rubygem.png)](https://gemnasium.com/itsmrwave/pesapal-rubygem)
5
+ [![Build Status](https://travis-ci.org/itsmrwave/pesapal-gem.png?branch=master)](https://travis-ci.org/itsmrwave/pesapal-gem)
6
+ [![Code Climate](https://codeclimate.com/github/itsmrwave/pesapal-gem.png)](https://codeclimate.com/github/itsmrwave/pesapal-gem)
7
+ [![Dependency Status](https://gemnasium.com/itsmrwave/pesapal-gem.png)](https://gemnasium.com/itsmrwave/pesapal-gem)
7
8
 
8
9
 
9
10
  Make authenticated Pesapal API calls without the fuss! Handles all the [oAuth
@@ -276,19 +277,19 @@ they want as long as they provide attribution and waive liability.
276
277
  [3]: http://guides.rubygems.org/make-your-own-gem/
277
278
  [4]: http://developer.pesapal.com/how-to-integrate/api-reference
278
279
  [5]: https://github.com/itsmrwave/pesapal-php#pesapal-php-api-reference-unofficial
279
- [6]: https://github.com/itsmrwave/pesapal-rubygem/issues
280
+ [6]: https://github.com/itsmrwave/pesapal-gem/issues
280
281
  [7]: http://rubygems.org/gems/pesapal
281
- [8]: https://github.com/itsmrwave/pesapal-rubygem/fork
282
- [9]: https://github.com/itsmrwave/pesapal-rubygem#contributing
282
+ [8]: https://github.com/itsmrwave/pesapal-gem/fork
283
+ [9]: https://github.com/itsmrwave/pesapal-gem#contributing
283
284
  [10]: http://kingori.co/
284
- [11]: https://github.com/itsmrwave/pesapal-rubygem/blob/master/LICENSE.txt
285
- [12]: https://github.com/itsmrwave/pesapal-rubygem/releases/
285
+ [11]: https://github.com/itsmrwave/pesapal-gem/blob/master/LICENSE.txt
286
+ [12]: https://github.com/itsmrwave/pesapal-gem/releases/
286
287
  [13]: http://rubydoc.info/gems/pesapal/
287
288
  [14]: https://github.com/itsmrwave/mo
288
289
  [15]: https://github.com/itsmrwave/mo/tree/master/convention#-convention
289
290
  [16]: http://kingori.co/articles/2013/09/modus-operandi/
290
- [17]: https://github.com/itsmrwave/pesapal-rubygem/pulls
291
+ [17]: https://github.com/itsmrwave/pesapal-gem/pulls
291
292
  [18]: http://developer.pesapal.com/how-to-integrate/step-by-step
292
- [19]: https://github.com/itsmrwave/pesapal-rubygem/graphs/contributors
293
+ [19]: https://github.com/itsmrwave/pesapal-gem/graphs/contributors
293
294
  [20]: http://guides.rubyonrails.org/
294
- [21]: https://github.com/itsmrwave/pesapal-rubygem/blob/master/CHANGELOG.md#changelog
295
+ [21]: https://github.com/itsmrwave/pesapal-gem/blob/master/CHANGELOG.md#changelog
@@ -163,6 +163,8 @@ module Pesapal
163
163
  @api_endpoints[:postpesapaldirectorderv4] = "#{@api_domain}/API/PostPesapalDirectOrderV4"
164
164
  @api_endpoints[:querypaymentstatus] = "#{@api_domain}/API/QueryPaymentStatus"
165
165
  @api_endpoints[:querypaymentdetails] = "#{@api_domain}/API/QueryPaymentDetails"
166
+
167
+ return @api_endpoints
166
168
  end
167
169
 
168
170
  # set credentialts through hash, uses default if nothing is input
@@ -1,3 +1,3 @@
1
1
  module Pesapal
2
- VERSION = '1.5.3'
2
+ VERSION = '1.5.4'
3
3
  end
@@ -2,45 +2,135 @@ require 'spec_helper'
2
2
 
3
3
  describe Pesapal::Merchant do
4
4
 
5
- before :each do
6
- @pesapal = Pesapal::Merchant.new
7
- @pesapal_dev = Pesapal::Merchant.new(:development)
8
- @pesapal_prod = Pesapal::Merchant.new(:production)
5
+ context 'when mode not specified' do
6
+
7
+ before :each do
8
+ @pesapal = Pesapal::Merchant.new
9
+ end
10
+
11
+ describe '#new' do
12
+
13
+ it 'is valid object' do
14
+ expect(@pesapal).to be_an_instance_of(Pesapal::Merchant)
15
+ end
16
+
17
+ it 'sets default environment variable' do
18
+ expect(@pesapal.send(:env)).to eq 'development'
19
+ end
20
+
21
+ it 'sets default credentials' do
22
+ expect(@pesapal.config).to eq({ :callback_url => 'http://0.0.0.0:3000/pesapal/callback',
23
+ :consumer_key => '<YOUR_CONSUMER_KEY>',
24
+ :consumer_secret => '<YOUR_CONSUMER_SECRET>'
25
+ })
26
+ end
27
+
28
+ it 'sets default order details' do
29
+ expect(@pesapal.order_details).to eq({})
30
+ end
31
+ end
32
+
33
+ describe '#set_env' do
34
+
35
+ it 'sets default environment variable' do
36
+ @pesapal.set_env
37
+ expect(@pesapal.send(:env)).to eq 'development'
38
+ end
39
+
40
+ it 'sets endpoints for default environment' do
41
+ expect(@pesapal.set_env).to eq({:postpesapaldirectorderv4 => 'http://demo.pesapal.com/API/PostPesapalDirectOrderV4',
42
+ :querypaymentstatus=>'http://demo.pesapal.com/API/QueryPaymentStatus',
43
+ :querypaymentdetails=>'http://demo.pesapal.com/API/QueryPaymentDetails'
44
+ })
45
+ end
46
+ end
9
47
  end
10
48
 
11
- describe '#new' do
49
+ context 'when mode is specified as development' do
12
50
 
13
- it 'sets default environment variable' do
14
- @pesapal.send(:env).should == 'development'
15
- @pesapal.send(:env).should_not == 'production'
51
+ before :each do
52
+ @pesapal = Pesapal::Merchant.new(:development)
16
53
  end
17
54
 
18
- it 'sets development environment variable' do
19
- @pesapal_dev.send(:env).should == 'development'
20
- @pesapal_dev.send(:env).should_not == 'production'
55
+ describe '#new(:development)' do
56
+
57
+ it 'is valid object' do
58
+ expect(@pesapal).to be_an_instance_of(Pesapal::Merchant)
59
+ end
60
+
61
+ it 'sets environment variable' do
62
+ expect(@pesapal.send(:env)).to eq 'development'
63
+ end
64
+
65
+ it 'sets credentials' do
66
+ expect(@pesapal.config).to eq({ :callback_url => 'http://0.0.0.0:3000/pesapal/callback',
67
+ :consumer_key => '<YOUR_CONSUMER_KEY>',
68
+ :consumer_secret => '<YOUR_CONSUMER_SECRET>'
69
+ })
70
+ end
71
+
72
+ it 'sets order details' do
73
+ expect(@pesapal.order_details).to eq({})
74
+ end
21
75
  end
22
76
 
23
- it 'sets production environment variable' do
24
- @pesapal_prod.send(:env).should == 'production'
25
- @pesapal_prod.send(:env).should_not == 'development'
77
+ describe '#set_env(:development)' do
78
+
79
+ it 'sets environment variable' do
80
+ @pesapal.set_env :development
81
+ expect(@pesapal.send(:env)).to eq 'development'
82
+ end
83
+
84
+ it 'sets endpoints for environment' do
85
+ expect(@pesapal.set_env :development).to eq({:postpesapaldirectorderv4 => 'http://demo.pesapal.com/API/PostPesapalDirectOrderV4',
86
+ :querypaymentstatus=>'http://demo.pesapal.com/API/QueryPaymentStatus',
87
+ :querypaymentdetails=>'http://demo.pesapal.com/API/QueryPaymentDetails'
88
+ })
89
+ end
26
90
  end
91
+ end
92
+
93
+ context 'when mode is specified as production' do
27
94
 
28
- # Check if the initializer successfully sets a Pesapal::Merchant object
29
- it 'returns a new instance of a pesapal object' do
30
- @pesapal.should be_an_instance_of Pesapal::Merchant
95
+ before :each do
96
+ @pesapal = Pesapal::Merchant.new(:production)
31
97
  end
32
98
 
33
- # Checks if the initialized object is properly set with default credentials
34
- it 'checks if config is set with the default credentials' do
35
- @pesapal.config.should == { :callback_url => 'http://0.0.0.0:3000/pesapal/callback',
36
- :consumer_key => '<YOUR_CONSUMER_KEY>',
37
- :consumer_secret => '<YOUR_CONSUMER_SECRET>'
38
- }
99
+ describe '#new(:production)' do
100
+
101
+ it 'is valid object' do
102
+ expect(@pesapal).to be_an_instance_of(Pesapal::Merchant)
103
+ end
104
+
105
+ it 'sets environment variable' do
106
+ expect(@pesapal.send(:env)).to eq 'production'
107
+ end
108
+
109
+ it 'sets credentials' do
110
+ expect(@pesapal.config).to eq({ :callback_url => 'http://0.0.0.0:3000/pesapal/callback',
111
+ :consumer_key => '<YOUR_CONSUMER_KEY>',
112
+ :consumer_secret => '<YOUR_CONSUMER_SECRET>'
113
+ })
114
+ end
115
+
116
+ it 'sets order details' do
117
+ expect(@pesapal.order_details).to eq({})
118
+ end
39
119
  end
40
120
 
41
- # Checks if the initialized object is properly set with empty order details
42
- it 'checks if config is set with the default credentials' do
43
- @pesapal.order_details.should == {}
121
+ describe '#set_env(:production)' do
122
+
123
+ it 'sets environment variable' do
124
+ @pesapal.set_env :production
125
+ expect(@pesapal.send(:env)).to eq 'production'
126
+ end
127
+
128
+ it 'sets endpoints for environment' do
129
+ expect(@pesapal.set_env :production).to eq({:postpesapaldirectorderv4 => 'https://www.pesapal.com/API/PostPesapalDirectOrderV4',
130
+ :querypaymentstatus=>'https://www.pesapal.com/API/QueryPaymentStatus',
131
+ :querypaymentdetails=>'https://www.pesapal.com/API/QueryPaymentDetails'
132
+ })
133
+ end
44
134
  end
45
135
  end
46
136
  end
data/spec/spec_helper.rb CHANGED
@@ -1 +1,7 @@
1
1
  require_relative '../lib/pesapal'
2
+
3
+ RSpec.configure do |config|
4
+ config.expect_with :rspec do |c|
5
+ c.syntax = :expect
6
+ end
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pesapal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-03 00:00:00.000000000 Z
12
+ date: 2014-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -83,6 +83,7 @@ extensions: []
83
83
  extra_rdoc_files: []
84
84
  files:
85
85
  - .gitignore
86
+ - .rspec
86
87
  - .travis.yml
87
88
  - CHANGELOG.md
88
89
  - Gemfile