quaderno 1.9.0 → 1.9.1

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: c8752ad69dde9702c70fe935dc295170dbbbedb5
4
- data.tar.gz: 44ab70967522966a4deb25b632d3e2e78b256029
3
+ metadata.gz: c6699c1ffde675d6d20e1bc6a89b411c24a5e684
4
+ data.tar.gz: 56b5cd78c82c019eebe55d28cd100e7f124b047d
5
5
  SHA512:
6
- metadata.gz: 99ffeb8d24d6cd028cbe6eae2aa535ee9f0fcf6222ba726faecc61bc3fe9d45ea07752f6c128d6f55523a0aeae9cdce701aeed5d3c892e8983e62b6f526027b5
7
- data.tar.gz: d7bbdea3bf038efd83f31b1f38d844c00104f5d83c40a22fb7f7a4f138fe68a724ee4ffe09df2b6a981c6967572adad063fe84d2e0f934b67154cc534bcb249b
6
+ metadata.gz: c1ac26cc48424b25301e43fa60a36dfbab5fccf0214e87577b69ca6b2f84f7603e8459a3110c9dc58a5067d4309245dde28f1a1a88a940bc55b59be76680e58d
7
+ data.tar.gz: 79e42d2edfd106aba7cc750e03fe408da27aada6bd96b60e084b83d1a3cf5ec86e683b68cb25fb68b0dc409bbd963cb89a4fefef68f61a70b96b8a98db83c1af
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.8.0 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
6
+ Current version is 1.9.1 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
7
7
 
8
8
  ## Installation & Configuration
9
9
 
@@ -547,10 +547,11 @@ Quaderno-ruby exceptions raise depending on the type of error:
547
547
 
548
548
  ```
549
549
 
550
+ All those exceptions inherit from `Quaderno::Exceptions::BaseException`.
550
551
 
551
552
  ## More information
552
553
 
553
- Remember this is only a ruby wrapper for the original API. If you want more information about the API itself, head to the original [API documentation](https://github.com/quaderno/quaderno-api).
554
+ Remember this is only a ruby wrapper for the original API. If you want more information about the API itself, head to the original [API documentation](https://quaderno.io/docs/api/).
554
555
 
555
556
  ## License
556
557
  (The MIT License)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.0
1
+ 1.9.1
data/changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  #Changelog
2
2
 
3
+ ##1.9.1
4
+ * `Quaderno::Base.authorization` raises `Quaderno::Exceptions::InvalidSubdomainOrToken` instead returning false on wrong credentials
5
+ * Inherit from `StandardError` instead of `Exception` for `Quaderno::Exceptions` by **@mvelikov**
6
+
3
7
  ##1.9.0
4
8
  * Add support for new versioning system
5
9
 
@@ -46,13 +46,14 @@ module Quaderno
46
46
  end
47
47
 
48
48
  def self.authorization(auth_token, mode = nil)
49
- begin
50
- mode ||= :production
51
- url = mode == :sandbox ? SANDBOX_URL : PRODUCTION_URL
52
- party_response = get("#{url}authorization.json", basic_auth: { username: auth_token }, headers: version_header)
53
- return JSON::parse party_response.body
54
- rescue Exception
55
- return false
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)
52
+
53
+ if response.code == 200
54
+ response.parsed_response
55
+ else
56
+ raise(Quaderno::Exceptions::InvalidSubdomainOrToken, 'Invalid subdomain or token')
56
57
  end
57
58
  end
58
59
 
@@ -1,24 +1,27 @@
1
1
  module Quaderno
2
2
  module Exceptions
3
- class InvalidSubdomainOrToken < Exception
3
+ class BaseException < StandardError
4
4
  end
5
5
 
6
- class InvalidID < Exception
6
+ class InvalidSubdomainOrToken < BaseException
7
7
  end
8
8
 
9
- class RateLimitExceeded < Exception
9
+ class InvalidID < BaseException
10
10
  end
11
11
 
12
- class HasAssociatedDocuments < Exception
12
+ class RateLimitExceeded < BaseException
13
13
  end
14
14
 
15
- class RequiredFieldsEmptyOrInvalid < Exception
15
+ class HasAssociatedDocuments < BaseException
16
16
  end
17
17
 
18
- class ThrottleLimitExceeded < Exception
18
+ class RequiredFieldsEmptyOrInvalid < BaseException
19
19
  end
20
20
 
21
- class UnsupportedApiVersion < Exception
21
+ class ThrottleLimitExceeded < BaseException
22
+ end
23
+
24
+ class UnsupportedApiVersion < BaseException
22
25
  end
23
26
 
24
27
  def self.included(receiver)
@@ -30,7 +33,7 @@ module Quaderno
30
33
  raise(Quaderno::Exceptions::UnsupportedApiVersion, 'Unsupported API version') if !!(party_response.body =~ /Unsupported API version/)
31
34
 
32
35
  if params[:throttle_limit].nil? == false
33
- raise(Quaderno::Exceptions::ThrottleLimitExceeded, 'Throttle limit exceeded, please try again later') if party_response.response.class == Net::HTTPServiceUnavailable
36
+ raise(Quaderno::Exceptions::ThrottleLimitExceeded, 'Throttle limit exceeded, please try again later') if party_response.response.class == Net::HTTPServiceUnavailable
34
37
  end
35
38
  if params[:rate_limit].nil? == false
36
39
  raise(Quaderno::Exceptions::RateLimitExceeded, 'Rate limit exceeded') if party_response.response.class == Net::HTTPForbidden
@@ -45,7 +48,7 @@ module Quaderno
45
48
  raise(Quaderno::Exceptions::RequiredFieldsEmptyOrInvalid, party_response.body) if party_response.response.class == Net::HTTPUnprocessableEntity
46
49
  end
47
50
  if params[:has_documents].nil? == false
48
- raise(Quaderno::Exceptions::HasAssociatedDocuments, party_response.body) if party_response.response.class == Net::HTTPClientError
51
+ raise(Quaderno::Exceptions::HasAssociatedDocuments, party_response.body) if party_response.response.class == Net::HTTPClientError
49
52
  end
50
53
  end
51
54
  end
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.9.0 ruby lib
5
+ # stub: quaderno 1.9.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "quaderno"
9
- s.version = "1.9.0"
9
+ s.version = "1.9.1"
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 = "2016-06-17"
14
+ s.date = "2016-06-21"
15
15
  s.description = " A ruby wrapper for Quaderno API "
16
16
  s.email = "carlos@recrea.es"
17
17
  s.extra_rdoc_files = [
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.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Recrea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty