quaderno 2.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5785e9a03af0c0ffa3eb2d52fc0586e8fa866c9da75170619a0a53755f2d2623
4
- data.tar.gz: b45c9dbb82dc07b655dc3a8a3bb9a636fad5d1e3d5b1e15382fdeb4290c84357
3
+ metadata.gz: 1f3b6e897bcfb92df7d244d949215951b2b36f632b58fc913a0f9e507e6139fb
4
+ data.tar.gz: a5beafab6ffd9e9567dc4962f53f4815ae20f320e67b0d14e08f5d5b4328d603
5
5
  SHA512:
6
- metadata.gz: fae563254f44fbd6a1128916bbc79d134b312a0945ad97b727b064140900e7d336499836b7eafd6f103d2a3b0cce5be5c410eb1e72043dfbea3b3eb7ec1bfdbb
7
- data.tar.gz: fe5a981e7e7a2c3f48df1b83c0f9bf1cc87db36044d45cd998b2167940cc5401534750145617baa82fafc27b4511061a5468897cf9adfc7ee6ff5528068ab97f
6
+ metadata.gz: 668e725c0b8605a44149f873e5f4dcd69d162dae7339b8dabb92547a4403aba8f541c20c8e449ed0d8073893ead12f57897490df5665a47660fdd55b44d6e117
7
+ data.tar.gz: 3c0a8339f8d725f51e116020dcc177543757a3915473498af9bbebce19a3d776a88b7b3b2b38abd569fd1fb6c3335b55a884b93d5f4924eaf01a243f224435d1
@@ -19,7 +19,7 @@ jobs:
19
19
  runs-on: ubuntu-latest
20
20
  strategy:
21
21
  matrix:
22
- ruby-version: ['2.5', '2.6', '2.7', '3.0']
22
+ ruby-version: ['2.7', '3.0']
23
23
 
24
24
  steps:
25
25
  - uses: actions/checkout@v2
data/.gitignore CHANGED
@@ -1,3 +1,6 @@
1
+ # byebug generated
2
+ .byebug_history
3
+
1
4
  # rcov generated
2
5
  coverage
3
6
  coverage.data
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Quaderno-ruby is a ruby wrapper for [Quaderno API] (https://github.com/quaderno/quaderno-api).
4
4
 
5
- Current version is 2.1.2 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
5
+ Current version is 2.1.3 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
6
6
 
7
7
  ## Installation & Configuration
8
8
 
@@ -182,6 +182,16 @@ will update the specified item with the data of the hash passed as second parame
182
182
 
183
183
  will delete the item with the id passed as parameter. If the deletion was successful, an instance of `Quaderno::Item` with the `deleted` attribute set to `true` will be returned.
184
184
 
185
+ ## Managing transactions
186
+
187
+ ### Creating a new transaction
188
+
189
+ ```ruby
190
+ Quaderno::Transaction.create(params) #=> Quaderno::Transaction
191
+ ```
192
+
193
+ will create a sale or refund transaction using the information of the hash passed as parameter.
194
+
185
195
 
186
196
  ## Managing invoices
187
197
 
@@ -706,7 +716,7 @@ Remember this is only a ruby wrapper for the original API. If you want more info
706
716
  ## License
707
717
  (The MIT License)
708
718
 
709
- Copyright © 2013-2015 Quaderno
719
+ Copyright © 2013-2023 Quaderno
710
720
 
711
721
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
712
722
 
data/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0
4
+ * Added support for transactions API
5
+ * Bumped webmock to 3.18
6
+
7
+ ## 2.1.3
8
+ * Bumped dependency httparty to 0.21.0 by [**adamgiounas**](https://github.com/adamgiounas): https://github.com/quaderno/quaderno-ruby/pull/28
9
+
3
10
  ## 2.1.2
4
11
  * Fixed a reference to non-existent variable by [**@fwitzke**](https://github.com/fwitzke)
5
12
  ## 2.1.1
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'httparty'
2
4
  require 'json'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Quaderno::Behavior
2
4
  module Crud
3
5
 
@@ -69,7 +71,7 @@ module Quaderno::Behavior
69
71
 
70
72
  def create(params = {})
71
73
  authentication = get_authentication(params.merge(api_model: api_model))
72
- params.dup.delete_if { |k,v| %w(auth_token access_token api_url mode api_model').include? k.to_s }
74
+ params.dup.delete_if { |k, _| %w[auth_token access_token api_url mode api_model].include? k.to_s }
73
75
 
74
76
  response = post("#{authentication[:url]}#{api_model.api_path}.json",
75
77
  body: params.to_json,
@@ -91,7 +93,7 @@ module Quaderno::Behavior
91
93
 
92
94
  def update(id, params = {})
93
95
  authentication = get_authentication(params.merge(api_model: api_model))
94
- params = params.dup.delete_if { |k,v| %w(auth_token access_token api_url mode api_model').include? k.to_s }
96
+ params = params.dup.delete_if { |k, _| %w[auth_token access_token api_url mode api_model].include? k.to_s }
95
97
 
96
98
  response = put("#{authentication[:url]}#{api_model.api_path}/#{id}.json",
97
99
  body: params.to_json,
@@ -114,7 +116,7 @@ module Quaderno::Behavior
114
116
  def delete(id, options = {})
115
117
  authentication = get_authentication(options.merge(api_model: api_model))
116
118
 
117
- response = HTTParty.delete("#{authentication[:url]}#{ api_model.api_path }/#{ id }.json",
119
+ response = HTTParty.delete("#{authentication[:url]}#{api_model.api_path}/#{id}.json",
118
120
  basic_auth: authentication[:basic_auth],
119
121
  headers: default_headers.merge(authentication[:headers])
120
122
  )
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Quaderno::Transaction < Quaderno::Base
4
+ api_model Quaderno::Transaction
5
+ api_path 'transactions'
6
+ is_a_document? true
7
+
8
+ class << self
9
+ undef :all, :find, :update, :delete
10
+ end
11
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Quaderno
2
- VERSION = "2.1.2"
4
+ VERSION = "2.2.0"
3
5
  end
data/lib/quaderno-ruby.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Quaderno
2
4
  end
3
5
 
@@ -10,4 +12,4 @@ require 'quaderno-ruby/helpers/authentication'
10
12
  require 'quaderno-ruby/collection'
11
13
 
12
14
  %w(block crud deliver payment retrieve).each { |filename| require "quaderno-ruby/behavior/#{filename}" }
13
- %w(base contact item invoice receipt credit income estimate expense recurring document_item report report_request evidence payment webhook tax checkout_session).each { |filename| require "quaderno-ruby/#{ filename }" }
15
+ %w(base contact item transaction invoice receipt credit income estimate expense recurring document_item report report_request evidence payment webhook tax checkout_session).each { |filename| require "quaderno-ruby/#{filename}" }
data/quaderno.gemspec CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
21
21
  spec.date = '2018-05-07'
22
22
  spec.extra_rdoc_files = %w(LICENSE.txt README.md)
23
23
 
24
- spec.add_dependency('httparty', '~> 0.13')
24
+ spec.add_dependency('httparty', '~> 0.21.0')
25
25
  spec.add_development_dependency('rdoc', '>= 6.3.1')
26
26
  spec.add_development_dependency('activesupport', '~> 4.2.0')
27
- spec.add_development_dependency('webmock', '~> 1.22.6')
27
+ spec.add_development_dependency('webmock', '~> 3.18')
28
28
  spec.add_development_dependency('vcr', '>= 0')
29
29
  spec.add_development_dependency('bundler', '~> 2.2')
30
30
  spec.add_development_dependency('rake', '>= 12.3.3')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quaderno
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recrea
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.13'
19
+ version: 0.21.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.13'
26
+ version: 0.21.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.22.6
61
+ version: '3.18'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.22.6
68
+ version: '3.18'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: vcr
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -166,6 +166,7 @@ files:
166
166
  - lib/quaderno-ruby/report.rb
167
167
  - lib/quaderno-ruby/report_request.rb
168
168
  - lib/quaderno-ruby/tax.rb
169
+ - lib/quaderno-ruby/transaction.rb
169
170
  - lib/quaderno-ruby/version.rb
170
171
  - lib/quaderno-ruby/webhook.rb
171
172
  - quaderno.gemspec