Class: AlipayMini::Config
- Inherits:
-
Object
- Object
- AlipayMini::Config
- Includes:
- Singleton
- Defined in:
- lib/alipay_mini/config.rb
Instance Attribute Summary collapse
-
#app_id ⇒ Object
mini program app id.
-
#charset ⇒ Object
charset, default is ‘utf-8’.
-
#format ⇒ Object
format, default is ‘JSON’, only support ‘JSON’.
-
#private_key ⇒ Object
app private key, use for sign.
-
#public_key ⇒ Object
alipay public key, use for verify.
-
#sign_type ⇒ Object
sign type, default is ‘RSA2’, support ‘RSA2’ or ‘RSA’.
-
#url ⇒ Object
api request url.
-
#version ⇒ Object
version, now is ‘1.0’.
Instance Method Summary collapse
Instance Attribute Details
#app_id ⇒ Object
mini program app id
11 12 13 |
# File 'lib/alipay_mini/config.rb', line 11 def app_id @app_id end |
#charset ⇒ Object
charset, default is ‘utf-8’
17 18 19 |
# File 'lib/alipay_mini/config.rb', line 17 def charset @charset end |
#format ⇒ Object
format, default is ‘JSON’, only support ‘JSON’
14 15 16 |
# File 'lib/alipay_mini/config.rb', line 14 def format @format end |
#private_key ⇒ Object
app private key, use for sign
26 27 28 |
# File 'lib/alipay_mini/config.rb', line 26 def private_key @private_key end |
#public_key ⇒ Object
alipay public key, use for verify
29 30 31 |
# File 'lib/alipay_mini/config.rb', line 29 def public_key @public_key end |
#sign_type ⇒ Object
sign type, default is ‘RSA2’, support ‘RSA2’ or ‘RSA’
20 21 22 |
# File 'lib/alipay_mini/config.rb', line 20 def sign_type @sign_type end |
#url ⇒ Object
api request url
8 9 10 |
# File 'lib/alipay_mini/config.rb', line 8 def url @url end |
#version ⇒ Object
version, now is ‘1.0’
23 24 25 |
# File 'lib/alipay_mini/config.rb', line 23 def version @version end |
Instance Method Details
#configuration ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/alipay_mini/config.rb', line 32 def configuration @config ||= {}.tap do |config| config[:url] = url if url config[:app_id] = app_id if app_id config[:private_key] = format_private_key(private_key) if private_key config[:public_key] = format_public_key(public_key) if public_key config[:version] = '1.0' config[:format] = format || 'JSON' config[:charset] = charset || 'utf-8' config[:sign_type] = sign_type || 'RSA2' end end |