rents 1.0.1 → 1.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.
- checksums.yaml +4 -4
- data/Contributing.md +0 -0
- data/lib/ca-bundle.crt +0 -0
- data/lib/generators/rents/install_generator.rb +3 -3
- data/lib/generators/templates/rents.rb +6 -2
- data/lib/rents/array.rb +0 -0
- data/lib/rents/config/enums/brands.yml +0 -0
- data/lib/rents/config/enums/currencies.yml +0 -0
- data/lib/rents/config/enums/payment_methods.yml +0 -0
- data/lib/rents/config/enums/recurrence_periods.yml +0 -0
- data/lib/rents/config/enums/transaction_codes.yml +0 -0
- data/lib/rents/config/proxy.example.yml +0 -0
- data/lib/rents/connection.rb +2 -2
- data/lib/rents/currency.rb +4 -4
- data/lib/rents/hash.rb +1 -1
- data/lib/rents/status.rb +1 -1
- data/lib/rents/string.rb +1 -1
- data/lib/rents/transaction.rb +8 -8
- data/lib/rents/version.rb +1 -1
- data/modeling/API Routes.png +0 -0
- data/modeling/WorkFlow - LocalGEM.asta +0 -0
- data/modeling/WorkFlow - LocalGEM.png +0 -0
- data/rents.gemspec +13 -13
- data/spec/file_helper.rb +0 -0
- data/spec/rents/conversions_spec.rb +0 -0
- data/spec/rents/currency_spec.rb +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80078451936b7b124d53da3e679da08045b97c17
|
4
|
+
data.tar.gz: 3327aec2aeb6a9bce13fbb763de34c4cc4cf0120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6e3b784344370d89513ab35dd2fefae37a049b546528d2b8f73d0d982739ef35cebfba61c1a02ff6b6b86e2396a736a8de9ab18c5b18efde3ab38a5484c2044
|
7
|
+
data.tar.gz: f2c6f2b880c6033a9b6722265ac5c6b5fac8dbf9dc4fed5793ef95dac43621fdd480e1ae204e6bea81222c0294313eeb23c287dbc1cf67550cce011381bba2d5
|
data/Contributing.md
CHANGED
File without changes
|
data/lib/ca-bundle.crt
CHANGED
File without changes
|
@@ -2,12 +2,12 @@ require 'colorize'
|
|
2
2
|
module Rents
|
3
3
|
module Generators
|
4
4
|
class InstallGenerator < Rails::Generators::Base
|
5
|
-
source_root File.expand_path(
|
5
|
+
source_root File.expand_path('../../templates', __FILE__)
|
6
6
|
|
7
|
-
desc
|
7
|
+
desc 'It automatically create it initializer RentS rails app config'
|
8
8
|
|
9
9
|
def copy_initializer
|
10
|
-
template
|
10
|
+
template 'rents.rb', 'config/initializers/rents.rb'
|
11
11
|
puts 'Check your config/initializers/rents.rb & read it comments'.colorize(:light_yellow)
|
12
12
|
end
|
13
13
|
|
@@ -29,7 +29,11 @@ end
|
|
29
29
|
# Get your App config if your not using TEST_ENV nor DEBUGGER
|
30
30
|
if (Rents.test_env.nil? && Rents.debug.nil?) || (Rents.test_env == false && Rents.debug == false)
|
31
31
|
if Rails.version[0].to_i >= 4
|
32
|
-
|
33
|
-
|
32
|
+
begin
|
33
|
+
Rents.app_id = Rails.application.secrets.rents['app_id']
|
34
|
+
Rents.secret_key = Rails.application.secrets.rents['app_secret_key']
|
35
|
+
rescue
|
36
|
+
p 'Check your Secret.yml... Please add on it your Rent$ app_id & app_secret_key'
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
data/lib/rents/array.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/rents/connection.rb
CHANGED
@@ -92,7 +92,7 @@ module Rents
|
|
92
92
|
to_hash_with_symbols(resp)
|
93
93
|
end
|
94
94
|
|
95
|
-
#
|
95
|
+
# Callbacks
|
96
96
|
protected
|
97
97
|
# Config Attrs
|
98
98
|
def setup_config
|
@@ -163,7 +163,7 @@ module Rents
|
|
163
163
|
end
|
164
164
|
|
165
165
|
# Return the JSON in a Hash with it keys in symbols
|
166
|
-
def to_hash_with_symbols
|
166
|
+
def to_hash_with_symbols(json)
|
167
167
|
hashed = JSON.parse(json)
|
168
168
|
hashed.is_a?(Array) ? hashed.each_with_index { |hash, i| hashed[i] = hash.it_keys_to_sym } : hashed.it_keys_to_sym
|
169
169
|
hashed
|
data/lib/rents/currency.rb
CHANGED
@@ -2,7 +2,7 @@ module Rents
|
|
2
2
|
# Currency Obj, useful methods to work with many different countries
|
3
3
|
class Currency
|
4
4
|
# Receive it amount in Decimal and convert to operator str, like 10,00 or 10.00 to 1000
|
5
|
-
def self.to_operator_str
|
5
|
+
def self.to_operator_str(amount)
|
6
6
|
# Check invalid entry
|
7
7
|
return nil if amount.nil?
|
8
8
|
amount = amount.to_s if amount.is_a?Integer
|
@@ -31,7 +31,7 @@ module Rents
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# Receive it amount in Integer String (like 1000 that means 10,00 or 10.00) and convert to Decimal value
|
34
|
-
def self.to_decimal
|
34
|
+
def self.to_decimal(amount)
|
35
35
|
# If it was passed a BigDecimal it must be passed to operator format
|
36
36
|
amount = Currency.to_operator_str(amount) if amount.is_a?BigDecimal
|
37
37
|
|
@@ -48,14 +48,14 @@ module Rents
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# Get it cents from operator amount formatted
|
51
|
-
def self.get_cents
|
51
|
+
def self.get_cents(amount)
|
52
52
|
aux = amount.to_s
|
53
53
|
cents_length = 2
|
54
54
|
aux[aux.length-cents_length, aux.length]
|
55
55
|
end
|
56
56
|
|
57
57
|
# Receive a numeric form operator format & retrieve it
|
58
|
-
def self.have_cents?
|
58
|
+
def self.have_cents?(amount)
|
59
59
|
aux = "#{amount.to_f/100}" if amount.is_a?(String) || amount.is_a?(Integer)
|
60
60
|
aux = amount.to_s if amount.is_a?Float
|
61
61
|
cents = aux[aux.index('.')+1, aux.length]
|
data/lib/rents/hash.rb
CHANGED
data/lib/rents/status.rb
CHANGED
data/lib/rents/string.rb
CHANGED
data/lib/rents/transaction.rb
CHANGED
@@ -31,13 +31,13 @@ module Rents
|
|
31
31
|
end
|
32
32
|
|
33
33
|
# POST /api/transactions/page return operator page URL, like the Cielo Page
|
34
|
-
def charge_page
|
34
|
+
def charge_page(full_resp=false)
|
35
35
|
custom_http_params
|
36
36
|
# SetUp redirect dynamic if is test
|
37
37
|
self.request_params[:transaction][:redirect_link] = "#{self.redirect_link}" if self.request_params[:transaction][:test_env]
|
38
38
|
|
39
39
|
# dynamic path (it is written when a specific method use it)
|
40
|
-
self.path =
|
40
|
+
self.path = 'transactions/page'
|
41
41
|
|
42
42
|
# using json_request because need only the answer (do not use something like it HTTP Code)
|
43
43
|
self.resp = self.post_json_request unless full_resp
|
@@ -46,7 +46,7 @@ module Rents
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# POST /api/transactions
|
49
|
-
def charge_store
|
49
|
+
def charge_store(full_resp=false)
|
50
50
|
custom_http_params
|
51
51
|
|
52
52
|
# dynamic path (it is written when a specific method use it)
|
@@ -60,7 +60,7 @@ module Rents
|
|
60
60
|
end
|
61
61
|
|
62
62
|
# Update the recurrence amount
|
63
|
-
def update_subscription
|
63
|
+
def update_subscription(rid=nil, full_resp=false)
|
64
64
|
# SetUp
|
65
65
|
self.recurrent_rid = rid if rid
|
66
66
|
self.path = "transactions/#{self.recurrent_rid}/subscription"
|
@@ -73,7 +73,7 @@ module Rents
|
|
73
73
|
end
|
74
74
|
|
75
75
|
# Stop a recurrence based on it transaction rid
|
76
|
-
def unsubscribe
|
76
|
+
def unsubscribe(rid=nil, full_resp=false)
|
77
77
|
# SetUp
|
78
78
|
self.recurrent_rid = rid if rid
|
79
79
|
self.path = "transactions/#{self.recurrent_rid}/subscription/unsubscribe"
|
@@ -86,7 +86,7 @@ module Rents
|
|
86
86
|
end
|
87
87
|
|
88
88
|
# Return the payments executed for the purchase passed
|
89
|
-
def payment_history
|
89
|
+
def payment_history(rid=nil, full_resp=false)
|
90
90
|
# SetUp
|
91
91
|
self.recurrent_rid = rid if rid
|
92
92
|
self.path = "transactions/#{self.recurrent_rid}/subscription/payment_history"
|
@@ -100,7 +100,7 @@ module Rents
|
|
100
100
|
end
|
101
101
|
|
102
102
|
# Check if a subscription is up-to-date or have any pending
|
103
|
-
def up_to_date
|
103
|
+
def up_to_date(rid=nil, full_resp=false)
|
104
104
|
# SetUp
|
105
105
|
self.recurrent_rid = rid if rid
|
106
106
|
|
@@ -117,7 +117,7 @@ module Rents
|
|
117
117
|
|
118
118
|
# ================ STATIC methods ================
|
119
119
|
# GET /api/transactions/:rid by the rid passed
|
120
|
-
def self.find
|
120
|
+
def self.find(rid)
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
data/lib/rents/version.rb
CHANGED
data/modeling/API Routes.png
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/rents.gemspec
CHANGED
@@ -4,27 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'rents/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'rents'
|
8
8
|
spec.version = Rents::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Ilton Garcia']
|
10
|
+
spec.email = ['ilton_unb@hotmail.com']
|
11
11
|
spec.summary = 'Rent$ payment Gateway & Intermediary ruby gem'
|
12
12
|
spec.description = 'Ruby gem for Rent$ payment Gateway & Intermediary'
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'http://pagerents.github.io/rents-sdk-ruby'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
#================== GEMs to build it GEM, so its improve the development ==============================
|
22
22
|
# Base GEMs to build it gem
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
24
|
+
spec.add_development_dependency 'rake', '~> 10.3', '>= 10.3.2'
|
25
25
|
|
26
26
|
# RSpec for tests
|
27
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
|
28
28
|
# Coverage
|
29
29
|
spec.add_development_dependency 'simplecov', '~> 0.7', '>= 0.7.1'
|
30
30
|
# Create readable attrs values
|
@@ -32,13 +32,13 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
#================== GEMs to be used when it is called on a project ====================================
|
34
34
|
# For real user operator IP (4GeoLoc)
|
35
|
-
spec.add_dependency 'curb',
|
35
|
+
spec.add_dependency 'curb', '~> 0.8', '>= 0.8.6'
|
36
36
|
# HTTP REST Client
|
37
|
-
spec.add_dependency
|
37
|
+
spec.add_dependency 'rest-client', '~> 1.7', '>= 1.7.2'
|
38
38
|
# Easy JSON create
|
39
|
-
spec.add_dependency
|
39
|
+
spec.add_dependency 'multi_json', '~> 1.10', '>= 1.10.1'
|
40
40
|
# To pretty print on console
|
41
|
-
spec.add_dependency
|
41
|
+
spec.add_dependency 'colorize', '~> 0.7.3', '>= 0.7.3'
|
42
42
|
# To work with the Rails Numeric for currency
|
43
43
|
spec.add_dependency 'bigdecimal', '~> 1.2.5', '>= 1.2.5'
|
44
44
|
end
|
data/spec/file_helper.rb
CHANGED
File without changes
|
File without changes
|
data/spec/rents/currency_spec.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilton Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
272
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.4.
|
273
|
+
rubygems_version: 2.4.8
|
274
274
|
signing_key:
|
275
275
|
specification_version: 4
|
276
276
|
summary: Rent$ payment Gateway & Intermediary ruby gem
|