billogram 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.env.example +3 -3
  3. data/.github/config/rubocop_linter_action.yml +4 -0
  4. data/.github/workflows/ci.yml +41 -0
  5. data/.github/workflows/config/rubocop_linter_action.yml +4 -0
  6. data/.rubocop.yml +32 -0
  7. data/.rubocop_todo.yml +13 -0
  8. data/Gemfile +2 -0
  9. data/README.md +1 -1
  10. data/Rakefile +5 -3
  11. data/billogram.gemspec +24 -20
  12. data/bin/console +4 -3
  13. data/lib/billogram.rb +38 -35
  14. data/lib/billogram/client.rb +3 -1
  15. data/lib/billogram/endpoint.rb +5 -3
  16. data/lib/billogram/error.rb +9 -8
  17. data/lib/billogram/relation.rb +2 -0
  18. data/lib/billogram/relation_builder.rb +8 -4
  19. data/lib/billogram/request.rb +3 -1
  20. data/lib/billogram/resource.rb +15 -14
  21. data/lib/billogram/resources/address.rb +4 -2
  22. data/lib/billogram/resources/automatic_collection.rb +3 -1
  23. data/lib/billogram/resources/automatic_reminder.rb +2 -0
  24. data/lib/billogram/resources/bookkeeping.rb +15 -7
  25. data/lib/billogram/resources/bookkeeping_object.rb +2 -0
  26. data/lib/billogram/resources/callbacks.rb +5 -2
  27. data/lib/billogram/resources/contact.rb +3 -1
  28. data/lib/billogram/resources/customer.rb +6 -4
  29. data/lib/billogram/resources/data.rb +8 -5
  30. data/lib/billogram/resources/detailed_sums.rb +4 -2
  31. data/lib/billogram/resources/domestic_bank_account.rb +2 -0
  32. data/lib/billogram/resources/edi.rb +7 -0
  33. data/lib/billogram/resources/electricity_collection.rb +5 -3
  34. data/lib/billogram/resources/event.rb +4 -2
  35. data/lib/billogram/resources/info.rb +2 -0
  36. data/lib/billogram/resources/international_bank_account.rb +2 -0
  37. data/lib/billogram/resources/invoice.rb +19 -13
  38. data/lib/billogram/resources/invoice_defaults.rb +6 -2
  39. data/lib/billogram/resources/item.rb +4 -2
  40. data/lib/billogram/resources/logotype.rb +2 -0
  41. data/lib/billogram/resources/payment.rb +2 -0
  42. data/lib/billogram/resources/payment_settings.rb +2 -0
  43. data/lib/billogram/resources/regional_sweden.rb +11 -8
  44. data/lib/billogram/resources/report.rb +3 -1
  45. data/lib/billogram/resources/settings.rb +9 -2
  46. data/lib/billogram/resources/tax.rb +2 -0
  47. data/lib/billogram/version.rb +3 -1
  48. metadata +97 -28
  49. data/.github/workflows/test.yml +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecf8ee8f04e71955b726c7d304cb7cd453f61ac7a5795013999647830dab8d8f
4
- data.tar.gz: '068e94ab1817b8abd11e689cc88526e44037ba62a36e1f7706a16324f2d582b1'
3
+ metadata.gz: 9ec57154a0b9dbdcdcb5ee3aa8045f62a96369cbfe3f0c026507f581ce2a13b7
4
+ data.tar.gz: b95d26514a7a0fdf10c6d4c922c1768329c9087113e393e143ed832959c43f76
5
5
  SHA512:
6
- metadata.gz: a6663425902dd14d65ae786e484b77001ef7d55525c8b13de4dfe9d6bf14262ce4d5ca43a59d602bbc445327ba871ee7b09f8a1dbf8dbfb2b4c842efb3e004ea
7
- data.tar.gz: dea13ec316abbe48209fc71e1bb4c833b6ef593f301d96bbba7022341aa873e3e6cdd088c8676a9d4136024b26599abe55fd2e3946fbfdf0828a5a4d602d4f3e
6
+ metadata.gz: 228b3068fa520c94c3fd1c738d742a6fdaa8c5e1213faf6982ef6dad21d971ea0535144f82a26ec6efd6e7b828369010e33e463304cbaa7503ddec3076e6572f
7
+ data.tar.gz: f1dda39d942e999759c17e8f3ad6e1f97e8e07849e4486ba3a6445f273c6b2d1b4c14e46e82299ac1b4d9c0e4952833ecc886750b8d4336717b09f626a2d07db
data/.env.example CHANGED
@@ -1,3 +1,3 @@
1
- BILLOGRAM_BASE_URI: "https://sandbox.billogram.com/api/v2/"
2
- BILLOGRAM_USERNAME: "6603-z0UqHDRJ"
3
- BILLOGRAM_PASSWORD: "55e0cc0a4170f39641840dd4c8274f70"
1
+ BILLOGRAM_BASE_URI=https://sandbox.billogram.com/api/v2/
2
+ BILLOGRAM_USERNAME=6603-z0UqHDRJ
3
+ BILLOGRAM_PASSWORD=55e0cc0a4170f39641840dd4c8274f70
@@ -0,0 +1,4 @@
1
+ versions:
2
+ - rubocop: '1.13'
3
+ - rubocop-rspec: '2.3'
4
+ - rubocop-performance: '1.11'
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - "*"
7
+ tags:
8
+ - "!*"
9
+ pull_request:
10
+ branches:
11
+ - "*"
12
+
13
+ jobs:
14
+ rspec:
15
+ name: RSpec
16
+ env:
17
+ BILLOGRAM_BASE_URI: https://sandbox.billogram.com/api/v2
18
+ BILLOGRAM_USERNAME: 0000-RANDOM
19
+ BILLOGRAM_PASSWORD: 55e0cc0a4170f39641840dd4c8274f70
20
+ runs-on: ubuntu-latest
21
+ strategy:
22
+ matrix:
23
+ ruby: [ '2.5', '2.6', '2.7', '3.0' ]
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ bundler-cache: true
31
+ - name: Run tests
32
+ run: bundle exec rspec
33
+
34
+ rubocop:
35
+ name: Rubocop
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v2
39
+ - uses: andrewmcodes/rubocop-linter-action@v3.3.0
40
+ env:
41
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,4 @@
1
+ versions:
2
+ - rubocop: '1.13'
3
+ - rubocop-rspec: '2.3'
4
+ - rubocop-performance: '1.11'
data/.rubocop.yml ADDED
@@ -0,0 +1,32 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-rspec
5
+ - rubocop-performance
6
+
7
+ AllCops:
8
+ NewCops: enable
9
+ DisplayCopNames: true
10
+ DisplayStyleGuide: true
11
+
12
+ Layout/LineLength:
13
+ Max: 120
14
+
15
+ Layout/EmptyLineBetweenDefs:
16
+ AllowAdjacentOneLineDefs: true
17
+
18
+ Naming/VariableNumber:
19
+ Enabled: false
20
+
21
+ Style/SymbolArray:
22
+ EnforcedStyle: brackets
23
+
24
+ Style/Documentation:
25
+ Enabled: false
26
+
27
+ Metrics/BlockLength:
28
+ IgnoredMethods: [
29
+ 'describe',
30
+ 'context',
31
+ 'shared_examples_for'
32
+ ]
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,13 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2021-05-01 13:22:29 UTC using RuboCop version 1.13.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 14
10
+ # Configuration parameters: .
11
+ # SupportedStyles: have_received, receive
12
+ RSpec/MessageSpies:
13
+ EnforcedStyle: receive
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in billogram.gemspec
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Billogram
2
- ![](https://github.com/mbirman/billogram/workflows/Test/badge.svg)
2
+ [![Gem Version](https://badge.fury.io/rb/billogram.svg)](https://badge.fury.io/rb/billogram) ![](https://github.com/mbirman/billogram/workflows/Test/badge.svg)
3
3
 
4
4
  Simple ruby wrapper for [Billogram](https://billogram.com) API
5
5
 
data/Rakefile CHANGED
@@ -1,6 +1,8 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
3
5
 
4
6
  RSpec::Core::RakeTask.new(:spec)
5
7
 
6
- task :default => :spec
8
+ task default: :spec
data/billogram.gemspec CHANGED
@@ -1,33 +1,37 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'billogram/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "billogram"
8
+ spec.name = 'billogram'
8
9
  spec.version = Billogram::VERSION
9
- spec.authors = ["Mark Birman"]
10
- spec.email = ["birmanmark@gmail.com"]
11
- spec.description = %q{Simple ruby wrapper for Billogram API}
10
+ spec.authors = ['mbirman']
11
+ spec.description = 'Simple ruby wrapper for Billogram API'
12
12
 
13
- spec.summary = "Ruby library providing access to Billogram API"
14
- spec.homepage = "http://github.com/mbirman/billogram"
15
- spec.license = "MIT"
13
+ spec.summary = 'Ruby library providing access to Billogram API'
14
+ spec.homepage = 'https://github.com/mbirman/billogram'
15
+ spec.license = 'MIT'
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
18
+ spec.bindir = 'exe'
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
20
+ spec.require_paths = ['lib']
21
21
 
22
- spec.required_ruby_version = '~> 2.4'
22
+ spec.required_ruby_version = '>= 2.5', '< 4'
23
23
 
24
- spec.add_development_dependency "bundler"
25
- spec.add_development_dependency "rake"
26
- spec.add_development_dependency "rspec", "~> 3.9"
27
- spec.add_development_dependency "webmock", "~> 3.7"
28
- spec.add_development_dependency "dotenv", "~> 2.7"
29
- spec.add_development_dependency "byebug"
24
+ spec.add_development_dependency 'bundler'
25
+ spec.add_development_dependency 'byebug'
26
+ spec.add_development_dependency 'dotenv', '~> 2.7'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.9'
29
+ spec.add_development_dependency 'rubocop', '~> 1.13'
30
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11'
31
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
32
+ spec.add_development_dependency 'simplecov', '~> 0.21'
33
+ spec.add_development_dependency 'webmock', '~> 3.7'
30
34
 
31
- spec.add_dependency "httparty", "~> 0.17.1"
32
- spec.add_dependency "activesupport", "~> 5.2"
35
+ spec.add_dependency 'activesupport', '>= 5.2', '< 7'
36
+ spec.add_dependency 'httparty', '~> 0.17.1'
33
37
  end
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "billogram"
4
+ require 'bundler/setup'
5
+ require 'billogram'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "billogram"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start
data/lib/billogram.rb CHANGED
@@ -1,41 +1,44 @@
1
- require "httparty"
2
- require "billogram/client"
3
- require "billogram/endpoint"
4
- require "billogram/error"
5
- require "billogram/relation"
6
- require "billogram/relation_builder"
7
- require "billogram/resource"
8
- require "billogram/request"
9
- require "billogram/resources/address"
10
- require "billogram/resources/automatic_reminder"
11
- require "billogram/resources/automatic_collection"
12
- require "billogram/resources/bookkeeping"
13
- require "billogram/resources/bookkeeping_object"
14
- require "billogram/resources/callbacks"
15
- require "billogram/resources/contact"
16
- require "billogram/resources/customer"
17
- require "billogram/resources/data"
18
- require "billogram/resources/detailed_sums"
19
- require "billogram/resources/domestic_bank_account"
20
- require "billogram/resources/electricity_collection"
21
- require "billogram/resources/event"
22
- require "billogram/resources/info"
23
- require "billogram/resources/international_bank_account"
24
- require "billogram/resources/invoice"
25
- require "billogram/resources/invoice_defaults"
26
- require "billogram/resources/item"
27
- require "billogram/resources/logotype"
28
- require "billogram/resources/payment"
29
- require "billogram/resources/payment_settings"
30
- require "billogram/resources/regional_sweden"
31
- require "billogram/resources/report"
32
- require "billogram/resources/settings"
33
- require "billogram/resources/tax"
34
- require "billogram/version"
1
+ # frozen_string_literal: true
2
+
3
+ require 'httparty'
4
+ require 'billogram/client'
5
+ require 'billogram/endpoint'
6
+ require 'billogram/error'
7
+ require 'billogram/relation'
8
+ require 'billogram/relation_builder'
9
+ require 'billogram/resource'
10
+ require 'billogram/request'
11
+ require 'billogram/resources/address'
12
+ require 'billogram/resources/automatic_reminder'
13
+ require 'billogram/resources/automatic_collection'
14
+ require 'billogram/resources/bookkeeping'
15
+ require 'billogram/resources/bookkeeping_object'
16
+ require 'billogram/resources/callbacks'
17
+ require 'billogram/resources/contact'
18
+ require 'billogram/resources/customer'
19
+ require 'billogram/resources/data'
20
+ require 'billogram/resources/detailed_sums'
21
+ require 'billogram/resources/domestic_bank_account'
22
+ require 'billogram/resources/edi'
23
+ require 'billogram/resources/electricity_collection'
24
+ require 'billogram/resources/event'
25
+ require 'billogram/resources/info'
26
+ require 'billogram/resources/international_bank_account'
27
+ require 'billogram/resources/invoice'
28
+ require 'billogram/resources/invoice_defaults'
29
+ require 'billogram/resources/item'
30
+ require 'billogram/resources/logotype'
31
+ require 'billogram/resources/payment'
32
+ require 'billogram/resources/payment_settings'
33
+ require 'billogram/resources/regional_sweden'
34
+ require 'billogram/resources/report'
35
+ require 'billogram/resources/settings'
36
+ require 'billogram/resources/tax'
37
+ require 'billogram/version'
35
38
 
36
39
  module Billogram
37
40
  class << self
38
- BASE_URI = "https://billogram.com/api/v2/"
41
+ BASE_URI = 'https://billogram.com/api/v2/'
39
42
 
40
43
  attr_accessor :username, :password
41
44
  attr_writer :base_uri
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Client
3
5
  include HTTParty
@@ -9,7 +11,7 @@ module Billogram
9
11
  format :json
10
12
 
11
13
  def initialize(username, password, base_uri)
12
- self.class.default_options.merge!(base_uri: base_uri, basic_auth: {username: username, password: password})
14
+ self.class.default_options.merge!(base_uri: base_uri, basic_auth: { username: username, password: password })
13
15
  end
14
16
  end
15
17
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  module Endpoint
3
5
  def self.included(base)
@@ -17,7 +19,7 @@ module Billogram
17
19
 
18
20
  module ClassMethods
19
21
  attr_writer :default_search_options
20
-
22
+
21
23
  def default_search_options
22
24
  @default_search_options ||= { page: 1, page_size: 50 }
23
25
  end
@@ -29,7 +31,7 @@ module Billogram
29
31
 
30
32
  def search(options = {})
31
33
  query = default_search_options.merge(options)
32
- perform_request(:get, "#{endpoint}", query)
34
+ perform_request(:get, endpoint.to_s, query)
33
35
  end
34
36
 
35
37
  def fetch(id = nil)
@@ -37,7 +39,7 @@ module Billogram
37
39
  end
38
40
 
39
41
  def create(attributes)
40
- perform_request(:post, "#{endpoint}", attributes)
42
+ perform_request(:post, endpoint.to_s, attributes)
41
43
  end
42
44
 
43
45
  def perform_request(type, url, params = {})
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Error < StandardError
3
-
4
5
  class BadRequest < Error; end
5
6
  class Unauthorized < Error; end
6
7
  class Forbidden < Error; end
@@ -9,18 +10,18 @@ module Billogram
9
10
 
10
11
  class << self
11
12
  def from_response(response)
12
- message = response["data"]["message"]
13
+ message = response.dig('data', 'message')
13
14
  error_class(response).new(message)
14
15
  end
15
16
 
16
17
  def error_class(response)
17
18
  case response.code.to_i
18
- when 400 then BadRequest
19
- when 401 then Unauthorized
20
- when 403 then Forbidden
21
- when 404 then NotFound
22
- when 500 then InternalServerError
23
- else Billogram::Error
19
+ when 400 then BadRequest
20
+ when 401 then Unauthorized
21
+ when 403 then Forbidden
22
+ when 404 then NotFound
23
+ when 500 then InternalServerError
24
+ else Billogram::Error
24
25
  end
25
26
  end
26
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Relation
3
5
  attr_reader :name, :type, :class_override
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class RelationBuilder
3
5
  attr_reader :resource, :attributes
@@ -20,10 +22,12 @@ module Billogram
20
22
  end
21
23
 
22
24
  def build_relation(relation)
23
- if attrs = attributes.delete(relation.name)
24
- value = relation.relation_class.build_objects(attrs)
25
- resource.public_send("#{relation.name}=", value)
26
- end
25
+ attrs = attributes.delete(relation.name)
26
+
27
+ return unless attrs
28
+
29
+ value = relation.relation_class.build_objects(attrs)
30
+ resource.public_send("#{relation.name}=", value)
27
31
  end
28
32
  end
29
33
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Request
3
5
  attr_reader :url, :type, :params
@@ -20,7 +22,7 @@ module Billogram
20
22
  end
21
23
 
22
24
  def execute
23
- response.success? ? response["data"] : raise_from(response)
25
+ response.success? ? response['data'] : raise_from(response)
24
26
  end
25
27
 
26
28
  def raise_from(response)
@@ -1,4 +1,6 @@
1
- require "active_support/core_ext/string/inflections.rb"
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/string/inflections'
2
4
 
3
5
  module Billogram
4
6
  class Resource
@@ -15,7 +17,7 @@ module Billogram
15
17
  def build_objects(data)
16
18
  case data
17
19
  when Hash then new(data)
18
- when Array then data.map{|item| build_objects(item) }
20
+ when Array then data.map { |item| build_objects(item) }
19
21
  else data
20
22
  end
21
23
  end
@@ -38,19 +40,18 @@ module Billogram
38
40
  end
39
41
 
40
42
  def to_hash
41
- instance_variables
42
- .each_with_object({}) do |variable, obj|
43
- value = instance_variable_get(variable)
44
-
45
- case value
46
- when Resource
47
- value = value.to_hash
48
- when Array
49
- value = value.map(&:to_hash)
50
- end
51
-
52
- obj[variable[1..-1]] = value
43
+ instance_variables.each_with_object({}) do |variable, obj|
44
+ value = instance_variable_get(variable)
45
+
46
+ case value
47
+ when Resource
48
+ value = value.to_hash
49
+ when Array
50
+ value = value.map(&:to_hash)
53
51
  end
52
+
53
+ obj[variable[1..-1]] = value
54
+ end
54
55
  end
55
56
  end
56
57
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Address < Resource
3
- attr_accessor :street_address, :careof, :use_careof_as_attention, :zipcode,
4
- :city, :country, :name, :attention
5
+ attr_accessor :attention, :careof, :city, :country, :email, :name,
6
+ :street_address, :use_careof_as_attention, :zipcode
5
7
  end
6
8
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class AutomaticCollection < Resource
3
- attr_accessor :delay_days, :amount
5
+ attr_accessor :delay_days, :amount, :use_default_settings
4
6
  end
5
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class AutomaticReminder < Resource
3
5
  attr_accessor :message, :delay_days
@@ -1,13 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Bookkeeping < Resource
3
- attr_accessor :income_account, :vat_account, :income_account_for_vat_25,
4
- :income_account_for_vat_12, :income_account_for_vat_6,
5
- :income_account_for_vat_0, :reversed_vat_account, :vat_account_for_vat_25,
6
- :vat_account_for_vat_12, :vat_account_for_vat_6, :account_receivable_account,
7
- :client_funds_account, :banking_account, :interest_fee_account,
8
- :reminder_fee_account, :rounding_account, :factoring_receivable_account
5
+ attr_accessor :account_receivable_account, :banking_account, :client_funds_account,
6
+ :debt_collection_funds_account, :expected_loss_account,
7
+ :factoring_receivable_account, :financial_year_months,
8
+ :financial_year_start, :income_account, :income_account_for_vat_0,
9
+ :income_account_for_vat_12, :income_account_for_vat_25,
10
+ :income_account_for_vat_6, :income_payout_account,
11
+ :interest_fee_account, :liabilities_customers_account,
12
+ :non_allocated_account, :reminder_fee_account,
13
+ :reversed_vat_account, :rounding_account, :sie_continuous_numbering,
14
+ :sie_serie, :vat_account, :vat_account_for_vat_12,
15
+ :vat_account_for_vat_25, :vat_account_for_vat_6,
16
+ :written_down_receivables_account
9
17
 
10
18
  relation :regional_sweden, :one
11
- relation :objects, :many, class_override: "BookkeepingObject"
19
+ relation :objects, :many, class_override: 'BookkeepingObject'
12
20
  end
13
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class BookkeepingObject < Resource
3
5
  attr_accessor :dimension_id, :object_id, :dimension_name, :object_name
@@ -1,8 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Callbacks < Resource
3
- attr_accessor :callback_id, :custom, :signature, :sandbox, :url, :sign_key
5
+ attr_accessor :callback_id, :callback_timestamp, :callback_type, :custom,
6
+ :sandbox, :sign_key, :signature, :url
4
7
 
5
8
  relation :event, :one
6
- relation :invoice, :one
9
+ relation :billogram, :one, class_override: 'Invoice'
7
10
  end
8
11
  end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Contact < Resource
3
- attr_accessor :name, :email, :phone
5
+ attr_accessor :email, :name, :phone, :www
4
6
  end
5
7
  end
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Customer < Resource
3
5
  include Endpoint
4
6
 
5
7
  attr_accessor :customer_no, :name, :notes, :org_no, :vat_no, :created_at,
6
- :updated_at, :company_type, :phone, :email
8
+ :updated_at, :company_type, :phone, :email, :language
7
9
 
8
- alias_method :id, :customer_no
10
+ alias id customer_no
9
11
 
10
12
  relation :address, :one
11
13
  relation :contact, :one
12
- relation :delivery_address, :one, class_override: "Address"
13
- relation :payment_settings, :one, class_override: "PaymentSettings"
14
+ relation :delivery_address, :one, class_override: 'Address'
15
+ relation :payment_settings, :one, class_override: 'PaymentSettings'
14
16
  end
15
17
  end
@@ -1,9 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Data < Resource
3
- attr_accessor :invoice_no, :delivery_method, :letter_id, :amount, :payer_name,
4
- :banking_amount, :manual, :reminder_fee, :reminder_count, :interest_rate,
5
- :customer_email, :ip, :type, :message, :collector_method, :collector_reference,
6
- :factoring_method, :factoring_reference, :sells_for, :sold_for,
7
- :total_sum, :remaining_sum, :scanning_central
5
+ attr_accessor :amount, :banking_amount, :collector_method,
6
+ :collector_reference, :customer_email, :delivery_method,
7
+ :factoring_method, :factoring_reference, :interest_rate,
8
+ :invoice_no, :ip, :letter_id, :manual, :message, :payer_name,
9
+ :payment_flags, :remaining_sum, :reminder_count, :reminder_fee,
10
+ :scanning_central, :sells_for, :sold_for, :total_sum, :type
8
11
  end
9
12
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class DetailedSums < Resource
3
5
  attr_accessor :credited_sum, :net_sum, :gross_sum, :invoice_fee_vat, :paid_sum,
4
- :interest_fee, :vat_sum, :reminder_fee, :invoice_fee, :rounding, :collector_paid_sum,
5
- :remaining_sum
6
+ :interest_fee, :vat_sum, :reminder_fee, :invoice_fee, :rounding, :collector_paid_sum,
7
+ :remaining_sum
6
8
 
7
9
  relation :regional_sweden, :one
8
10
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class DomesticBankAccount < Resource
3
5
  attr_accessor :account_no, :clearing_no
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Billogram
4
+ class Edi < Resource
5
+ attr_accessor :electronic_id, :operator, :subtype, :reference, :note
6
+ end
7
+ end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class ElectricityCollection < Resource
3
5
  attr_accessor :nyttighet, :kommunkod, :slutfaktura, :kravmall,
4
- :frankopplad, :arsforb, :plombkod, :natom, :avflyttad_datum,
5
- :frankopplad_datum, :anladr, :anlid, :avflyttad, :naringsidkare,
6
- :objtyp, :faktforb, :faktfrek
6
+ :frankopplad, :arsforb, :plombkod, :natom, :avflyttad_datum,
7
+ :frankopplad_datum, :anladr, :anlid, :avflyttad, :naringsidkare,
8
+ :objtyp, :faktforb, :faktfrek
7
9
  end
8
10
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Event < Resource
3
5
  include Endpoint
4
6
 
5
7
  endpoint 'billogram_event'
6
8
 
7
- attr_accessor :created_at, :type
9
+ attr_accessor :created_at, :type, :event_uuid
8
10
 
9
- relation :data, :one, class_override: "Data"
11
+ relation :data, :one, class_override: 'Data'
10
12
  end
11
13
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Info < Resource
3
5
  attr_accessor :order_no, :order_date, :our_reference, :your_reference,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class InternationalBankAccount < Resource
3
5
  attr_accessor :bank, :iban, :bic, :swift
@@ -1,29 +1,35 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Invoice < Resource
3
5
  include Endpoint
4
6
 
5
7
  endpoint 'billogram'
6
8
 
7
- attr_accessor :id, :invoice_no, :ocr_number, :invoice_date, :due_date, :due_days,
8
- :invoice_fee, :invoice_fee_vat, :reminder_fee, :interest_rate,
9
- :interest_fee, :currency, :delivery_method, :state, :url, :flags,
10
- :remaining_sum, :total_sum, :rounding_value, :automatic_reminders,
11
- :reminder_count, :created_at, :attested_at, :updated_at, :detailed_sums,
12
- :attachment, :offers, :sales_accepted, :show_item_gross_prices, :respite_date,
13
- :recipient_url, :creditor_unique_value
9
+ attr_accessor :attachment, :attested_at, :automatic_reminders, :created_at,
10
+ :creditor_unique_value, :currency, :delivery_method, :detailed_sums,
11
+ :due_date, :due_days, :flags, :id, :interest_fee, :interest_rate,
12
+ :invoice_date, :invoice_fee, :invoice_fee_vat, :invoice_no,
13
+ :ocr_number, :offers, :pdf, :recipient_url, :remaining_sum,
14
+ :reminder_count, :reminder_fee, :respite_date, :rounding_value,
15
+ :sales_accepted, :show_item_gross_prices, :state, :total_sum,
16
+ :updated_at, :url
14
17
 
15
18
  relation :info, :one
16
19
  relation :customer, :one
17
20
  relation :regional_sweden, :one
18
21
  relation :automatic_collection, :one
19
- relation :callbacks, :one, class_override: "Callbacks"
20
- relation :detailed_sums, :one, class_override: "DetailedSums"
22
+ relation :callbacks, :one, class_override: 'Callbacks'
23
+ relation :detailed_sums, :one, class_override: 'DetailedSums'
21
24
 
22
25
  relation :items, :many
23
26
  relation :events, :many
24
- relation :automatic_reminders_settings, :many, class_override: "AutomaticReminder"
27
+ relation :automatic_reminders_settings, :many, class_override: 'AutomaticReminder'
25
28
 
26
- COMMANDS = [ :sell, :remind, :collect, :writeoff, :resend, :remind, :payment, :credit, :message, :attach ]
29
+ COMMANDS = [
30
+ :sell, :remind, :collect, :writeoff, :resend,
31
+ :remind, :payment, :credit, :message, :attach
32
+ ].freeze
27
33
 
28
34
  COMMANDS.each do |command|
29
35
  define_method command do |*args|
@@ -31,8 +37,8 @@ module Billogram
31
37
  end
32
38
  end
33
39
 
34
- def send!(method: )
35
- send_command(:send, {method: method})
40
+ def send!(method:)
41
+ send_command(:send, { method: method })
36
42
  end
37
43
 
38
44
  private
@@ -1,7 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class InvoiceDefaults < Resource
3
- attr_accessor :default_message, :default_interest_rate, :default_reminder_fee,
4
- :default_invoice_fee
5
+ attr_accessor :automatic_reminders_minimum_principal_sum, :automatic_writeoff,
6
+ :default_interest_rate, :default_invoice_fee, :default_message,
7
+ :default_reminder_fee, :pdf, :reminders_without_fee, :show_item_gross_prices,
8
+ :show_new_account_notice, :use_automatic_reminders_partly_paid
5
9
 
6
10
  relation :automatic_reminders, :many
7
11
  relation :automatic_collection, :many
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Item < Resource
3
5
  include Endpoint
4
6
 
5
7
  attr_accessor :item_no, :title, :description, :price, :vat, :unit,
6
- :created_at, :updated_at, :count, :discount
8
+ :created_at, :updated_at, :count, :discount
7
9
 
8
- alias_method :id, :item_no
10
+ alias id item_no
9
11
 
10
12
  relation :bookkeeping, :one
11
13
  relation :regional_sweden, :one
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Logotype < Resource
3
5
  include Endpoint
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Payment < Resource
3
5
  attr_accessor :bankgiro, :plusgiro
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class PaymentSettings < Resource
3
5
  attr_accessor :recurring_payment_type
@@ -1,14 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class RegionalSweden < Resource
3
5
  attr_accessor :autogiro_betalarnummer, :autogiro_full_status, :autogiro_payment_date,
4
- :autogiro_status, :autogiro_total_sum, :efaktura_recipient_bank_code,
5
- :efaktura_recipient_bank_id, :efaktura_recipient_bank_name,
6
- :efaktura_recipient_id_number, :efaktura_recipient_identifier,
7
- :efaktura_recipient_type, :efaktura_requested_amount, :reversed_vat,
8
- :rotavdrag, :rotavdrag_account, :rotavdrag_description,
9
- :rotavdrag_personal_number, :rotavdrag_sum, :rotavdrag_housing_association_org_no,
10
- :rotavdrag_apartment_designation, :rotavdrag_description_of_property
6
+ :autogiro_status, :autogiro_total_sum, :efaktura_recipient_bank_code,
7
+ :efaktura_recipient_bank_id, :efaktura_recipient_bank_name,
8
+ :efaktura_recipient_id_number, :efaktura_recipient_identifier,
9
+ :efaktura_recipient_type, :efaktura_requested_amount, :reversed_vat,
10
+ :rotavdrag, :rotavdrag_account, :rotavdrag_description,
11
+ :rotavdrag_personal_number, :rotavdrag_sum, :rotavdrag_housing_association_org_no,
12
+ :rotavdrag_apartment_designation, :rotavdrag_description_of_property
11
13
 
12
- relation :electricity_collection, :one
14
+ relation :edi, :one
15
+ relation :electricity_collection, :one
13
16
  end
14
17
  end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Report < Resource
3
5
  include Endpoint
4
6
 
5
7
  attr_accessor :filename, :type, :file_type, :info, :created_at, :content
6
8
 
7
- alias_method :id, :filename
9
+ alias id filename
8
10
  end
9
11
  end
@@ -1,14 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Settings < Resource
3
5
  include Endpoint
4
6
 
5
- attr_accessor :name, :org_no
7
+ attr_accessor :name, :org_no, :registration_email
6
8
 
7
9
  relation :tax, :one
8
10
  relation :contact, :one
9
11
  relation :address, :one
10
12
  relation :payment, :one
11
- relation :invoices, :one, class_override: "InvoiceDefaults"
13
+ relation :invoices, :one, class_override: 'InvoiceDefaults'
12
14
  relation :bookkeeping, :one
15
+
16
+ relation :return_address, :one, class_override: 'Address'
17
+ relation :invoice_address, :one, class_override: 'Address'
18
+ relation :visiting_address, :one, class_override: 'Address'
19
+ relation :registered_office_address, :one, class_override: 'Address'
13
20
  end
14
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
4
  class Tax < Resource
3
5
  attr_accessor :is_vat_registered, :has_fskatt, :vat_no
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Billogram
2
- VERSION = "0.6.5"
4
+ VERSION = '0.6.6'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billogram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.6.6
5
5
  platform: ruby
6
6
  authors:
7
- - Mark Birman
7
+ - mbirman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2021-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: dotenv
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '13.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '13.0'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rspec
43
71
  requirement: !ruby/object:Gem::Requirement
@@ -53,86 +81,123 @@ dependencies:
53
81
  - !ruby/object:Gem::Version
54
82
  version: '3.9'
55
83
  - !ruby/object:Gem::Dependency
56
- name: webmock
84
+ name: rubocop
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - "~>"
60
88
  - !ruby/object:Gem::Version
61
- version: '3.7'
89
+ version: '1.13'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
94
  - - "~>"
67
95
  - !ruby/object:Gem::Version
68
- version: '3.7'
96
+ version: '1.13'
69
97
  - !ruby/object:Gem::Dependency
70
- name: dotenv
98
+ name: rubocop-performance
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
101
  - - "~>"
74
102
  - !ruby/object:Gem::Version
75
- version: '2.7'
103
+ version: '1.11'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
108
  - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: '2.7'
110
+ version: '1.11'
83
111
  - !ruby/object:Gem::Dependency
84
- name: byebug
112
+ name: rubocop-rspec
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - ">="
115
+ - - "~>"
88
116
  - !ruby/object:Gem::Version
89
- version: '0'
117
+ version: '2.3'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - ">="
122
+ - - "~>"
95
123
  - !ruby/object:Gem::Version
96
- version: '0'
124
+ version: '2.3'
97
125
  - !ruby/object:Gem::Dependency
98
- name: httparty
126
+ name: simplecov
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - "~>"
102
130
  - !ruby/object:Gem::Version
103
- version: 0.17.1
104
- type: :runtime
131
+ version: '0.21'
132
+ type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
- version: 0.17.1
138
+ version: '0.21'
111
139
  - !ruby/object:Gem::Dependency
112
- name: activesupport
140
+ name: webmock
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
143
  - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.7'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.7'
153
+ - !ruby/object:Gem::Dependency
154
+ name: activesupport
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
116
158
  - !ruby/object:Gem::Version
117
159
  version: '5.2'
160
+ - - "<"
161
+ - !ruby/object:Gem::Version
162
+ version: '7'
118
163
  type: :runtime
119
164
  prerelease: false
120
165
  version_requirements: !ruby/object:Gem::Requirement
121
166
  requirements:
122
- - - "~>"
167
+ - - ">="
123
168
  - !ruby/object:Gem::Version
124
169
  version: '5.2'
170
+ - - "<"
171
+ - !ruby/object:Gem::Version
172
+ version: '7'
173
+ - !ruby/object:Gem::Dependency
174
+ name: httparty
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - "~>"
178
+ - !ruby/object:Gem::Version
179
+ version: 0.17.1
180
+ type: :runtime
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - "~>"
185
+ - !ruby/object:Gem::Version
186
+ version: 0.17.1
125
187
  description: Simple ruby wrapper for Billogram API
126
- email:
127
- - birmanmark@gmail.com
188
+ email:
128
189
  executables: []
129
190
  extensions: []
130
191
  extra_rdoc_files: []
131
192
  files:
132
193
  - ".env.example"
133
- - ".github/workflows/test.yml"
194
+ - ".github/config/rubocop_linter_action.yml"
195
+ - ".github/workflows/ci.yml"
196
+ - ".github/workflows/config/rubocop_linter_action.yml"
134
197
  - ".gitignore"
135
198
  - ".rspec"
199
+ - ".rubocop.yml"
200
+ - ".rubocop_todo.yml"
136
201
  - Gemfile
137
202
  - LICENSE.txt
138
203
  - README.md
@@ -159,6 +224,7 @@ files:
159
224
  - lib/billogram/resources/data.rb
160
225
  - lib/billogram/resources/detailed_sums.rb
161
226
  - lib/billogram/resources/domestic_bank_account.rb
227
+ - lib/billogram/resources/edi.rb
162
228
  - lib/billogram/resources/electricity_collection.rb
163
229
  - lib/billogram/resources/event.rb
164
230
  - lib/billogram/resources/info.rb
@@ -174,7 +240,7 @@ files:
174
240
  - lib/billogram/resources/settings.rb
175
241
  - lib/billogram/resources/tax.rb
176
242
  - lib/billogram/version.rb
177
- homepage: http://github.com/mbirman/billogram
243
+ homepage: https://github.com/mbirman/billogram
178
244
  licenses:
179
245
  - MIT
180
246
  metadata: {}
@@ -184,16 +250,19 @@ require_paths:
184
250
  - lib
185
251
  required_ruby_version: !ruby/object:Gem::Requirement
186
252
  requirements:
187
- - - "~>"
253
+ - - ">="
254
+ - !ruby/object:Gem::Version
255
+ version: '2.5'
256
+ - - "<"
188
257
  - !ruby/object:Gem::Version
189
- version: '2.4'
258
+ version: '4'
190
259
  required_rubygems_version: !ruby/object:Gem::Requirement
191
260
  requirements:
192
261
  - - ">="
193
262
  - !ruby/object:Gem::Version
194
263
  version: '0'
195
264
  requirements: []
196
- rubygems_version: 3.0.6
265
+ rubygems_version: 3.1.4
197
266
  signing_key:
198
267
  specification_version: 4
199
268
  summary: Ruby library providing access to Billogram API
@@ -1,27 +0,0 @@
1
- name: Test
2
-
3
- on:
4
- push:
5
- branches:
6
- - "*"
7
- tags:
8
- - "!*"
9
-
10
- jobs:
11
- bundler:
12
- runs-on: ubuntu-latest
13
- strategy:
14
- matrix:
15
- ruby: [ '2.4.x', '2.5.x', '2.6.x' ]
16
- steps:
17
- - uses: actions/checkout@master
18
- - name: Set up Ruby
19
- uses: actions/setup-ruby@v1
20
- with:
21
- ruby-version: ${{ matrix.ruby }}
22
- - name: Set up Bundler
23
- run: gem install bundler -v 1.17.3
24
- - name: Install dependencies
25
- run: bundle install --jobs 4 --retry 3
26
- - name: Run tests
27
- run: bundle exec rspec