Module: Julianus
- Defined in:
- lib/julianus.rb,
lib/julianus/item.rb,
lib/julianus/claim.rb,
lib/julianus/report.rb,
lib/julianus/version.rb,
lib/krediidiregister.rb
Overview
Holds version for Julianus Gem
Defined Under Namespace
Classes: Claim, Item, KrediidiRegister, Report
Constant Summary collapse
- LIVE_KH_ENDPOINT =
"https://www.krediidihaldus.ee/export/wsdl-claim.php"
- LIVE_KH_NAMESPACE =
"https://www.krediidihaldus.ee/export/"
- TEST_KH_ENDPOINT =
"https://test.krediidihaldus.ee/export/wsdl-claim.php"
- TEST_KH_NAMESPACE =
"https://test.krediidihaldus.ee/export/"
- VERSION =
"1.0"
- @@config =
{ :kh_username => nil, :kh_password => nil, :live => false, :kr_username => nil, :kr_password => nil, }
Class Method Summary collapse
-
.config ⇒ Object
returns configuration options.
-
.configure(opts = {}) ⇒ Object
configure password, username, endpoint and namespace.
-
.report(identity_code) ⇒ Object
returns report main method for Julianus.
-
.send_report(file) ⇒ Object
upload to kr or ki.
Class Method Details
.config ⇒ Object
returns configuration options
37 38 39 |
# File 'lib/julianus.rb', line 37 def self.config @@config end |
.configure(opts = {}) ⇒ Object
configure password, username, endpoint and namespace
28 29 30 31 32 33 34 |
# File 'lib/julianus.rb', line 28 def self.configure(opts = {}) opts.each { |k,v| @@config[k.to_sym] = v if @valid_config_keys.include? k.to_sym } if @@config[:kh_username] && @@config[:kh_password] @@config[:endpoint] = @@config[:live] ? LIVE_KH_ENDPOINT : TEST_KH_ENDPOINT @@config[:namespace] = @@config[:live] ? LIVE_KH_NAMESPACE : TEST_KH_NAMESPACE end end |
.report(identity_code) ⇒ Object
returns report main method for Julianus
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/julianus.rb', line 43 def self.report identity_code @client = Savon.client do ssl_verify_mode :none endpoint @@config[:endpoint] namespace @@config[:namespace] end = { :customerData => { :username => @@config[:kh_username], :password => @@config[:kh_password], :code => identity_code } } response = @client.call(:get_by_code, :message => ) report = Report.new(response.http.raw_body) claim = response.body[:get_by_code_response][:return][:claims] report.add_claim(claim) report end |
.send_report(file) ⇒ Object
upload to kr or ki
64 65 66 |
# File 'lib/julianus.rb', line 64 def self.send_report file KrediidiRegister.upload_file(file) end |