nimbu-api 0.4.0 → 0.4.1

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: d5294252784e0860897d26a11750d1682e7941cbe3151d18665984e534c5ceb9
4
- data.tar.gz: c31500b2d80101452c83c8e9a936f4a68ccba47b581ab9cf5c4b6ccfcf885e7b
3
+ metadata.gz: b1753fb1b4a42d33db4e811d339fa12a22c718bca2e594b3c66cac115ba5622f
4
+ data.tar.gz: 757a0842074ae620943ab3c54d043b2d283979cbd20c21cc14a851702114a4b8
5
5
  SHA512:
6
- metadata.gz: d3eef8c4f7f1c1b3700f9c3f7cc2ee43b7bc6cfe81bb3f6bf6ef7b18be080cf37b4da77f827eefea0fec40af759fe86f27a2c0aee7755ea034c924f3cfbf0746
7
- data.tar.gz: 2f1e726f2a3310e70ebfab95f08351f144fae5f607ac32d75446870916e56c2beb03e6331335210eaa1de98da46cd1766a001a8e053d0d0a105d905db4cb6527
6
+ metadata.gz: 6ed6b315b7c4944d9fcde7ba435a262647d44f8e5dcbdcbd1757a964e9bbd144e76e395e7b1b2696dcce242cac754b389df4fb9f1f3b96be0a826baee74cc137
7
+ data.tar.gz: 3ea22e57195ecd045fb89250064e6433cbee20ebee130c36252e801e687e56d114ce4f0716607440a0ac6750f4cf349156cd7c4de84174c8dba35ceec83b10c9
@@ -7,7 +7,11 @@ module Nimbu
7
7
  def create(*args)
8
8
  arguments(args, :required => [:theme_id])
9
9
 
10
- post_request("/themes/#{theme_id}/assets", arguments.params, :with_attachments => true)
10
+ forced = arguments.params.delete("force")
11
+ query_params = {}
12
+ query_params = {force: forced} unless forced.nil?
13
+
14
+ post_request("/themes/#{theme_id}/assets", arguments.params, {:with_attachments => true, :params => query_params})
11
15
  end
12
16
 
13
17
  def delete(*args)
@@ -1,5 +1,4 @@
1
1
  # encoding: utf-8
2
-
3
2
  module Nimbu
4
3
  module Endpoints
5
4
  class Themes::Layouts < Endpoint
@@ -7,7 +6,11 @@ module Nimbu
7
6
  def create(*args)
8
7
  arguments(args, :required => [:theme_id])
9
8
 
10
- post_request("/themes/#{theme_id}/layouts", arguments.params)
9
+ forced = arguments.params.delete("force")
10
+ query_params = {}
11
+ query_params = {force: forced} unless forced.nil?
12
+
13
+ post_request("/themes/#{theme_id}/layouts", arguments.params, params: query_params)
11
14
  end
12
15
 
13
16
  def get(*args)
@@ -7,7 +7,11 @@ module Nimbu
7
7
  def create(*args)
8
8
  arguments(args, :required => [:theme_id])
9
9
 
10
- post_request("/themes/#{theme_id}/snippets", arguments.params)
10
+ forced = arguments.params.delete("force")
11
+ query_params = {}
12
+ query_params = {force: forced} unless forced.nil?
13
+
14
+ post_request("/themes/#{theme_id}/snippets", arguments.params, params: query_params)
11
15
  end
12
16
 
13
17
  def get(*args)
@@ -7,7 +7,11 @@ module Nimbu
7
7
  def create(*args)
8
8
  arguments(args, :required => [:theme_id])
9
9
 
10
- post_request("/themes/#{theme_id}/templates", arguments.params)
10
+ forced = arguments.params.delete("force")
11
+ query_params = {}
12
+ query_params = {force: forced} unless forced.nil?
13
+
14
+ post_request("/themes/#{theme_id}/templates", arguments.params, params: query_params)
11
15
  end
12
16
 
13
17
  def get(*args)
@@ -26,6 +26,6 @@ module Nimbu
26
26
  end # Error
27
27
  end # Nimbu
28
28
 
29
- %w( service_error bad_request bad_gateway unauthorized forbidden not_found not_acceptable unprocessable_entity internal_server_error service_unavailable client_error invalid_options required_params unknown_value validations ).each do |error|
29
+ %w( service_error bad_request bad_gateway unauthorized forbidden not_found not_acceptable unprocessable_entity internal_server_error service_unavailable client_error invalid_options required_params unknown_value validations conflict ).each do |error|
30
30
  require "nimbu-api/errors/#{error}"
31
31
  end
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ module Nimbu #:nodoc
4
+ # Raised when Nimbu returns the HTTP status code 409
5
+ module Error
6
+ class Conflict < ServiceError
7
+ http_status_code 409
8
+
9
+ def initialize(response)
10
+ super(response)
11
+ end
12
+
13
+ end # NotAcceptable
14
+ end # Error
15
+ end # Nimbu
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  # require 'multi_json'
3
- require 'nimbu-api/utils/json'
3
+ require 'nimbu-api/utils/json'
4
4
 
5
5
  module Nimbu
6
6
  # Raised when Nimbu returns any of the HTTP status codes
@@ -11,8 +11,12 @@ module Nimbu
11
11
  attr_reader :http_headers
12
12
  attr_reader :http_body
13
13
 
14
+ attr_reader :status
15
+
14
16
  def initialize(response)
15
17
  @http_headers = response[:response_headers]
18
+ @status = response[:status]
19
+
16
20
  message = parse_response(response)
17
21
  super(message)
18
22
  end
@@ -1,5 +1,5 @@
1
1
  module Nimbu
2
2
  module API
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nimbu-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Dedene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-27 00:00:00.000000000 Z
11
+ date: 2018-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -212,6 +212,7 @@ files:
212
212
  - lib/nimbu-api/errors/bad_gateway.rb
213
213
  - lib/nimbu-api/errors/bad_request.rb
214
214
  - lib/nimbu-api/errors/client_error.rb
215
+ - lib/nimbu-api/errors/conflict.rb
215
216
  - lib/nimbu-api/errors/forbidden.rb
216
217
  - lib/nimbu-api/errors/internal_server_error.rb
217
218
  - lib/nimbu-api/errors/invalid_options.rb