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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0fc5c6931a5592f03ae84ebffe92209de8ac213
4
- data.tar.gz: 0c00189dfb43eaa7af06a0e7c77d6d840fd470ab
3
+ metadata.gz: 80078451936b7b124d53da3e679da08045b97c17
4
+ data.tar.gz: 3327aec2aeb6a9bce13fbb763de34c4cc4cf0120
5
5
  SHA512:
6
- metadata.gz: dd42c1000b76dca1cea172603c83e3a4a1c3032e8e847368a4f97f272309e7a666cc99f77bca3d81dc34cdee18b7d7dc2ddd97ff100ef40ab8f09f3b28e896e9
7
- data.tar.gz: b6e7b104b9420228868fd1d231aec649dba7d44258899415e632b6958d4e2e8c85262be595716e7d2ee66b0dc753eef7349529a484d0a5bbb8c85918ca4a5c80
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("../../templates", __FILE__)
5
+ source_root File.expand_path('../../templates', __FILE__)
6
6
 
7
- desc "It automatically create it initializer RentS rails app config"
7
+ desc 'It automatically create it initializer RentS rails app config'
8
8
 
9
9
  def copy_initializer
10
- template "rents.rb", "config/initializers/rents.rb"
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
- Rents.app_id = Rails.application.secrets.rents['app_id']
33
- Rents.secret_key = Rails.application.secrets.rents['app_secret_key']
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
@@ -92,7 +92,7 @@ module Rents
92
92
  to_hash_with_symbols(resp)
93
93
  end
94
94
 
95
- # CALLBACKs
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 json
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
@@ -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 amount
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 amount
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 amount
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? amount
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
@@ -38,7 +38,7 @@ class Hash
38
38
  end
39
39
 
40
40
  # SetUp a hash to hash URL GET
41
- def to_nested_get_param hash_name, hash_obj
41
+ def to_nested_get_param(hash_name, hash_obj)
42
42
  # initial value
43
43
  get_nested_params = ''
44
44
 
data/lib/rents/status.rb CHANGED
@@ -12,7 +12,7 @@ module Rents
12
12
  check_it
13
13
  end
14
14
 
15
- # Check it status and "setup" it attrs
15
+ # Check it status and 'setup' it attrs
16
16
  def check_it
17
17
  self.path = 'status'
18
18
  resp = get_request
data/lib/rents/string.rb CHANGED
@@ -7,7 +7,7 @@ class String
7
7
  self.to_i.to_s == self
8
8
  end
9
9
 
10
- def equals? str
10
+ def equals?(str)
11
11
  self == str
12
12
  end
13
13
  end
@@ -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 full_resp=false
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 = "transactions/page"
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 full_resp=false
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 rid=nil, full_resp=false
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 rid=nil, full_resp=false
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 rid=nil, full_resp=false
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 rid=nil, full_resp=false
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 rid
120
+ def self.find(rid)
121
121
  end
122
122
  end
123
123
  end
data/lib/rents/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Rents
2
2
  MAJOR = 1
3
3
  MINOR = 0
4
- PATCH = 1
4
+ PATCH = 2
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
6
  end
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 = "rents"
7
+ spec.name = 'rents'
8
8
  spec.version = Rents::VERSION
9
- spec.authors = ["Ilton Garcia"]
10
- spec.email = ["ilton_unb@hotmail.com"]
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 = "http://pagerents.github.io/rents-sdk-ruby"
14
- spec.license = "MIT"
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 = ["lib"]
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 "bundler", "~> 1.7"
24
- spec.add_development_dependency "rake", "~> 10.3", '>= 10.3.2'
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 "rspec", "~> 3.1", '>= 3.1.0'
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', "~> 0.8", '>= 0.8.6'
35
+ spec.add_dependency 'curb', '~> 0.8', '>= 0.8.6'
36
36
  # HTTP REST Client
37
- spec.add_dependency "rest-client", '~> 1.7', '>= 1.7.2'
37
+ spec.add_dependency 'rest-client', '~> 1.7', '>= 1.7.2'
38
38
  # Easy JSON create
39
- spec.add_dependency "multi_json", '~> 1.10', '>= 1.10.1'
39
+ spec.add_dependency 'multi_json', '~> 1.10', '>= 1.10.1'
40
40
  # To pretty print on console
41
- spec.add_dependency "colorize", '~> 0.7.3', '>= 0.7.3'
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
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.1
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-04-01 00:00:00.000000000 Z
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.5
273
+ rubygems_version: 2.4.8
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Rent$ payment Gateway & Intermediary ruby gem