moneybird 0.9.7 → 0.9.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4765ac62f2740e67304409f4e00320ab578467f7fe95681fe7e23f3749d5c826
4
- data.tar.gz: 98e590e61c8089a5ac94ee13e5b0a074ca11253117625b173190ac6543fe355f
3
+ metadata.gz: ea6ea233e3e874422aaa04be16868b737a7ca0ca48a018f5503ff7e585c3097b
4
+ data.tar.gz: dff514189705123f3d95232a913afc96e0d55d35795baf2c5e40bd42e88897f2
5
5
  SHA512:
6
- metadata.gz: e6c1994278c86217b870285f46089507076f7c4445a9c231fe0733d3128ac0c3468187497bc3bf0de6855a88235d1da81df234c4cbe5f881d2e00de02458763d
7
- data.tar.gz: 5c64e52708e35013a116dce3c97492bab860d0185cf1525a0f675463001e88cdd6128665bb6c83ccdf04b50af527bea314966f72138f32eb3862d6d0ceb58657
6
+ metadata.gz: a8b71a1ae20bb85f7e1777e0221188d4fd9728f6984e968c12b12df28c5c91bbd31997f3d6c4597ca50c52b19b0d88bcc9fdc39ebe8569640451e503201231cf
7
+ data.tar.gz: 941d51ed4c7067a72cf3c3ae972f9c993fa6bd0f9ce6938cbc226fc5ccfc6d755262d966e24015e8e26dc440666d4c5b1fbe8080879e4d1fd27c255b4fde9fad
data/README.md CHANGED
@@ -46,7 +46,7 @@ administration.contacts.find(moneybird_id)
46
46
  administration.contacts.find_by_customer_id(customer_id)
47
47
 
48
48
  # Create contact
49
- administrations.contacts.create(company_name: 'ACME', firstname: 'Foo', lastname: 'Bar')
49
+ administration.contacts.create(company_name: 'ACME', firstname: 'Foo', lastname: 'Bar')
50
50
 
51
51
  # Update contact
52
52
  contact = administration.contacts.all.first
@@ -69,6 +69,7 @@ require 'moneybird/traits/administration_service'
69
69
  require 'moneybird/traits/delete'
70
70
  require 'moneybird/traits/find'
71
71
  require 'moneybird/traits/find_all'
72
+ require 'moneybird/traits/mark_as_uncollectible'
72
73
  require 'moneybird/traits/save'
73
74
  require 'moneybird/traits/service'
74
75
  require 'moneybird/traits/synchronization' # Depends on synchronization resource
@@ -29,4 +29,9 @@ module Moneybird::Resource
29
29
  version
30
30
  )
31
31
  end
32
+
33
+ def link_booking(booking)
34
+ financial_mutation_service = Moneybird::Service::FinancialMutation.new(client, administration_id)
35
+ financial_mutation_service.link_booking(self, booking)
36
+ end
32
37
  end
@@ -25,9 +25,12 @@ module Moneybird::Resource
25
25
  notes
26
26
  original_sales_invoice_id
27
27
  paid_at
28
+ paused
28
29
  payment_conditions
30
+ payment_reference
29
31
  payments
30
32
  prices_are_incl_tax
33
+ public_view_code
31
34
  recurring_sales_invoice_id
32
35
  reference
33
36
  sent_at
@@ -61,6 +64,11 @@ module Moneybird::Resource
61
64
  invoice_service.send_invoice(self, options)
62
65
  end
63
66
 
67
+ def mark_as_uncollectible(options = {})
68
+ invoice_service = Moneybird::Service::SalesInvoice.new(client, administration_id)
69
+ invoice_service.mark_as_uncollectible(self, options)
70
+ end
71
+
64
72
  def payments=(payments)
65
73
  payment_data = payments.map{ |payment| Moneybird::Resource::Invoice::Payment.build(payment) }
66
74
  @payments = Moneybird::Service::Payment.new(client, administration_id, preloaded_data: payment_data, invoice_id: id)
@@ -75,4 +83,3 @@ module Moneybird::Resource
75
83
  end
76
84
  end
77
85
  end
78
-
@@ -5,6 +5,10 @@ module Moneybird::Service
5
5
  include Moneybird::Traits::FindAll
6
6
  include Moneybird::Traits::Synchronization
7
7
 
8
+ def link_booking(resource, booking)
9
+ client.patch("#{resource_path(resource)}/link_booking", booking.to_json)
10
+ end
11
+
8
12
  private
9
13
 
10
14
  def resource_class
@@ -8,6 +8,7 @@ module Moneybird::Service
8
8
  include Moneybird::Traits::Delete
9
9
  include Moneybird::Traits::Synchronization
10
10
  include Moneybird::Traits::SendInvoice
11
+ include Moneybird::Traits::MarkAsUncollectible
11
12
 
12
13
  private
13
14
 
@@ -19,4 +20,4 @@ module Moneybird::Service
19
20
  "#{administration_id}/sales_invoices"
20
21
  end
21
22
  end
22
- end
23
+ end
@@ -0,0 +1,15 @@
1
+ module Moneybird
2
+ module Traits
3
+ module MarkAsUncollectible
4
+ def mark_as_uncollectible_path(resource)
5
+ [path, resource.path, '/mark_as_uncollectible'].join('')
6
+ end
7
+
8
+ def mark_as_uncollectible(resource, options = {})
9
+ response = client.patch(mark_as_uncollectible_path(resource), options.to_json)
10
+ resource.attributes = response
11
+ resource
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,10 +1,6 @@
1
1
  module Moneybird
2
2
  module Traits
3
3
  module Save
4
- def resource_path(resource)
5
- [path, resource.path].join('')
6
- end
7
-
8
4
  def save(resource)
9
5
  response =
10
6
  if resource.persisted?
@@ -6,7 +6,9 @@ module Moneybird
6
6
  end
7
7
 
8
8
  def send_invoice(resource, options = {})
9
- client.patch(send_invoice_path(resource), options.to_json)
9
+ response = client.patch(send_invoice_path(resource), options.to_json)
10
+ resource.attributes = response
11
+ resource
10
12
  end
11
13
  end
12
14
  end
@@ -4,6 +4,10 @@ module Moneybird
4
4
  def build(attributes)
5
5
  resource_class.build attributes.merge(client: client)
6
6
  end
7
+
8
+ def resource_path(resource)
9
+ [path, resource.path].join('')
10
+ end
7
11
  end
8
12
  end
9
13
  end
@@ -1,3 +1,3 @@
1
1
  module Moneybird
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.8"
3
3
  end
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency "faraday_middleware"
25
25
  spec.add_dependency "link_header", "~> 0.0.8"
26
26
 
27
- spec.add_development_dependency "bundler", "~> 1.11"
27
+ spec.add_development_dependency "bundler", [">= 1.11", "< 3.0"]
28
28
  spec.add_development_dependency "rake", "~> 12.3"
29
29
  spec.add_development_dependency "codeclimate-test-reporter"
30
30
  spec.add_development_dependency "minitest"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneybird
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maarten van Vliet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-11 00:00:00.000000000 Z
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -70,16 +70,22 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.11'
76
+ - - "<"
77
+ - !ruby/object:Gem::Version
78
+ version: '3.0'
76
79
  type: :development
77
80
  prerelease: false
78
81
  version_requirements: !ruby/object:Gem::Requirement
79
82
  requirements:
80
- - - "~>"
83
+ - - ">="
81
84
  - !ruby/object:Gem::Version
82
85
  version: '1.11'
86
+ - - "<"
87
+ - !ruby/object:Gem::Version
88
+ version: '3.0'
83
89
  - !ruby/object:Gem::Dependency
84
90
  name: rake
85
91
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +226,7 @@ files:
220
226
  - lib/moneybird/traits/delete.rb
221
227
  - lib/moneybird/traits/find.rb
222
228
  - lib/moneybird/traits/find_all.rb
229
+ - lib/moneybird/traits/mark_as_uncollectible.rb
223
230
  - lib/moneybird/traits/save.rb
224
231
  - lib/moneybird/traits/send_invoice.rb
225
232
  - lib/moneybird/traits/service.rb