facturapi_ruby 1.1.2 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab0caea89362d23d2923e2c672d65ba7e46db5f7cd7074fc0fef9eb770f54c36
4
- data.tar.gz: 15060598f91e6b48b395529a4f631900e057394b7f930dad0aa5cab5598f63d0
3
+ metadata.gz: 44bc1c3980c79bd5b1536125672fc3b8279e195e9bcae12cd61d4a6e3c128e30
4
+ data.tar.gz: 0e1674d9d285d8b0a75893a1b3d9c3129e1530c35498231763fada9154810586
5
5
  SHA512:
6
- metadata.gz: 5be6592e81eaa321eef0c1d8f86b3cadcfe4877f36173b40721334b64d9ff0329d6a48eb224b761acf47375095bcdc9db92f010bc8456d7f12ae365bba6a753b
7
- data.tar.gz: 35da256d672fda82e32b4d932863848d553dda0da5083885895db697f6170c18c4b32da23fce5b723be16a9a7fe7a89f6007fb97c569258e8018ede5173a32a1
6
+ metadata.gz: 7b935fdc31cb3d4508ef0e866b1d45fe8037df41522a80784ff59147c2416345da4c2937c169d4e066c94adcb3d788615c49efa56caaecba50bda959a869a785
7
+ data.tar.gz: 3c18c219b7c344af1788a58785cc4c258342ba00988af859498f93b2f874e052f95397c2cdff7f3054f06c6a4435812e811643da025cd1fe71c1bb6744ce7a94
@@ -9,6 +9,13 @@ module FacturapiRuby
9
9
  api_options: options
10
10
  )
11
11
  end
12
+
13
+ def update(customer_id, options)
14
+ HttpClient.put(
15
+ endpoint: "/customers/#{customer_id}",
16
+ api_options: options
17
+ )
18
+ end
12
19
  end
13
20
  end
14
21
  end
@@ -49,7 +49,26 @@ module FacturapiRuby
49
49
  http.set_debug_output($stdout)
50
50
 
51
51
  response = http.request(request)
52
- puts response.code
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
@@ -1,3 +1,3 @@
1
1
  module FacturapiRuby
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
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.1.2
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-05 00:00:00.000000000 Z
11
+ date: 2019-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler