pesapal 1.8.0 → 2.0.0

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.
@@ -1,21 +0,0 @@
1
- # Since generators are not specific to this project, it's preferable you refer
2
- # to the official documentation on the Rails site here;
3
- # http://guides.rubyonrails.org/generators.html
4
- module Pesapal
5
- module Generators
6
- # Install pesapal generator
7
- class InstallGenerator < Rails::Generators::Base
8
- source_root File.expand_path('../../templates', __FILE__)
9
-
10
- desc 'Creates a Pesapal config file to your application.'
11
-
12
- def copy_config
13
- copy_file 'pesapal.yml', 'config/pesapal.yml'
14
- end
15
-
16
- def show_readme
17
- readme 'README.md' if behavior == :invoke
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
-
2
- How To Use Config File
3
- ----------------------
4
-
5
- The Pesapal config file is in YAML format and looks something like this. Change
6
- the values appropriately.
7
-
8
- ```
9
- development:
10
- callback_url: 'http://0.0.0.0:3000/pesapal/callback'
11
- consumer_key: '<YOUR_CONSUMER_KEY>'
12
- consumer_secret: '<YOUR_CONSUMER_SECRET>'
13
-
14
- production:
15
- callback_url: 'http://1.2.3.4:3000/pesapal/callback'
16
- consumer_key: '<YOUR_CONSUMER_KEY>'
17
- consumer_secret: '<YOUR_CONSUMER_SECRET>'
18
- ```
19
-
20
- The config file can be found at `#{Rails.root}/config/pesapal.yml`.
21
-
@@ -1,9 +0,0 @@
1
- development:
2
- callback_url: 'http://0.0.0.0:3000/pesapal/callback'
3
- consumer_key: '<YOUR_DEV_CONSUMER_KEY>'
4
- consumer_secret: '<YOUR_DEV_CONSUMER_SECRET>'
5
-
6
- production:
7
- callback_url: 'http://1.2.3.4:3000/pesapal/callback'
8
- consumer_key: '<YOUR_PROD_CONSUMER_KEY>'
9
- consumer_secret: '<YOUR_PROD_CONSUMER_SECRET>'
@@ -1,26 +0,0 @@
1
- module Pesapal
2
- # Hooks Pesapal to extend Rails and/or modify the initialization process.
3
- class Railtie < Rails::Railtie
4
- # Loads pesapal credentials from initializer file depending on environment
5
- # and fallback to default values if anything goes wrong.
6
- initializer 'pesapal.load_credentials' do
7
- path_to_yaml = "#{Rails.root}/config/pesapal.yml"
8
- if File.exist?(path_to_yaml)
9
- begin
10
- config.pesapal_credentials = YAML.load(IO.read(path_to_yaml))[Rails.env]
11
- rescue Errno::ENOENT
12
- logger.info('YAML configuration file couldn\'t be found.')
13
- return
14
- rescue Psych::SyntaxError
15
- logger.info('YAML configuration file contains invalid syntax. Will use using defaults.')
16
- return
17
- end
18
- else
19
- config.pesapal_credentials = { callback_url: 'http://0.0.0.0:3000/pesapal/callback',
20
- consumer_key: '<YOUR_CONSUMER_KEY>',
21
- consumer_secret: '<YOUR_CONSUMER_SECRET>'
22
- }
23
- end
24
- end
25
- end
26
- end