Class: Cetustek::Configuration
- Inherits:
-
Object
- Object
- Cetustek::Configuration
- Defined in:
- lib/cetustek/configuration.rb
Constant Summary collapse
- TRANSPORTS =
HTTPI (savon 的預設) 第一順位是 httpclient,而 httpclient 只認 gem 內附的 cacert.pem,裡面沒有 Certum Trusted Root CA — 也就是 sandbox 端點 invoice.cetustek.com.tw 憑證鏈的根。只要環境裡有 httpclient,沙盒開票就會 全數 certificate verify failed。改用 :faraday 走 net_http,讀系統信任庫。
%i[httpi faraday].freeze
Instance Attribute Summary collapse
-
#environment ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
-
#logger ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
-
#password ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
-
#site_id ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
-
#transport ⇒ Object
Returns the value of attribute transport.
-
#username ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #production? ⇒ Boolean
- #sandbox? ⇒ Boolean
- #url ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 |
# File 'lib/cetustek/configuration.rb', line 15 def initialize @environment = :sandbox @transport = :httpi end |
Instance Attribute Details
#environment ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
12 13 14 |
# File 'lib/cetustek/configuration.rb', line 12 def environment @environment end |
#logger ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
12 13 14 |
# File 'lib/cetustek/configuration.rb', line 12 def logger @logger end |
#password ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
12 13 14 |
# File 'lib/cetustek/configuration.rb', line 12 def password @password end |
#site_id ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
12 13 14 |
# File 'lib/cetustek/configuration.rb', line 12 def site_id @site_id end |
#transport ⇒ Object
Returns the value of attribute transport.
13 14 15 |
# File 'lib/cetustek/configuration.rb', line 13 def transport @transport end |
#username ⇒ Object
logger is opt-in: nil means this gem writes nothing anywhere.
12 13 14 |
# File 'lib/cetustek/configuration.rb', line 12 def username @username end |
Instance Method Details
#production? ⇒ Boolean
35 36 37 |
# File 'lib/cetustek/configuration.rb', line 35 def production? @environment == :production end |
#sandbox? ⇒ Boolean
39 40 41 |
# File 'lib/cetustek/configuration.rb', line 39 def sandbox? @environment == :sandbox end |
#url ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/cetustek/configuration.rb', line 27 def url if @environment == :production 'https://www.ei.com.tw/InvoiceMultiWeb/InvoiceAPI?wsdl' else 'https://invoice.cetustek.com.tw/InvoiceMultiWeb/InvoiceAPI?wsdl' end end |