quaderno 1.5.2 → 1.5.3
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 +4 -4
- data/README.md +3 -26
- data/VERSION +1 -1
- data/changelog.md +5 -0
- data/lib/quaderno-ruby/base.rb +4 -3
- data/lib/quaderno-ruby/exceptions/exceptions.rb +6 -0
- data/quaderno.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 743fadc9baad6881ff2e39d6e9784dd482596859
|
4
|
+
data.tar.gz: 089e04d74bfe23087315f9f44befd55a409adeba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd454d87f075a5243cf63099075aa2f72135fcdd88b9cd1403933a086b360050603923ddf2ce53d1a7607e92d7505f5ec2dc87bc7f5b84301af056f2d77ed2c8
|
7
|
+
data.tar.gz: e414be003e40de2ef81fa2caa9c8b6b6eabb31d3614f1af0049e2fbcd4cf1d7611dca6caa965c04cfe7c5e5184c96ba26d8a140adce97c8e316e6396a2f272d2
|
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.5.
|
6
|
+
Current version is 1.5.3. See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
|
7
7
|
|
8
8
|
## Installation & Configuration
|
9
9
|
|
@@ -50,10 +50,10 @@ This will return true if the service is up or false if it is not.
|
|
50
50
|
## Check the rate limit
|
51
51
|
|
52
52
|
```ruby
|
53
|
-
Quaderno::Base.rate_limit_info #=> {
|
53
|
+
Quaderno::Base.rate_limit_info #=> {:reset=>4, :remaining=>0}
|
54
54
|
```
|
55
55
|
|
56
|
-
This will return a hash with information about the rate limit and your remaining
|
56
|
+
This will return a hash with information about the seconds until the rate limit reset and your remaining requests per minute ([check the API documentation for more information](https://github.com/quaderno/quaderno-api#rate-limiting)).
|
57
57
|
|
58
58
|
## Reading the values
|
59
59
|
|
@@ -358,29 +358,6 @@ will update the specified webhook with the data of the hash passed as second par
|
|
358
358
|
will delete the webhook with the id passed as parameter.
|
359
359
|
|
360
360
|
|
361
|
-
## Managing transactions
|
362
|
-
|
363
|
-
### Finding a transaction
|
364
|
-
```ruby
|
365
|
-
Quaderno::Transaction.find(id) #=> Quaderno::Transaction
|
366
|
-
```
|
367
|
-
|
368
|
-
will return the transaction with the id passed as parameter.
|
369
|
-
|
370
|
-
### Creating a new transaction
|
371
|
-
```ruby
|
372
|
-
Quaderno::Transaction.create(params) #=> Quaderno::Transaction
|
373
|
-
```
|
374
|
-
|
375
|
-
will create a transaction using the information of the hash passed as parameter and return an instance of Quaderno::Transaction with the created transaction.
|
376
|
-
|
377
|
-
|
378
|
-
### Deleting a transaction
|
379
|
-
```ruby
|
380
|
-
Quaderno::Transaction.delete(id) #=> Boolean
|
381
|
-
```
|
382
|
-
will delete the transaction with the id passed as parameter.
|
383
|
-
|
384
361
|
|
385
362
|
## Taxes
|
386
363
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.3
|
data/changelog.md
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
#Changelog
|
2
|
+
##1.5.3
|
3
|
+
* Update `rate_limit_info` to fit the new rate limit
|
4
|
+
* Remove transaction information from README (future resource name change)
|
5
|
+
* Added new throttle limit exception (will be activated in future releases)
|
6
|
+
|
2
7
|
##1.5.1 and 1.5.2
|
3
8
|
* Remove debugger
|
4
9
|
* `Quaderno::Exceptions::RequiredFieldsEmpty` replaced with `Quaderno::Exceptions::RequiredFieldsEmptyOrInvalid`
|
data/lib/quaderno-ruby/base.rb
CHANGED
@@ -32,7 +32,7 @@ module Quaderno
|
|
32
32
|
|
33
33
|
def self.configure
|
34
34
|
yield self
|
35
|
-
@@base_url = @@environment == :sandbox && !@@subdomain.nil? ? "http://#{@@subdomain}.
|
35
|
+
@@base_url = @@environment == :sandbox && !@@subdomain.nil? ? "http://#{@@subdomain}.lvh.me:3000" : "https://#{@@subdomain}.quadernoapp.com"
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.environment=(mode)
|
@@ -62,6 +62,7 @@ module Quaderno
|
|
62
62
|
def self.ping
|
63
63
|
begin
|
64
64
|
party_response = get("#{@@base_url}/api/v1/ping.json", basic_auth: { username: auth_token })
|
65
|
+
check_exception_for(party_response, { subdomain_or_token: true })
|
65
66
|
rescue Errno::ECONNREFUSED
|
66
67
|
return false
|
67
68
|
end
|
@@ -71,9 +72,9 @@ module Quaderno
|
|
71
72
|
#Returns the rate limit information: limit and remaining requests
|
72
73
|
def self.rate_limit_info
|
73
74
|
party_response = get("#{@@base_url}/api/v1/ping.json", basic_auth: { username: auth_token })
|
74
|
-
|
75
|
+
check_exception_for(party_response, { subdomain_or_token: true })
|
76
|
+
@@rate_limit_info = { reset: party_response.headers['x-ratelimit-reset'].to_i, remaining: party_response.headers["x-ratelimit-remaining"].to_i }
|
75
77
|
end
|
76
|
-
|
77
78
|
|
78
79
|
# Instance methods
|
79
80
|
def to_hash
|
@@ -15,12 +15,18 @@ module Quaderno
|
|
15
15
|
class RequiredFieldsEmptyOrInvalid < Exception
|
16
16
|
end
|
17
17
|
|
18
|
+
class ThrottleLimitExceeded < Exception
|
19
|
+
end
|
20
|
+
|
18
21
|
def self.included(receiver)
|
19
22
|
receiver.send :extend, ClassMethods
|
20
23
|
end
|
21
24
|
|
22
25
|
module ClassMethods
|
23
26
|
def check_exception_for(party_response, params = {})
|
27
|
+
if params[:throttle_limit],nil == false
|
28
|
+
raise(Quaderno::Exceptions::ThrottleLimitExceeded, 'Throttle limit exceeded, please try again later') if party_response.response.class == Net::HTTPServiceUnavailable
|
29
|
+
end
|
24
30
|
if params[:rate_limit].nil? == false
|
25
31
|
raise(Quaderno::Exceptions::RateLimitExceeded, 'Rate limit exceeded') if party_response.response.class == Net::HTTPForbidden
|
26
32
|
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.5.
|
5
|
+
# stub: quaderno 1.5.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "quaderno"
|
9
|
-
s.version = "1.5.
|
9
|
+
s.version = "1.5.3"
|
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 = "2014-12-
|
14
|
+
s.date = "2014-12-16"
|
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.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recrea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|