Class: Ksef::Client
- Inherits:
-
Object
- Object
- Ksef::Client
- Defined in:
- lib/ksef/client.rb
Overview
Main entry point for the KSeF API.
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
-
#current_session ⇒ Object
Returns the value of attribute current_session.
-
#nip ⇒ Object
readonly
Returns the value of attribute nip.
Instance Method Summary collapse
-
#connection ⇒ Object
Lazily-built HTTP connection.
-
#initialize(nip:, credentials:, configuration: nil) ⇒ Client
constructor
A new instance of Client.
- #invoices ⇒ Object
- #sessions ⇒ Object
Constructor Details
#initialize(nip:, credentials:, configuration: nil) ⇒ Client
Returns a new instance of Client.
24 25 26 27 28 29 30 31 |
# File 'lib/ksef/client.rb', line 24 def initialize(nip:, credentials:, configuration: nil) raise ConfigurationError, "nip cannot be blank" if nip.nil? || nip.to_s.empty? @nip = nip.to_s @credentials = credentials @configuration = configuration || Ksef.configuration.dup @current_session = nil end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
21 22 23 |
# File 'lib/ksef/client.rb', line 21 def configuration @configuration end |
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
21 22 23 |
# File 'lib/ksef/client.rb', line 21 def credentials @credentials end |
#current_session ⇒ Object
Returns the value of attribute current_session.
22 23 24 |
# File 'lib/ksef/client.rb', line 22 def current_session @current_session end |
#nip ⇒ Object (readonly)
Returns the value of attribute nip.
21 22 23 |
# File 'lib/ksef/client.rb', line 21 def nip @nip end |
Instance Method Details
#connection ⇒ Object
Lazily-built HTTP connection. Public so the resource classes can share it; not part of the supported public surface — treat as internal.
35 36 37 |
# File 'lib/ksef/client.rb', line 35 def connection @connection ||= Internal::Connection.new(@configuration) end |