InfaktApiClient

A Ruby client library for the InFakt API, providing easy access to InFakt's invoicing and accounting services. This client supports both the production and sandbox environments of the InFakt API v3.

Installation

In a Ruby Application

Add this line to your application's Gemfile:

gem 'infakt_api_client'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install infakt_api_client

In a Rails Application

After adding the gem to your Gemfile and running bundle install, you can run the generator to create an initializer:

$ rails generate infakt_api_client:install

This will create a configuration file at config/initializers/infakt_api_client.rb.

Configuration

Configure the client with your API key:

InfaktApiClient.configure do |config|
  # Your API key from InFakt
  config.api_key = 'your_api_key_here'

  # Optional: Use sandbox mode for testing (default: false)
  config.sandbox_mode = false

  # Optional: Override the API endpoint (not usually needed)
  # config.api_endpoint = 'https://custom-endpoint.example.com/'
end

Sandbox Mode

For testing purposes, you can use the InFakt sandbox environment:

InfaktApiClient.configure do |config|
  config.api_key = 'your_sandbox_api_key'
  config.sandbox_mode = true
end

Usage Examples

Basic Usage

# Create a client instance
client = InfaktApiClient::Client.new

# Fetch user details
user = client.user_details
puts "User email: #{user.account_data.email}"
puts "Company name: #{user.company_data.company_name}"

Error Handling

begin
  client = InfaktApiClient::Client.new
  user = client.user_details
  # Process user data
rescue InfaktApiClient::Error => e
  puts "API Error: #{e.message}"
end

API Documentation

For detailed information about the InFakt API endpoints and parameters, refer to the official InFakt API documentation.

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

License

The gem is available as open source under the terms of the MIT License.

Documentation

For detailed documentation of available methods and options, please visit our Wiki.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mateuszpalak/infakt_api_client.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests.

To install this gem onto your local machine, run bundle exec rake install.