moiper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +64 -0
- data/Rakefile +1 -0
- data/lib/moiper/cacert.pem +3895 -0
- data/lib/moiper/payment.rb +58 -0
- data/lib/moiper/request.rb +46 -0
- data/lib/moiper/response.rb +29 -0
- data/lib/moiper/version.rb +4 -0
- data/lib/moiper.rb +47 -0
- data/moiper.gemspec +22 -0
- data/spec/moiper/payment_spec.rb +108 -0
- data/spec/moiper/request_spec.rb +41 -0
- data/spec/moiper/response_spec.rb +78 -0
- data/spec/moiper_spec.rb +59 -0
- data/spec/spec_helper.rb +11 -0
- metadata +95 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Rodrigo Navarro
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Moiper
|
2
|
+
|
3
|
+
Moip payment service integration library.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'moiper'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install moiper
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
First, you need to set up your credentials:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Moiper.configure do |config|
|
25
|
+
config.token = "GJUXFM6H0CJX6WTELPH1QA9QG7JUFLTS"
|
26
|
+
config.key = "EBBH4ARIGMEP9JWAKC0YJZMDHNLSPZAOTFES5DJK"
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
By default, you will make requests to the Moip's production API. You can enable the sandbox environment by setting the `sandbox` configuration:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Moiper.configure do |config|
|
34
|
+
config.sandbox = true
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
To make a payment request:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
payment = Moiper::Payment.new(
|
42
|
+
:description => "A chair",
|
43
|
+
:price => 1.99,
|
44
|
+
:id => "some unique id",
|
45
|
+
:return_url => "http://example.org/thank_you",
|
46
|
+
:notification_url => "http://example.org/moip/notification"
|
47
|
+
)
|
48
|
+
|
49
|
+
response = payment.checkout
|
50
|
+
|
51
|
+
redirect_to response.checkout_url if payment.success?
|
52
|
+
```
|
53
|
+
|
54
|
+
## Disclaimer
|
55
|
+
|
56
|
+
This gem is being developed in a workshop-like manner, during the trainee training program at Tagview, so the students can understand concepts such as open source development, TDD, API integration and documentation.
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
1. Fork it
|
61
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
62
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
63
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
64
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|