quaderno 1.6.1 → 1.7.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
  SHA1:
3
- metadata.gz: 10e786f848a333e58dafe450b1fcb622a3cbcf13
4
- data.tar.gz: fddcc9ef2fa5114cccb87ccd468ad56b1e99b05c
3
+ metadata.gz: bca4eb12a813d217d7bfdb17a51adae185c35aa5
4
+ data.tar.gz: b31d19f51e8459874f9396e58dd9211a73f5d45e
5
5
  SHA512:
6
- metadata.gz: 04264160f3ba28f6befa0a8d08c6a2af0ecab800e97f5ec2772f3799bc0cd3939dde8ec2f301b07dfffbf7cf456a089e645218ab64f19dd1e6c4f16d476689dc
7
- data.tar.gz: 72a81ae2697a902ac166eaa9c0feeed11afa2f4fcd8fe8767d08b9feb00bd6f12b26550f6cbde11aa0aad30802d1d6accd509b7db600a2a4d5ca0ad9ac91dc8c
6
+ metadata.gz: a57d5344bb40962831c8cc559a42b380f63729103aa2bc9a3f9afc5ce42fdbc74c195b9c3a419c193b763cfd741da3f282c16807f58a03064a8171605976feb9
7
+ data.tar.gz: cbb1a82722e9951ebec35812e58d16b7be184b893d7848b9d6a3bce4d6a72a67316ab0330c1f09bf0310376fe1e87cd974fcaeebf0e246b5179e4207eaaa2c91
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Quaderno-ruby is a ruby wrapper for [Quaderno API] (https://github.com/quaderno/quaderno-api).
4
4
  As the API, it's mostly CRUD.
5
5
 
6
- Current version is 1.6.0. See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
6
+ Current version is 1.7.0 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
7
7
 
8
8
  ## Installation & Configuration
9
9
 
@@ -389,6 +389,47 @@ will update the specified expense with the data of the hash passed as second par
389
389
  will delete the expense with the id passed as parameter.
390
390
 
391
391
 
392
+ ## Managing recurrings
393
+
394
+ ### Getting recurrings
395
+ ```ruby
396
+ Quaderno::Recurring.all #=> Array
397
+ Quaderno::Recurring.all(page: 1) #=> Array
398
+ ```
399
+
400
+ will return an array with all your recurring notes on the first page. You can also pass query strings using the attribute :q in order to filter the results by contact name, :state to filter by state or :date to filter by date
401
+
402
+ ### Finding an recurring
403
+ ```ruby
404
+ Quaderno::Recurring.find(id) #=> Quaderno::Recurring
405
+ ```
406
+
407
+ will return the recurring with the id passed as parameter.
408
+
409
+ ### Creating a new recurring
410
+
411
+ ```ruby
412
+ Quaderno::Recurring.create(params) #=> Quaderno::Recurring
413
+ ```
414
+
415
+ will create an recurring using the information of the hash passed as parameter.
416
+
417
+ ### Updating an existing recurring
418
+ ```ruby
419
+ Quaderno::Recurring.update(id, params) #=> Quaderno::Recurring
420
+ ```
421
+
422
+ will update the specified recurring with the data of the hash passed as second parameter.
423
+
424
+ ### Deleting an recurring
425
+
426
+ ```ruby
427
+ Quaderno::Recurring.delete(id) #=> Boolean
428
+ ```
429
+
430
+ will delete the recurring with the id passed as parameter.
431
+
432
+
392
433
  ## Managing webhooks
393
434
 
394
435
  ### Getting webhooks
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.1
1
+ 1.7.0
data/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  #Changelog
2
- ##1.6.0
2
+ ##1.7.0
3
+ * Added recurring documents
4
+ * Raise existent exception
5
+
6
+ ##1.6.1
7
+ * Fixed typo from old version released as 1.6.0
8
+
9
+ ##1.6.0 (yanked)
3
10
  * Crud module refactor
4
11
  * Added support for credit notes
5
12
 
@@ -13,7 +13,7 @@ module Quaderno
13
13
  # Parse nested elements of a document
14
14
  def parse(element)
15
15
  payments_collection = []
16
- element['payments'].each do |payment|
16
+ (element['payments'] || []).each do |payment|
17
17
  payments_collection << api_model.to_instance(Quaderno::Payment, payment)
18
18
  end unless api_model == Quaderno::Estimate
19
19
  element['payments'] = payments_collection
@@ -37,7 +37,7 @@ module Quaderno
37
37
  raise(Quaderno::Exceptions::InvalidID, "Invalid #{ api_model } instance identifier") if (party_response.response.class == Net::HTTPInternalServerError) || (party_response.response.class == Net::HTTPNotFound)
38
38
  end
39
39
  if params[:required_fields].nil? == false
40
- raise(Quaderno::Exceptions::RequiredFieldsEmpty, "#{ JSON::parse party_response.body }") if party_response.response.class == Net::HTTPUnprocessableEntity
40
+ raise(Quaderno::Exceptions::RequiredFieldsEmptyOrInvalid, "#{ JSON::parse party_response.body }") if party_response.response.class == Net::HTTPUnprocessableEntity
41
41
  end
42
42
  if params[:has_documents].nil? == false
43
43
  raise(Quaderno::Exceptions::HasAssociatedDocuments, "#{ JSON::parse party_response.body }") if party_response.response.class == Net::HTTPClientError
@@ -0,0 +1,8 @@
1
+ module Quaderno
2
+ class Recurring < Base
3
+
4
+ api_model Quaderno::Recurring
5
+ api_path 'recurring'
6
+ is_a_document? true
7
+ end
8
+ end
data/lib/quaderno-ruby.rb CHANGED
@@ -2,7 +2,7 @@ require 'ostruct'
2
2
 
3
3
  require 'quaderno-ruby/exceptions/exceptions'
4
4
  %w(crud deliver payment).each { |filename| require "quaderno-ruby/behavior/#{ filename }" }
5
- %w(base contact item invoice credit estimate expense document_item payment webhook tax).each { |filename| require "quaderno-ruby/#{ filename }" }
5
+ %w(base contact item invoice credit estimate expense recurring document_item payment webhook tax).each { |filename| require "quaderno-ruby/#{ filename }" }
6
6
 
7
7
  module Quaderno
8
8
 
data/quaderno.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: quaderno 1.6.1 ruby lib
5
+ # stub: quaderno 1.7.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "quaderno"
9
- s.version = "1.6.1"
9
+ s.version = "1.7.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Recrea"]
14
- s.date = "2015-04-13"
14
+ s.date = "2015-05-13"
15
15
  s.description = " A ruby wrapper for Quaderno API "
16
16
  s.email = "carlos@recrea.es"
17
17
  s.extra_rdoc_files = [
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
42
42
  "lib/quaderno-ruby/invoice.rb",
43
43
  "lib/quaderno-ruby/item.rb",
44
44
  "lib/quaderno-ruby/payment.rb",
45
+ "lib/quaderno-ruby/recurring.rb",
45
46
  "lib/quaderno-ruby/tax.rb",
46
47
  "lib/quaderno-ruby/webhook.rb",
47
48
  "quaderno.gemspec",
@@ -118,7 +118,7 @@ class TestQuadernoEstimate < Test::Unit::TestCase
118
118
  rate_limit_before = Quaderno::Base.rate_limit_info
119
119
  begin
120
120
  rate_limit_after = estimates.first.deliver
121
- rescue Quaderno::Exceptions::RequiredFieldsEmpty
121
+ rescue Quaderno::Exceptions::RequiredFieldsEmptyOrInvalid
122
122
  rate_limit_after = { remaining: (rate_limit_before[:remaining] - 1) }
123
123
  end
124
124
  assert_equal rate_limit_before[:remaining]-1, rate_limit_after[:remaining]
@@ -118,7 +118,7 @@ class TestQuadernoInvoice < Test::Unit::TestCase
118
118
  rate_limit_before = Quaderno::Base.rate_limit_info
119
119
  begin
120
120
  rate_limit_after = invoices.first.deliver
121
- rescue Quaderno::Exceptions::RequiredFieldsEmpty
121
+ rescue Quaderno::Exceptions::RequiredFieldsEmptyOrInvalid
122
122
  rate_limit_after = { remaining: (rate_limit_before[:remaining] - 1) }
123
123
  end
124
124
  assert_equal rate_limit_before[:remaining]-1, rate_limit_after[:remaining]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quaderno
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recrea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-13 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -83,6 +83,7 @@ files:
83
83
  - lib/quaderno-ruby/invoice.rb
84
84
  - lib/quaderno-ruby/item.rb
85
85
  - lib/quaderno-ruby/payment.rb
86
+ - lib/quaderno-ruby/recurring.rb
86
87
  - lib/quaderno-ruby/tax.rb
87
88
  - lib/quaderno-ruby/webhook.rb
88
89
  - quaderno.gemspec