facturapi_ruby 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facturapi_ruby/customers.rb +7 -0
- data/lib/facturapi_ruby/http_client.rb +20 -1
- data/lib/facturapi_ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44bc1c3980c79bd5b1536125672fc3b8279e195e9bcae12cd61d4a6e3c128e30
|
4
|
+
data.tar.gz: 0e1674d9d285d8b0a75893a1b3d9c3129e1530c35498231763fada9154810586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b935fdc31cb3d4508ef0e866b1d45fe8037df41522a80784ff59147c2416345da4c2937c169d4e066c94adcb3d788615c49efa56caaecba50bda959a869a785
|
7
|
+
data.tar.gz: 3c18c219b7c344af1788a58785cc4c258342ba00988af859498f93b2f874e052f95397c2cdff7f3054f06c6a4435812e811643da025cd1fe71c1bb6744ce7a94
|
@@ -49,7 +49,26 @@ module FacturapiRuby
|
|
49
49
|
http.set_debug_output($stdout)
|
50
50
|
|
51
51
|
response = http.request(request)
|
52
|
-
|
52
|
+
if response.code.start_with? '20'
|
53
|
+
JSON.parse(response.body)
|
54
|
+
else
|
55
|
+
raise FacturapiRubyError.new(JSON.parse(response.body))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def put(options)
|
60
|
+
uri = URI(BASE_URL + options[:endpoint])
|
61
|
+
|
62
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
63
|
+
http.use_ssl = true
|
64
|
+
|
65
|
+
request = Net::HTTP::Put.new(uri.request_uri, 'Content-Type' => 'application/json')
|
66
|
+
request.body = options[:api_options].to_json
|
67
|
+
request.basic_auth(FacturapiRuby.configuration.api_key, '')
|
68
|
+
|
69
|
+
http.set_debug_output($stdout)
|
70
|
+
|
71
|
+
response = http.request(request)
|
53
72
|
if response.code.start_with? '20'
|
54
73
|
JSON.parse(response.body)
|
55
74
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facturapi_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diego Llamas Velasco
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|