quaderno 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -4
- data/VERSION +1 -1
- data/changelog.md +3 -0
- data/lib/quaderno-ruby/base.rb +12 -19
- data/lib/quaderno-ruby/behavior/crud.rb +5 -5
- data/lib/quaderno-ruby/behavior/deliver.rb +1 -1
- data/lib/quaderno-ruby/behavior/payment.rb +2 -2
- 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: 09c7db7390357eaea573c6ee995f7ba5148cc342
|
4
|
+
data.tar.gz: 88a81c8324e9e194fd3cb8553098cf22f96d934b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35e837e86943777b0ea4db2ddec5e7c8340c113b432a3ce2e899dcbb557cb520aed52d377f832bbdb2c95f5132c0228901b32e60e993ba4960eb7b20a923ce52
|
7
|
+
data.tar.gz: 7917889a1196b38ea36362128eacf6a3c781286707383dc9389cbab436f2eaa706824894f4d10ca5c288fb2661e90935f821f72469cc0563fb985487cb0e5988
|
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.7.
|
6
|
+
Current version is 1.7.1 See the changelog [here](https://github.com/quaderno/quaderno-ruby/blob/master/changelog.md)
|
7
7
|
|
8
8
|
## Installation & Configuration
|
9
9
|
|
@@ -18,12 +18,11 @@ To configure just add this to your initializers
|
|
18
18
|
```ruby
|
19
19
|
Quaderno::Base.configure do |config|
|
20
20
|
config.auth_token = 'my_authenticate_token'
|
21
|
-
config.
|
22
|
-
config.environment = :production
|
21
|
+
config.url = 'https://my_subdomain.quadernoapp.com/api/v1/'
|
23
22
|
end
|
24
23
|
```
|
25
24
|
|
26
|
-
|
25
|
+
**1.7.1 Breaking changes:** If you are using a configuration based on versions `< '1.7.1'`, you will notice that the old configuration no longer works, so please update your configuration or specify the `1.7.0` version.
|
27
26
|
|
28
27
|
## Get authorization data
|
29
28
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.1
|
data/changelog.md
CHANGED
data/lib/quaderno-ruby/base.rb
CHANGED
@@ -7,14 +7,12 @@ module Quaderno
|
|
7
7
|
include Quaderno::Exceptions
|
8
8
|
include Quaderno::Behavior::Crud
|
9
9
|
|
10
|
-
PRODUCTION_URL = 'https://quadernoapp.com'
|
11
|
-
SANDBOX_URL = 'http://sandbox-quadernoapp.com'
|
10
|
+
PRODUCTION_URL = 'https://quadernoapp.com/api/v1/'
|
11
|
+
SANDBOX_URL = 'http://sandbox-quadernoapp.com/api/v1/'
|
12
12
|
|
13
13
|
@@auth_token = nil
|
14
|
-
@@subdomain = 'subdomain'
|
15
14
|
@@rate_limit_info = nil
|
16
|
-
@@
|
17
|
-
@@environment = :production
|
15
|
+
@@url = PRODUCTION_URL
|
18
16
|
|
19
17
|
# Class methods
|
20
18
|
def self.api_model(klass)
|
@@ -32,26 +30,21 @@ module Quaderno
|
|
32
30
|
|
33
31
|
def self.configure
|
34
32
|
yield self
|
35
|
-
@@base_url = @@environment == :sandbox && !@@subdomain.nil? ? "http://#{@@subdomain}.sandbox-quadernoapp.com" : "https://#{@@subdomain}.quadernoapp.com"
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.environment=(mode)
|
39
|
-
@@environment = mode
|
40
33
|
end
|
41
34
|
|
42
35
|
def self.auth_token=(auth_token)
|
43
36
|
@@auth_token = auth_token
|
44
37
|
end
|
45
38
|
|
46
|
-
def self.
|
47
|
-
@@
|
39
|
+
def self.url=(url)
|
40
|
+
@@url = url
|
48
41
|
end
|
49
42
|
|
50
43
|
def self.authorization(auth_token, mode = nil)
|
51
44
|
begin
|
52
|
-
mode ||=
|
53
|
-
|
54
|
-
party_response = get("#{
|
45
|
+
mode ||= :production
|
46
|
+
url = mode == :sandbox ? SANDBOX_URL : PRODUCTION_URL
|
47
|
+
party_response = get("#{url}authorization.json", basic_auth: { username: auth_token })
|
55
48
|
return JSON::parse party_response.body
|
56
49
|
rescue Exception
|
57
50
|
return false
|
@@ -61,7 +54,7 @@ module Quaderno
|
|
61
54
|
#Check the connection
|
62
55
|
def self.ping
|
63
56
|
begin
|
64
|
-
party_response = get("#{@@
|
57
|
+
party_response = get("#{@@url}ping.json", basic_auth: { username: auth_token })
|
65
58
|
check_exception_for(party_response, { subdomain_or_token: true })
|
66
59
|
rescue Errno::ECONNREFUSED
|
67
60
|
return false
|
@@ -71,7 +64,7 @@ module Quaderno
|
|
71
64
|
|
72
65
|
#Returns the rate limit information: limit and remaining requests
|
73
66
|
def self.rate_limit_info
|
74
|
-
party_response = get("#{@@
|
67
|
+
party_response = get("#{@@url}ping.json", basic_auth: { username: auth_token })
|
75
68
|
check_exception_for(party_response, { subdomain_or_token: true })
|
76
69
|
@@rate_limit_info = { reset: party_response.headers['x-ratelimit-reset'].to_i, remaining: party_response.headers["x-ratelimit-remaining"].to_i }
|
77
70
|
end
|
@@ -86,8 +79,8 @@ module Quaderno
|
|
86
79
|
@@auth_token
|
87
80
|
end
|
88
81
|
|
89
|
-
def self.
|
90
|
-
@@
|
82
|
+
def self.url
|
83
|
+
@@url
|
91
84
|
end
|
92
85
|
|
93
86
|
def self.subdomain
|
@@ -29,7 +29,7 @@ module Quaderno
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def all(filter = nil)
|
32
|
-
party_response = get("#{api_model.
|
32
|
+
party_response = get("#{api_model.url}#{ api_model.api_path }.json", body: filter, basic_auth: { username: api_model.auth_token })
|
33
33
|
check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true })
|
34
34
|
array = party_response.parsed_response
|
35
35
|
collection = []
|
@@ -47,7 +47,7 @@ module Quaderno
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def find(id)
|
50
|
-
party_response = get "#{api_model.
|
50
|
+
party_response = get "#{api_model.url}#{ api_model.api_path }/#{ id }.json", basic_auth: { username: api_model.auth_token }
|
51
51
|
check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true })
|
52
52
|
hash = party_response.parsed_response
|
53
53
|
|
@@ -57,7 +57,7 @@ module Quaderno
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def create(params)
|
60
|
-
party_response = post "#{api_model.
|
60
|
+
party_response = post "#{api_model.url}#{ api_model.api_path }.json", body: params, basic_auth: { username: api_model.auth_token }
|
61
61
|
check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, required_fields: true })
|
62
62
|
hash = party_response.parsed_response
|
63
63
|
|
@@ -67,7 +67,7 @@ module Quaderno
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def update(id, params)
|
70
|
-
party_response = put "#{api_model.
|
70
|
+
party_response = put "#{api_model.url}#{ api_model.api_path }/#{ id }.json", body: params, basic_auth: { username: api_model.auth_token }
|
71
71
|
check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true })
|
72
72
|
hash = party_response.parsed_response
|
73
73
|
|
@@ -77,7 +77,7 @@ module Quaderno
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def delete(id)
|
80
|
-
party_response = HTTParty.delete "#{api_model.
|
80
|
+
party_response = HTTParty.delete "#{api_model.url}#{ api_model.api_path }/#{ id }.json", basic_auth: { username: api_model.auth_token }
|
81
81
|
check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true, has_documents: true })
|
82
82
|
true
|
83
83
|
end
|
@@ -8,7 +8,7 @@ module Quaderno
|
|
8
8
|
|
9
9
|
module InstanceMethods
|
10
10
|
def deliver
|
11
|
-
party_response = api_model.get("#{api_model.
|
11
|
+
party_response = api_model.get("#{api_model.url}#{ api_model.api_path }/#{ id }/deliver.json", basic_auth: { username: api_model.auth_token })
|
12
12
|
api_model.check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, id: true, required_fields: true })
|
13
13
|
{ limit: party_response.headers["x-ratelimit-limit"].to_i, remaining: party_response.headers["x-ratelimit-remaining"].to_i }
|
14
14
|
end
|
@@ -11,7 +11,7 @@ module Quaderno
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def add_payment(params)
|
14
|
-
party_response = api_model.post "#{api_model.
|
14
|
+
party_response = api_model.post "#{api_model.url}#{ api_model.api_path }/#{ id }/payments.json", body: params, basic_auth: { username: api_model.auth_token }
|
15
15
|
api_model.check_exception_for(party_response, { rate_limit: true, subdomain_or_token: true, required_fields: true })
|
16
16
|
parsed = JSON::parse party_response.body
|
17
17
|
instance = to_instance(Quaderno::Payment, parsed)
|
@@ -20,7 +20,7 @@ module Quaderno
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def remove_payment(payment_id)
|
23
|
-
party_response = HTTParty.delete "#{api_model.
|
23
|
+
party_response = HTTParty.delete "#{api_model.url}#{ api_model.api_path }/#{ id }/payments/#{ payment_id }.json", basic_auth: { username: api_model.auth_token }
|
24
24
|
to_delete = nil
|
25
25
|
payments.each do |payment|
|
26
26
|
if payment.id == payment_id
|
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.7.
|
5
|
+
# stub: quaderno 1.7.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "quaderno"
|
9
|
-
s.version = "1.7.
|
9
|
+
s.version = "1.7.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 = "2015-
|
14
|
+
s.date = "2015-06-02"
|
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.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Recrea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|