quaderno 1.14.0 → 1.15.1

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +56 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/Gemfile +2 -15
  6. data/README.md +1 -1
  7. data/Rakefile +4 -50
  8. data/changelog.md +9 -0
  9. data/lib/quaderno-ruby.rb +3 -4
  10. data/lib/quaderno-ruby/base.rb +106 -108
  11. data/lib/quaderno-ruby/behavior/block.rb +17 -19
  12. data/lib/quaderno-ruby/behavior/crud.rb +93 -95
  13. data/lib/quaderno-ruby/behavior/deliver.rb +16 -18
  14. data/lib/quaderno-ruby/behavior/payment.rb +32 -34
  15. data/lib/quaderno-ruby/behavior/retrieve.rb +23 -25
  16. data/lib/quaderno-ruby/contact.rb +6 -8
  17. data/lib/quaderno-ruby/credit.rb +10 -12
  18. data/lib/quaderno-ruby/document_item.rb +1 -3
  19. data/lib/quaderno-ruby/estimate.rb +5 -7
  20. data/lib/quaderno-ruby/evidence.rb +5 -7
  21. data/lib/quaderno-ruby/exceptions/exceptions.rb +42 -44
  22. data/lib/quaderno-ruby/expense.rb +6 -8
  23. data/lib/quaderno-ruby/helpers/authentication.rb +16 -18
  24. data/lib/quaderno-ruby/income.rb +8 -10
  25. data/lib/quaderno-ruby/invoice.rb +9 -11
  26. data/lib/quaderno-ruby/item.rb +3 -6
  27. data/lib/quaderno-ruby/payment.rb +1 -3
  28. data/lib/quaderno-ruby/receipt.rb +6 -8
  29. data/lib/quaderno-ruby/recurring.rb +4 -7
  30. data/lib/quaderno-ruby/report.rb +56 -58
  31. data/lib/quaderno-ruby/tax.rb +45 -47
  32. data/lib/quaderno-ruby/version.rb +3 -0
  33. data/lib/quaderno-ruby/webhook.rb +3 -5
  34. data/quaderno.gemspec +28 -148
  35. metadata +83 -84
  36. data/Gemfile.lock +0 -91
  37. data/VERSION +0 -1
  38. data/test/fixtures/quaderno_cassettes/.DS_Store +0 -0
  39. data/test/fixtures/quaderno_cassettes/all_contacts.yml +0 -52
  40. data/test/fixtures/quaderno_cassettes/all_contacts_by_access_token.yml +0 -56
  41. data/test/fixtures/quaderno_cassettes/all_contacts_by_authentication_token.yml +0 -57
  42. data/test/fixtures/quaderno_cassettes/all_estimates.yml +0 -52
  43. data/test/fixtures/quaderno_cassettes/all_expenses.yml +0 -55
  44. data/test/fixtures/quaderno_cassettes/all_invoices.yml +0 -56
  45. data/test/fixtures/quaderno_cassettes/all_items.yml +0 -46
  46. data/test/fixtures/quaderno_cassettes/all_receipts.yml +0 -53
  47. data/test/fixtures/quaderno_cassettes/all_webhooks.yml +0 -214
  48. data/test/fixtures/quaderno_cassettes/create_estimate_on_downgraded_API.yml +0 -156
  49. data/test/fixtures/quaderno_cassettes/create_expense_on_downgraded_API.yml +0 -278
  50. data/test/fixtures/quaderno_cassettes/create_invoice_on_downgraded_API.yml +0 -159
  51. data/test/fixtures/quaderno_cassettes/create_receipt_on_downgraded_API.yml +0 -196
  52. data/test/fixtures/quaderno_cassettes/deleted_contact.yml +0 -187
  53. data/test/fixtures/quaderno_cassettes/deleted_contact_by_access_token.yml +0 -199
  54. data/test/fixtures/quaderno_cassettes/deleted_contact_by_authentication_token.yml +0 -199
  55. data/test/fixtures/quaderno_cassettes/deleted_estimate.yml +0 -187
  56. data/test/fixtures/quaderno_cassettes/deleted_expense.yml +0 -189
  57. data/test/fixtures/quaderno_cassettes/deleted_invoice.yml +0 -190
  58. data/test/fixtures/quaderno_cassettes/deleted_item.yml +0 -128
  59. data/test/fixtures/quaderno_cassettes/deleted_receipt.yml +0 -223
  60. data/test/fixtures/quaderno_cassettes/deleted_webhook.yml +0 -257
  61. data/test/fixtures/quaderno_cassettes/delivered_estimate.yml +0 -136
  62. data/test/fixtures/quaderno_cassettes/delivered_invoice.yml +0 -143
  63. data/test/fixtures/quaderno_cassettes/delivered_receipt.yml +0 -140
  64. data/test/fixtures/quaderno_cassettes/evidence_invoice.yml +0 -98
  65. data/test/fixtures/quaderno_cassettes/found_contact.yml +0 -95
  66. data/test/fixtures/quaderno_cassettes/found_contact_by_access_token.yml +0 -99
  67. data/test/fixtures/quaderno_cassettes/found_contact_by_authentication_token.yml +0 -100
  68. data/test/fixtures/quaderno_cassettes/found_estimate.yml +0 -97
  69. data/test/fixtures/quaderno_cassettes/found_expense.yml +0 -99
  70. data/test/fixtures/quaderno_cassettes/found_invoice.yml +0 -100
  71. data/test/fixtures/quaderno_cassettes/found_item.yml +0 -91
  72. data/test/fixtures/quaderno_cassettes/found_receipt.yml +0 -98
  73. data/test/fixtures/quaderno_cassettes/found_webhook.yml +0 -130
  74. data/test/fixtures/quaderno_cassettes/new_contact.yml +0 -48
  75. data/test/fixtures/quaderno_cassettes/new_contact_by_access_token.yml +0 -48
  76. data/test/fixtures/quaderno_cassettes/new_contact_by_authentication_token.yml +0 -48
  77. data/test/fixtures/quaderno_cassettes/new_estimate.yml +0 -137
  78. data/test/fixtures/quaderno_cassettes/new_evidence.yml +0 -48
  79. data/test/fixtures/quaderno_cassettes/new_expense.yml +0 -189
  80. data/test/fixtures/quaderno_cassettes/new_invoice.yml +0 -137
  81. data/test/fixtures/quaderno_cassettes/new_item.yml +0 -48
  82. data/test/fixtures/quaderno_cassettes/new_receipt.yml +0 -173
  83. data/test/fixtures/quaderno_cassettes/new_webhook.yml +0 -87
  84. data/test/fixtures/quaderno_cassettes/paid_expense.yml +0 -98
  85. data/test/fixtures/quaderno_cassettes/paid_invoice.yml +0 -99
  86. data/test/fixtures/quaderno_cassettes/rate_limit.yml +0 -46
  87. data/test/fixtures/quaderno_cassettes/unpay_an_expense.yml +0 -138
  88. data/test/fixtures/quaderno_cassettes/unpay_an_invoice.yml +0 -138
  89. data/test/fixtures/quaderno_cassettes/updated_contact.yml +0 -97
  90. data/test/fixtures/quaderno_cassettes/updated_contact_by_access_token.yml +0 -101
  91. data/test/fixtures/quaderno_cassettes/updated_contact_by_authentication_token.yml +0 -102
  92. data/test/fixtures/quaderno_cassettes/updated_estimate.yml +0 -185
  93. data/test/fixtures/quaderno_cassettes/updated_expense.yml +0 -184
  94. data/test/fixtures/quaderno_cassettes/updated_invoice.yml +0 -184
  95. data/test/fixtures/quaderno_cassettes/updated_item.yml +0 -93
  96. data/test/fixtures/quaderno_cassettes/updated_receipt.yml +0 -220
  97. data/test/fixtures/quaderno_cassettes/updated_webhook.yml +0 -175
  98. data/test/fixtures/quaderno_cassettes/validate_invalid_VAT_number.yml +0 -44
  99. data/test/fixtures/quaderno_cassettes/validate_valid_VAT_number.yml +0 -44
  100. data/test/helper.rb +0 -32
  101. data/test/unit/test_quaderno_contacts.rb +0 -83
  102. data/test/unit/test_quaderno_contacts_thread_safe.rb +0 -104
  103. data/test/unit/test_quaderno_estimates.rb +0 -155
  104. data/test/unit/test_quaderno_evidences.rb +0 -41
  105. data/test/unit/test_quaderno_expenses.rb +0 -162
  106. data/test/unit/test_quaderno_invoices.rb +0 -177
  107. data/test/unit/test_quaderno_items.rb +0 -84
  108. data/test/unit/test_quaderno_receipts.rb +0 -156
  109. data/test/unit/test_quaderno_tax.rb +0 -46
  110. data/test/unit/test_quaderno_webhooks.rb +0 -93
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49d80c0d072a8aab6e98b5ad65b1199fa69f5456
4
- data.tar.gz: 39ec40ab5595d592c86143f64d54f7609c1b7ac0
3
+ metadata.gz: 32220859b00bca2665db02c3b16b78b2c291d1d3
4
+ data.tar.gz: 9821325ecf15b3ff58ce8877ed6f160af1966fcb
5
5
  SHA512:
6
- metadata.gz: 38fdadda9ffe62b7d83ab6daa5de07966ba459daae1143a043d2e80a8ccdd5fa196c225c170855b4237d3d264a305733b1f00bf13f7b00eaef7e251ea5ffc3a8
7
- data.tar.gz: 8f0d1fd974e747572cd4ab53ddc58fca3912178497aea7607c48d5b599e7dc12cdb0ad8341cd3f150f7334784d835c899a61fac034068aef3796086cd14aaafb
6
+ metadata.gz: 5eafdb13dae89b85b6ffcb7123854a6f6a96c9ec7d4c8477541a05f9761cd0002d002aa5bdf31a64add59ec8395687df9dff4cfad05a41306dde474412399324
7
+ data.tar.gz: dbe323f4e55ca48b7c9a510eb63d685d474e2120261e8d77a3ad7ab789ef205cbbd989abb41e5918bea019154d2266170ab5fcc517d43e73cc8abfb9e14e2c8c
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ # rcov generated
2
+ coverage
3
+ coverage.data
4
+
5
+ # rdoc generated
6
+ rdoc
7
+
8
+ # yard generated
9
+ doc
10
+ .yardoc
11
+
12
+ # bundler
13
+ .bundle
14
+
15
+ Gemfile.lock
16
+
17
+ # jeweler generated
18
+ pkg
19
+
20
+ /Gemfile.lock
21
+
22
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
23
+ #
24
+ # * Create a file at ~/.gitignore
25
+ # * Include files you want ignored
26
+ # * Run: git config --global core.excludesfile ~/.gitignore
27
+ #
28
+ # After doing this, these files will be ignored in all your git projects,
29
+ # saving you from having to 'pollute' every project you touch with them
30
+ #
31
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
32
+ #
33
+ # For MacOS:
34
+ #
35
+ #.DS_Store
36
+
37
+ # For TextMate
38
+ #*.tmproj
39
+ #tmtags
40
+
41
+ # For emacs:
42
+ #*~
43
+ #\#*
44
+ #.\#*
45
+
46
+ # For vim:
47
+ #*.swp
48
+
49
+ # For redcar:
50
+ #.redcar
51
+
52
+ # For rubinius:
53
+ #*.rbc
54
+
55
+ *.gem
56
+ pkg/*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile CHANGED
@@ -1,17 +1,4 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'httparty', '~> 0.13.1'
4
-
5
- group :development do
6
- gem 'jeweler', '~> 2.0.1'
7
- gem 'rdoc', '~> 3.12'
8
- end
9
-
10
- group :test do
11
- gem 'bundler', '>= 1.0.0'
12
- gem 'fakeweb'
13
- gem 'minitest', '~> 4.7.5 '
14
- gem 'simplecov', '>= 0'
15
- gem 'shoulda', '>= 0'
16
- gem 'vcr', :require => 'vcr'
17
- end
3
+ # Specify your gem's dependencies in valabn.gemspec
4
+ gemspec
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 1.14.0 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
5
+ Current version is 1.15.1 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
6
6
 
7
7
  ## Installation & Configuration
8
8
 
data/Rakefile CHANGED
@@ -1,52 +1,6 @@
1
- # encoding: utf-8
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
2
3
 
3
- require 'rubygems'
4
- require 'bundler'
5
- begin
6
- Bundler.setup(:default, :development)
7
- rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
10
- exit e.status_code
11
- end
12
- require 'rake'
4
+ RSpec::Core::RakeTask.new(:spec)
13
5
 
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "quaderno"
18
- gem.homepage = "http://github.com/quaderno/quaderno-ruby"
19
- gem.license = "MIT"
20
- gem.summary = %Q{one-line summary of your gem}
21
- gem.description = %Q{ A ruby wrapper for Quaderno API }
22
- gem.email = "carlos@recrea.es"
23
- gem.authors = ["Recrea"]
24
- # dependencies defined in Gemfile
25
- end
26
- Jeweler::RubygemsDotOrgTasks.new
27
-
28
- require 'rake/testtask'
29
- Rake::TestTask.new(:test) do |test|
30
- test.libs << 'lib' << 'test'
31
- test.pattern = 'test/**/test_*.rb'
32
- test.verbose = true
33
- end
34
-
35
- desc "Code coverage detail"
36
- task :simplecov do
37
- ENV['COVERAGE'] = "true"
38
- Rake::Task['test'].execute
39
- end
40
-
41
-
42
- task :default => :test
43
-
44
- require 'rdoc/task'
45
- Rake::RDocTask.new do |rdoc|
46
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
47
-
48
- rdoc.rdoc_dir = 'rdoc'
49
- rdoc.title = "quaderno-ruby #{version}"
50
- rdoc.rdoc_files.include('README*')
51
- rdoc.rdoc_files.include('lib/**/*.rb')
52
- end
6
+ task :default => :spec
data/changelog.md CHANGED
@@ -1,4 +1,13 @@
1
1
  #Changelog
2
+ ##1.15.1
3
+ * Fix `Quaderno` load order.
4
+
5
+ ##1.15.0
6
+ * Removed `jeweler` and updated the gem structure.
7
+
8
+ ##1.14.0
9
+ * Added `domestic_taxes`, `sales_taxes`, `vat_moss`, `ec_sales` and `international_taxes` to `Quaderno::Report`
10
+
2
11
  ##1.13.2
3
12
  * Added index method to `Quaderno::Tax` as `Quaderno::Tax.all()`.
4
13
 
data/lib/quaderno-ruby.rb CHANGED
@@ -1,3 +1,6 @@
1
+ class Quaderno
2
+ end
3
+
1
4
  require 'ostruct'
2
5
 
3
6
  require 'quaderno-ruby/exceptions/exceptions'
@@ -6,7 +9,3 @@ require 'quaderno-ruby/collection'
6
9
 
7
10
  %w(block crud deliver payment retrieve).each { |filename| require "quaderno-ruby/behavior/#{filename}" }
8
11
  %w(base contact item invoice receipt credit income estimate expense recurring document_item report evidence payment webhook tax).each { |filename| require "quaderno-ruby/#{ filename }" }
9
-
10
- module Quaderno
11
-
12
- end
@@ -1,136 +1,134 @@
1
- module Quaderno
2
- require 'httparty'
3
- require 'json'
4
-
5
- class Base < OpenStruct
6
- include HTTParty
7
- include Quaderno::Exceptions
8
- include Quaderno::Behavior::Crud
9
- include Quaderno::Helpers::Authentication
10
-
11
- PRODUCTION_URL = 'https://quadernoapp.com/api/'
12
- SANDBOX_URL = 'http://sandbox-quadernoapp.com/api/'
13
-
14
- @@auth_token = nil
15
- @@rate_limit_info = nil
16
- @@api_version = nil
17
- @@url = PRODUCTION_URL
18
-
19
- # Class methods
20
- def self.api_model(klass)
21
- instance_eval <<-END
22
- def api_model
23
- #{klass}
24
- end
25
- END
26
- class_eval <<-END
27
- def api_model
28
- #{klass}
29
- end
30
- END
31
- end
32
-
33
- def self.configure
34
- yield self
35
- end
36
-
37
- def self.api_version=(api_version)
38
- @@api_version = api_version
39
- end
40
-
41
- def self.auth_token=(auth_token)
42
- @@auth_token = auth_token
43
- end
44
-
45
- def self.url=(url)
46
- @@url = url
47
- end
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ class Quaderno::Base < OpenStruct
5
+ include HTTParty
6
+ include Quaderno::Exceptions
7
+ include Quaderno::Behavior::Crud
8
+ include Quaderno::Helpers::Authentication
9
+
10
+ PRODUCTION_URL = 'https://quadernoapp.com/api/'
11
+ SANDBOX_URL = 'http://sandbox-quadernoapp.com/api/'
12
+
13
+ @@auth_token = nil
14
+ @@rate_limit_info = nil
15
+ @@api_version = nil
16
+ @@url = PRODUCTION_URL
17
+
18
+ # Class methods
19
+ def self.api_model(klass)
20
+ instance_eval <<-END
21
+ def api_model
22
+ #{klass}
23
+ end
24
+ END
25
+ class_eval <<-END
26
+ def api_model
27
+ #{klass}
28
+ end
29
+ END
30
+ end
48
31
 
49
- def self.authorization(auth_token, mode = nil)
50
- mode ||= :production
51
- url = mode == :sandbox ? SANDBOX_URL : PRODUCTION_URL
52
- response = get("#{url}authorization.json", basic_auth: { username: auth_token }, headers: version_header)
32
+ def self.configure
33
+ yield self
34
+ end
53
35
 
54
- if response.code == 200
55
- response.parsed_response
56
- else
57
- raise(Quaderno::Exceptions::InvalidSubdomainOrToken, 'Invalid subdomain or token')
58
- end
59
- end
36
+ def self.api_version=(api_version)
37
+ @@api_version = api_version
38
+ end
60
39
 
61
- #Check the connection
62
- def self.ping(options = {})
63
- begin
64
- options[:auth_token] ||= auth_token
65
- options[:api_url] ||= url
40
+ def self.auth_token=(auth_token)
41
+ @@auth_token = auth_token
42
+ end
66
43
 
67
- authentication = get_authentication(options)
44
+ def self.url=(url)
45
+ @@url = url
46
+ end
68
47
 
69
- party_response = get("#{authentication[:url]}ping.json",
70
- basic_auth: authentication[:basic_auth],
71
- headers: version_header.merge(authentication[:headers])
72
- )
48
+ def self.authorization(auth_token, mode = nil)
49
+ mode ||= :production
50
+ url = mode == :sandbox ? SANDBOX_URL : PRODUCTION_URL
51
+ response = get("#{url}authorization.json", basic_auth: { username: auth_token }, headers: version_header)
73
52
 
74
- check_exception_for(party_response, { subdomain_or_token: true })
75
- rescue Errno::ECONNREFUSED
76
- return false
77
- end
78
- true
53
+ if response.code == 200
54
+ response.parsed_response
55
+ else
56
+ raise(Quaderno::Exceptions::InvalidSubdomainOrToken, 'Invalid subdomain or token')
79
57
  end
58
+ end
80
59
 
81
- def self.me(options = {})
60
+ #Check the connection
61
+ def self.ping(options = {})
62
+ begin
82
63
  options[:auth_token] ||= auth_token
83
64
  options[:api_url] ||= url
84
65
 
85
66
  authentication = get_authentication(options)
86
67
 
87
- party_response = get("#{authentication[:url]}me.json",
68
+ party_response = get("#{authentication[:url]}ping.json",
88
69
  basic_auth: authentication[:basic_auth],
89
70
  headers: version_header.merge(authentication[:headers])
90
71
  )
91
72
 
92
73
  check_exception_for(party_response, { subdomain_or_token: true })
93
-
94
- party_response.parsed_response
74
+ rescue Errno::ECONNREFUSED
75
+ return false
95
76
  end
77
+ true
78
+ end
96
79
 
97
- #Returns the rate limit information: limit and remaining requests
98
- def self.rate_limit_info
99
- party_response = get("#{@@url}ping.json", basic_auth: { username: auth_token }, headers: version_header)
100
- check_exception_for(party_response, { subdomain_or_token: true })
101
- @@rate_limit_info = { reset: party_response.headers['x-ratelimit-reset'].to_i, remaining: party_response.headers["x-ratelimit-remaining"].to_i }
102
- end
80
+ def self.me(options = {})
81
+ options[:auth_token] ||= auth_token
82
+ options[:api_url] ||= url
103
83
 
104
- # Instance methods
105
- def to_hash
106
- self.marshal_dump
107
- end
84
+ authentication = get_authentication(options)
108
85
 
109
- private
110
- # Class methods
111
- def self.auth_token
112
- @@auth_token
113
- end
86
+ party_response = get("#{authentication[:url]}me.json",
87
+ basic_auth: authentication[:basic_auth],
88
+ headers: version_header.merge(authentication[:headers])
89
+ )
114
90
 
115
- def self.url
116
- @@url
117
- end
91
+ check_exception_for(party_response, { subdomain_or_token: true })
118
92
 
119
- def self.subdomain
120
- @_subdomain = @@subdomain
121
- end
93
+ party_response.parsed_response
94
+ end
122
95
 
123
- #Set or returns the model path for the url
124
- def self.api_path(api_path = nil)
125
- @_api_path ||= api_path
126
- end
96
+ #Returns the rate limit information: limit and remaining requests
97
+ def self.rate_limit_info
98
+ party_response = get("#{@@url}ping.json", basic_auth: { username: auth_token }, headers: version_header)
99
+ check_exception_for(party_response, { subdomain_or_token: true })
100
+ @@rate_limit_info = { reset: party_response.headers['x-ratelimit-reset'].to_i, remaining: party_response.headers["x-ratelimit-remaining"].to_i }
101
+ end
127
102
 
128
- def self.is_a_document?(document = nil)
129
- @_document ||= document
130
- end
103
+ # Instance methods
104
+ def to_hash
105
+ self.marshal_dump
106
+ end
131
107
 
132
- def self.version_header
133
- { 'Accept' => @@api_version.to_i.zero? ? "application/json" : "application/json; api_version=#{@@api_version.to_i}"}
134
- end
108
+ private
109
+ # Class methods
110
+ def self.auth_token
111
+ @@auth_token
112
+ end
113
+
114
+ def self.url
115
+ @@url
116
+ end
117
+
118
+ def self.subdomain
119
+ @_subdomain = @@subdomain
120
+ end
121
+
122
+ #Set or returns the model path for the url
123
+ def self.api_path(api_path = nil)
124
+ @_api_path ||= api_path
125
+ end
126
+
127
+ def self.is_a_document?(document = nil)
128
+ @_document ||= document
129
+ end
130
+
131
+ def self.version_header
132
+ { 'Accept' => @@api_version.to_i.zero? ? "application/json" : "application/json; api_version=#{@@api_version.to_i}"}
135
133
  end
136
- end
134
+ end
@@ -1,28 +1,26 @@
1
- module Quaderno
2
- module Behavior
3
- module Block
4
- def self.included(receiver)
5
- receiver.send :extend, ClassMethods
6
- end
1
+ module Quaderno::Behavior
2
+ module Block
3
+ def self.included(receiver)
4
+ receiver.send :extend, ClassMethods
5
+ end
7
6
 
8
- module ClassMethods
9
- include Quaderno::Helpers::Authentication
7
+ module ClassMethods
8
+ include Quaderno::Helpers::Authentication
10
9
 
11
- def block(id, options = {})
12
- authentication = get_authentication(options.merge(api_model: api_model))
10
+ def block(id, options = {})
11
+ authentication = get_authentication(options.merge(api_model: api_model))
13
12
 
14
13
 
15
- response = put("#{authentication[:url]}#{api_model.api_path}/#{id}/block.json",
16
- basic_auth: authentication[:basic_auth],
17
- headers: version_header.merge(authentication[:headers])
18
- )
14
+ response = put("#{authentication[:url]}#{api_model.api_path}/#{id}/block.json",
15
+ basic_auth: authentication[:basic_auth],
16
+ headers: version_header.merge(authentication[:headers])
17
+ )
19
18
 
20
- check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
21
- doc = response.parsed_response
19
+ check_exception_for(response, { rate_limit: true, subdomain_or_token: true, id: true })
20
+ doc = response.parsed_response
22
21
 
23
- new doc
24
- end
22
+ new doc
25
23
  end
26
24
  end
27
25
  end
28
- end
26
+ end