Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Allow to operate against multiple Kong API servers #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nevalla
Copy link
Contributor

@nevalla nevalla commented Feb 16, 2018

This PR will allow user to use Kong::Client objects and operate against multiple Kong API servers.
Examples:

client = Kong::Client.new(url)
client.consumers.all
client.apis.create({name: 'v1'})

client2 = Kong::Client.new(url)
client2.consumers.all

The implementation is backward compatible.


it 'uses given Collection instance' do
consumer_collection = Kong::Collection.new(Kong::Consumer, Kong::Client.new('http://kong-api:8001'))
instance = Klass.new({}, {collection: consumer_collection})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside { missing.
Space inside } missing.


context 'with opts' do
it 'uses given Client instance' do
instance = Klass.new({}, {client: Kong::Client.new('http://kong-api:8001')})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside { missing.
Space inside } missing.

it 'is alias of .list' do
expect(Klass.method(:list)).to eq(Klass.method(:all))
it 'calls .list with size option' do
expect(Kong::Client.instance).to receive(:get).with('/resources/', {size: 9999999}).and_return({ data: [] })

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside { missing.
Space inside } missing.

base.extend(ClassMethods)
end
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final newline missing.

module Kong
module Rootless
module ClassMethods
def find(id, opts={})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surrounding space missing in default value assignment.

@klass.respond_to?(method, include_private)
end
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final newline missing.

end

def first(opts={})
self.list({},opts).first

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space missing after comma.

self.list({ size: 9999999 }, opts)
end

def first(opts={})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surrounding space missing in default value assignment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants