skull_island 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7c23619533ea2d31b5c07763270b49b90567bd9c4286579de345791dc3e2ae6
4
- data.tar.gz: 172d74c57ef9263fb9511aedde42f7d0287ed746888bdb781cfcf9ae2fb5b297
3
+ metadata.gz: 8321e31b43685f8bcf071f1cbcfc227bbcf29f18f4e3f1da1377ec3cc7538ef9
4
+ data.tar.gz: 9e3c1f19171ec4d3c45c2f074374bba6249f03884741cffd3b16df7ea2862f57
5
5
  SHA512:
6
- metadata.gz: 93d0089177792126e8a72a47d6843de52edba872e0e3f6a43ec471a5d058ba6834f3388b35193bcb899b841e5f15c11fc65d37362b790af7e9df8a353ec05d67
7
- data.tar.gz: 2e626e9e42511472e7deab0ce83db1e2adb4e3b54c62a51cc7107d8b171e5b6dc5e42254936a2691f0c4da597056acb1b1cf58b5a7fbc753b2da60134809b370
6
+ metadata.gz: eb3422efbea9ac46ec54ac1ecf8ba11ef161327719032411e2cc2e0caf3dcb12703963523ffa253afe9ff5006f0ab5874b2a87de906c15068214cf928dd0bd3c
7
+ data.tar.gz: 78956b6591c0d8de32b084ede4d1a9f73160bb6fff2a94f0f23792a3cdbfc6371e1c96a9800c2c590bb6e089bb4d2b4b273ec7398e559b9bd45707f1411eca7c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- skull_island (0.2.2)
4
+ skull_island (0.2.3)
5
5
  deepsort (~> 0.4)
6
6
  erubi (~> 1.8)
7
7
  json (~> 2.1)
data/README.md CHANGED
@@ -144,7 +144,7 @@ APIClient.server_status
144
144
  # => {"database"=>{"reachable"=>true...
145
145
  ```
146
146
 
147
- This SDK also makes use of automatic (and mostly unobtrusive) caching behind the scenes. As long as this tool is the only tool making changes to the Admin API (at least while it is being used), this should be fine. Eventually, there will be an option to disable this cache (at the cost of poor performance). For now, it is possible to query this cache and even flushed it manually when required:
147
+ This SDK also makes use of automatic (and mostly unobtrusive) caching behind the scenes. As long as this tool is the only tool making changes to the Admin API (at least while it is being used), this should be fine. Eventually, there will be an option to disable this cache (at the cost of poor performance). For now, it is possible to query this cache and even flush it manually when required:
148
148
 
149
149
  ```ruby
150
150
  APIClient.lru_cache
@@ -248,6 +248,8 @@ resource.created_at
248
248
 
249
249
  #### Consumers (and their Credentials)
250
250
 
251
+ Note that for Consumer credentials, only [`key-auth`](https://docs.konghq.com/hub/kong-inc/key-auth/) and [`basic-auth`](https://docs.konghq.com/hub/kong-inc/basic-auth/) are currently supported.
252
+
251
253
  ```ruby
252
254
  resource = Resources::Consumer.new
253
255
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SkullIsland
4
+ module Exceptions
5
+ # Resource.find() yielded more than one result...
6
+ class AmbiguousFind < APIException
7
+ end
8
+ end
9
+ end
@@ -138,7 +138,10 @@ module SkullIsland
138
138
  # Returns the first (and hopefully only) resource given some criteria
139
139
  # This is a very crude helper and could be made much better
140
140
  def self.find(attribute, value, options = {})
141
- where(attribute, value, options).first
141
+ results = where(attribute, value, options)
142
+ raise Exceptions::AmbiguousFind, 'Found more than one result' if results.size > 1
143
+
144
+ results.first
142
145
  end
143
146
 
144
147
  def self.get(id, options = {})
@@ -4,6 +4,6 @@ module SkullIsland
4
4
  VERSION = [
5
5
  0, # Major
6
6
  2, # Minor
7
- 2 # Patch
7
+ 3 # Patch
8
8
  ].join('.')
9
9
  end
data/lib/skull_island.rb CHANGED
@@ -23,6 +23,7 @@ String.include CoreExtensions::String::Transformations
23
23
 
24
24
  require 'skull_island/version'
25
25
  require 'skull_island/api_exception'
26
+ require 'skull_island/exceptions/ambiguous_find'
26
27
  require 'skull_island/exceptions/api_client_not_configured'
27
28
  require 'skull_island/exceptions/immutable_modification'
28
29
  require 'skull_island/exceptions/invalid_arguments'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skull_island
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-07 00:00:00.000000000 Z
11
+ date: 2019-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deepsort
@@ -232,6 +232,7 @@ files:
232
232
  - lib/skull_island/api_client_base.rb
233
233
  - lib/skull_island/api_exception.rb
234
234
  - lib/skull_island/cli.rb
235
+ - lib/skull_island/exceptions/ambiguous_find.rb
235
236
  - lib/skull_island/exceptions/api_client_not_configured.rb
236
237
  - lib/skull_island/exceptions/immutable_modification.rb
237
238
  - lib/skull_island/exceptions/invalid_arguments.rb