mymoip 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +7 -0
- data/CHANGELOG.md +9 -1
- data/Gemfile +12 -14
- data/Gemfile.lock +13 -13
- data/README.md +17 -4
- data/VERSION +1 -1
- data/lib/mymoip.rb +21 -1
- data/mymoip.gemspec +7 -6
- data/test/helper.rb +2 -1
- data/test/live_test.rb +2 -2
- data/test/test_mymoip.rb +43 -18
- metadata +9 -8
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
0.4.1
|
5
|
+
-----
|
6
|
+
|
7
|
+
* Simultaneous setters for sandbox and production token/keys.
|
8
|
+
* DEPRECATE MyMoip.key and MyMoip.token methods over new environment specific setters.
|
9
|
+
* Going alive instructions added to README file.
|
10
|
+
* Add reference to new my_moip-rails gem.
|
11
|
+
|
4
12
|
0.4.0
|
5
13
|
-----
|
6
14
|
|
@@ -45,7 +53,7 @@ New validations:
|
|
45
53
|
0.2.6
|
46
54
|
-----
|
47
55
|
|
48
|
-
*
|
56
|
+
* DEPRECATE owner_rg attribute of MyMoip::CreditCard; you should provide a owner_cpf from now on. Should explain issues with Visa's risk analysis.
|
49
57
|
|
50
58
|
0.2.5
|
51
59
|
-----
|
data/Gemfile
CHANGED
@@ -1,23 +1,21 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
|
-
# gem
|
4
|
+
# gem 'activesupport', '>= 2.3.5'
|
5
5
|
|
6
6
|
# Add dependencies to develop your gem here.
|
7
7
|
# Include everything needed to run rake, tests, features, etc.
|
8
8
|
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
9
|
+
gem 'builder'
|
10
|
+
gem 'httparty'
|
11
|
+
gem 'activemodel'
|
12
12
|
|
13
13
|
group :development do
|
14
|
-
gem
|
15
|
-
gem
|
16
|
-
gem
|
17
|
-
gem
|
18
|
-
gem
|
19
|
-
gem
|
20
|
-
|
21
|
-
# Can be removed after merge of https://github.com/vcr/vcr/commit/f75353b75e1ac1e4309faa9323e7c01d8ce28e46
|
22
|
-
gem "webmock", "< 1.9.0"
|
14
|
+
gem 'rdoc', '~> 3.12'
|
15
|
+
gem 'bundler', '>= 0'
|
16
|
+
gem 'jeweler', '~> 1.8.4'
|
17
|
+
gem 'turn'
|
18
|
+
gem 'mocha', require: false
|
19
|
+
gem 'vcr'
|
20
|
+
gem 'webmock'
|
23
21
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.2.
|
5
|
-
activesupport (= 3.2.
|
4
|
+
activemodel (3.2.11)
|
5
|
+
activesupport (= 3.2.11)
|
6
6
|
builder (~> 3.0.0)
|
7
|
-
activesupport (3.2.
|
7
|
+
activesupport (3.2.11)
|
8
8
|
i18n (~> 0.6)
|
9
9
|
multi_json (~> 1.0)
|
10
10
|
addressable (2.3.2)
|
11
11
|
ansi (1.4.3)
|
12
12
|
builder (3.0.4)
|
13
|
-
crack (0.3.
|
13
|
+
crack (0.3.2)
|
14
14
|
git (1.2.5)
|
15
|
-
httparty (0.
|
15
|
+
httparty (0.10.0)
|
16
16
|
multi_json (~> 1.0)
|
17
17
|
multi_xml
|
18
18
|
i18n (0.6.1)
|
@@ -21,19 +21,19 @@ GEM
|
|
21
21
|
git (>= 1.2.5)
|
22
22
|
rake
|
23
23
|
rdoc
|
24
|
-
json (1.7.
|
24
|
+
json (1.7.6)
|
25
25
|
metaclass (0.0.1)
|
26
|
-
mocha (0.13.
|
26
|
+
mocha (0.13.1)
|
27
27
|
metaclass (~> 0.0.1)
|
28
|
-
multi_json (1.
|
29
|
-
multi_xml (0.5.
|
30
|
-
rake (10.0.
|
28
|
+
multi_json (1.5.0)
|
29
|
+
multi_xml (0.5.2)
|
30
|
+
rake (10.0.3)
|
31
31
|
rdoc (3.12)
|
32
32
|
json (~> 1.4)
|
33
33
|
turn (0.9.6)
|
34
34
|
ansi
|
35
|
-
vcr (2.
|
36
|
-
webmock (1.
|
35
|
+
vcr (2.4.0)
|
36
|
+
webmock (1.9.0)
|
37
37
|
addressable (>= 2.2.7)
|
38
38
|
crack (>= 0.1.7)
|
39
39
|
|
@@ -50,4 +50,4 @@ DEPENDENCIES
|
|
50
50
|
rdoc (~> 3.12)
|
51
51
|
turn
|
52
52
|
vcr
|
53
|
-
webmock
|
53
|
+
webmock
|
data/README.md
CHANGED
@@ -5,10 +5,14 @@ MoIP transactions in a gem to call your own.
|
|
5
5
|
|
6
6
|
Provides a implementation of MoIP's transparent checkout.
|
7
7
|
|
8
|
+
Planning to use with Rails? Check [my_moip-rails](https://github.com/Irio/my_moip-rails).
|
9
|
+
|
8
10
|
Contributing to MyMoip
|
9
11
|
----------------------
|
10
12
|
|
11
13
|
[![Build Status](https://secure.travis-ci.org/Irio/mymoip.png)](http://travis-ci.org/Irio/mymoip)
|
14
|
+
[![Dependency Status](https://gemnasium.com/Irio/mymoip.png)](https://gemnasium.com/Irio/mymoip)
|
15
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/Irio/mymoip)
|
12
16
|
|
13
17
|
What would you do if you could make your own implementation of MoIP?
|
14
18
|
|
@@ -29,9 +33,13 @@ gem 'mymoip'
|
|
29
33
|
|
30
34
|
**Configuration**
|
31
35
|
```ruby
|
32
|
-
MyMoip.environment = "production" #
|
33
|
-
|
34
|
-
MyMoip.
|
36
|
+
MyMoip.environment = "production" # "sandbox" by default
|
37
|
+
|
38
|
+
MyMoip.sandbox_token = "your_moip_sandbox_token"
|
39
|
+
MyMoip.sandbox_key = "your_moip_sandbox_key"
|
40
|
+
|
41
|
+
MyMoip.production_token = "your_moip_production_token"
|
42
|
+
MyMoip.production_key = "your_moip_production_key"
|
35
43
|
```
|
36
44
|
|
37
45
|
**First request: what and from who**
|
@@ -121,7 +129,12 @@ instruction = MyMoip::Instruction.new(
|
|
121
129
|
Documentation
|
122
130
|
-------------
|
123
131
|
|
124
|
-
For more information you can access the [wiki page](https://github.com/Irio/mymoip/wiki).
|
132
|
+
For more information about usage you can access the [wiki page](https://github.com/Irio/mymoip/wiki).
|
133
|
+
|
134
|
+
Going alive!
|
135
|
+
------------
|
136
|
+
|
137
|
+
If you are ready to get your application using MyMoip approved by MoIP or already have valid production keys, you can read a specific [documentation](https://github.com/Irio/mymoip/wiki/Going-alive).
|
125
138
|
|
126
139
|
License
|
127
140
|
-------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/mymoip.rb
CHANGED
@@ -6,7 +6,9 @@ require 'json'
|
|
6
6
|
|
7
7
|
module MyMoip
|
8
8
|
class << self
|
9
|
-
attr_accessor :
|
9
|
+
attr_accessor :production_key, :production_token,
|
10
|
+
:sandbox_key, :sandbox_token,
|
11
|
+
:environment, :logger, :default_referer_url
|
10
12
|
|
11
13
|
def api_url
|
12
14
|
if environment == "sandbox"
|
@@ -15,6 +17,24 @@ module MyMoip
|
|
15
17
|
"https://www.moip.com.br"
|
16
18
|
end
|
17
19
|
end
|
20
|
+
|
21
|
+
def key=(value)
|
22
|
+
warn "[DEPRECATION] `key=` is deprecated. Please use `sandbox_key` or `production_key` instead."
|
23
|
+
@production_key = @sandbox_key = value
|
24
|
+
end
|
25
|
+
|
26
|
+
def token=(value)
|
27
|
+
warn "[DEPRECATION] `token=` is deprecated. Please use `sandbox_token` or `production_token` instead."
|
28
|
+
@production_token = @sandbox_token = value
|
29
|
+
end
|
30
|
+
|
31
|
+
def key
|
32
|
+
send(:"#{environment}_key")
|
33
|
+
end
|
34
|
+
|
35
|
+
def token
|
36
|
+
send(:"#{environment}_token")
|
37
|
+
end
|
18
38
|
end
|
19
39
|
end
|
20
40
|
|
data/mymoip.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "mymoip"
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Irio Irineu Musskopf Junior"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-01-11"
|
13
13
|
s.description = "Provides a implementation of MoIP's transparent checkout."
|
14
14
|
s.email = "irio.musskopf@caixadeideias.com.br"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
+
".travis.yml",
|
21
22
|
"CHANGELOG.md",
|
22
23
|
"Gemfile",
|
23
24
|
"Gemfile.lock",
|
@@ -57,7 +58,7 @@ Gem::Specification.new do |s|
|
|
57
58
|
s.homepage = "http://github.com/Irio/mymoip"
|
58
59
|
s.licenses = ["MIT"]
|
59
60
|
s.require_paths = ["lib"]
|
60
|
-
s.rubygems_version = "1.8.
|
61
|
+
s.rubygems_version = "1.8.23"
|
61
62
|
s.summary = "MoIP transactions in a gem to call your own."
|
62
63
|
|
63
64
|
if s.respond_to? :specification_version then
|
@@ -73,7 +74,7 @@ Gem::Specification.new do |s|
|
|
73
74
|
s.add_development_dependency(%q<turn>, [">= 0"])
|
74
75
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
75
76
|
s.add_development_dependency(%q<vcr>, [">= 0"])
|
76
|
-
s.add_development_dependency(%q<webmock>, ["
|
77
|
+
s.add_development_dependency(%q<webmock>, [">= 0"])
|
77
78
|
else
|
78
79
|
s.add_dependency(%q<builder>, [">= 0"])
|
79
80
|
s.add_dependency(%q<httparty>, [">= 0"])
|
@@ -84,7 +85,7 @@ Gem::Specification.new do |s|
|
|
84
85
|
s.add_dependency(%q<turn>, [">= 0"])
|
85
86
|
s.add_dependency(%q<mocha>, [">= 0"])
|
86
87
|
s.add_dependency(%q<vcr>, [">= 0"])
|
87
|
-
s.add_dependency(%q<webmock>, ["
|
88
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
88
89
|
end
|
89
90
|
else
|
90
91
|
s.add_dependency(%q<builder>, [">= 0"])
|
@@ -96,7 +97,7 @@ Gem::Specification.new do |s|
|
|
96
97
|
s.add_dependency(%q<turn>, [">= 0"])
|
97
98
|
s.add_dependency(%q<mocha>, [">= 0"])
|
98
99
|
s.add_dependency(%q<vcr>, [">= 0"])
|
99
|
-
s.add_dependency(%q<webmock>, ["
|
100
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
100
101
|
end
|
101
102
|
end
|
102
103
|
|
data/test/helper.rb
CHANGED
data/test/live_test.rb
CHANGED
data/test/test_mymoip.rb
CHANGED
@@ -2,56 +2,81 @@ require 'helper'
|
|
2
2
|
|
3
3
|
class TestMymoip < Test::Unit::TestCase
|
4
4
|
def setup
|
5
|
-
@
|
6
|
-
@
|
7
|
-
@
|
5
|
+
@default_environment = MyMoip.environment
|
6
|
+
@default_key = MyMoip.key
|
7
|
+
@default_token = MyMoip.token
|
8
|
+
@default_logger = MyMoip.logger
|
8
9
|
end
|
9
10
|
|
10
11
|
def teardown
|
11
|
-
MyMoip.environment = @
|
12
|
-
MyMoip.
|
13
|
-
MyMoip.
|
12
|
+
MyMoip.environment = @default_environment
|
13
|
+
MyMoip.key = @default_key
|
14
|
+
MyMoip.token = @default_token
|
15
|
+
MyMoip.logger = @default_logger
|
14
16
|
end
|
15
17
|
|
16
18
|
def test_default_environment_is_sandbox
|
19
|
+
MyMoip.environment = 'sandbox'
|
17
20
|
assert_equal "sandbox", MyMoip.environment
|
18
21
|
end
|
19
22
|
|
20
|
-
def
|
21
|
-
MyMoip.
|
22
|
-
|
23
|
-
|
23
|
+
def test_key_setter_updates_sandbox_and_production_keys
|
24
|
+
MyMoip.key = "my_key"
|
25
|
+
assert_equal "my_key", MyMoip.production_key
|
26
|
+
assert_equal "my_key", MyMoip.sandbox_key
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_token_setter_updates_sandbox_and_production_tokens
|
30
|
+
MyMoip.token = "my_token"
|
31
|
+
assert_equal "my_token", MyMoip.production_token
|
32
|
+
assert_equal "my_token", MyMoip.sandbox_token
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_current_auth_when_in_sandbox
|
36
|
+
MyMoip.sandbox_key = "sandbox_key"
|
37
|
+
MyMoip.sandbox_token = "sandbox_token"
|
38
|
+
MyMoip.environment = "sandbox"
|
39
|
+
assert_equal "sandbox_key", MyMoip.key
|
40
|
+
assert_equal "sandbox_token", MyMoip.token
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_current_auth_when_in_production
|
44
|
+
MyMoip.production_key = "production_key"
|
45
|
+
MyMoip.production_token = "production_token"
|
46
|
+
MyMoip.environment = "production"
|
47
|
+
assert_equal "production_key", MyMoip.key
|
48
|
+
assert_equal "production_token", MyMoip.token
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_default_referer_url_setter
|
24
52
|
MyMoip.default_referer_url = "http://localhost"
|
53
|
+
assert_equal "http://localhost", MyMoip.default_referer_url
|
54
|
+
end
|
25
55
|
|
26
|
-
|
27
|
-
|
56
|
+
def test_environment_setter
|
57
|
+
MyMoip.environment = "production"
|
28
58
|
assert_equal "production", MyMoip.environment
|
29
|
-
assert_equal "http://localhost", MyMoip.default_referer_url
|
30
59
|
end
|
31
60
|
|
32
61
|
def test_choose_right_api_url_by_sandbox_environment
|
33
62
|
MyMoip.environment = "sandbox"
|
34
|
-
|
35
63
|
assert_equal "https://desenvolvedor.moip.com.br/sandbox", MyMoip.api_url
|
36
64
|
end
|
37
65
|
|
38
66
|
def test_choose_right_api_url_by_production_environment
|
39
67
|
default_env = MyMoip.environment
|
40
68
|
MyMoip.environment = "production"
|
41
|
-
|
42
69
|
assert_equal "https://www.moip.com.br", MyMoip.api_url
|
43
|
-
MyMoip.environment = default_env
|
44
70
|
end
|
45
71
|
|
46
72
|
def test_logger_initialization
|
47
|
-
assert MyMoip.logger.instance_of?
|
73
|
+
assert MyMoip.logger.instance_of?(Logger)
|
48
74
|
end
|
49
75
|
|
50
76
|
def test_attribution_of_new_logger
|
51
77
|
default_logger = MyMoip.logger
|
52
78
|
MyMoip.logger = my_string = ""
|
53
79
|
assert_equal my_string, MyMoip.logger
|
54
|
-
MyMoip.logger = default_logger
|
55
80
|
end
|
56
81
|
|
57
82
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mymoip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
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:
|
12
|
+
date: 2013-01-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|
@@ -160,17 +160,17 @@ dependencies:
|
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
161
161
|
none: false
|
162
162
|
requirements:
|
163
|
-
- -
|
163
|
+
- - ! '>='
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version:
|
165
|
+
version: '0'
|
166
166
|
type: :development
|
167
167
|
prerelease: false
|
168
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
169
|
none: false
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ! '>='
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
173
|
+
version: '0'
|
174
174
|
description: Provides a implementation of MoIP's transparent checkout.
|
175
175
|
email: irio.musskopf@caixadeideias.com.br
|
176
176
|
executables: []
|
@@ -180,6 +180,7 @@ extra_rdoc_files:
|
|
180
180
|
- README.md
|
181
181
|
files:
|
182
182
|
- .document
|
183
|
+
- .travis.yml
|
183
184
|
- CHANGELOG.md
|
184
185
|
- Gemfile
|
185
186
|
- Gemfile.lock
|
@@ -230,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
231
|
version: '0'
|
231
232
|
segments:
|
232
233
|
- 0
|
233
|
-
hash:
|
234
|
+
hash: 1074109935584115222
|
234
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
236
|
none: false
|
236
237
|
requirements:
|
@@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
240
|
version: '0'
|
240
241
|
requirements: []
|
241
242
|
rubyforge_project:
|
242
|
-
rubygems_version: 1.8.
|
243
|
+
rubygems_version: 1.8.23
|
243
244
|
signing_key:
|
244
245
|
specification_version: 3
|
245
246
|
summary: MoIP transactions in a gem to call your own.
|