Closed ehannes closed 6 years ago
I have not yet found a solution for how to default to :default
token store when no explicit token_store
is configured:
This works:
Fortnox::API.configure do |config|
config.token_store = { default: ['token1', 'token2'], store2: ['token1', 'token2'] }
end
Fortnox::API::Repository::Customer.new # Uses token store :default
Fortnox::API::Repository::Customer.new( token_store: :store2 ) # Uses token store :store2
I have no solution for this yet:
Fortnox::API.configure do |config|
config.access_token = ['token1', 'token2']
end
This should set Fortnox::API.config.token_store
to { default: ['token1', 'token2'] }
, but I have not found any working implementation for it yet.
This is implemented now.
@d-Pixie ready for code review :)
@d-Pixie What do you say about the methods in Fortnox::API::Repository::Base
? I would argue that most of them should be private/protected since they are not meant to be used from outside.
@d-Pixie Time to take another look at this :)
Introduces support for multiple Fortnox backends. Each Fortnox Access Token is connected to a specific Fortnox instance.You can now call different Fortnox backends with the same gem instance. For instance (where
fortnox1
andfortnox2
represents key sets for different Fortnox instances):This pull request changes a lot of stuff, both internally and public:
Fortnox::API::Base
is merged withFortnox::API::Repository::Base
, the former is no longer needed.TODO: