Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
update to cr 6
Browse files Browse the repository at this point in the history
  • Loading branch information
bartes committed Jan 19, 2021
1 parent 8edb440 commit fb397c5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GEM
remote: https://rubygems.org/
specs:
byebug (11.1.3)
castle-rb (5.0.0)
castle-rb (6.0.0)
coveralls_reborn (0.20.0)
simplecov (>= 0.18.1, < 0.22.0)
term-ansicolor (~> 1.6)
Expand Down
18 changes: 10 additions & 8 deletions lib/castle/middleware/authenticating.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,16 @@ def authentication_verdict(verdict, req, resource)

def process_authenticate(req, resource, mapping, user_traits_from_params, event_properties)
authenticate(
Castle::Client.to_context(req),
Castle::Client.to_options(
user_id: Identification.id(resource, configuration.identify),
user_traits: Identification.traits(
resource, configuration.user_traits
).merge(user_traits_from_params),
event: mapping.event,
properties: event_properties
::Castle::Payload::Prepare.call(
{
user_id: Identification.id(resource, configuration.identify),
user_traits: Identification.traits(
resource, configuration.user_traits
).merge(user_traits_from_params),
event: mapping.event,
properties: event_properties
},
req
)
)
end
Expand Down
18 changes: 10 additions & 8 deletions lib/castle/middleware/tracking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ def prefetch_resource_if_needed(req)
# generate track call
def process_track(req, resource, mapping, user_traits_from_params, properties)
configuration.services.transport.call(
::Castle::Client.to_context(req),
::Castle::Client.to_options(
user_id: Identification.id(resource, configuration.identify),
user_traits: Identification.traits(
resource, configuration.user_traits
).merge(user_traits_from_params),
event: mapping.event,
properties: properties
::Castle::Payload::Prepare.call(
{
user_id: Identification.id(resource, configuration.identify),
user_traits: Identification.traits(
resource, configuration.user_traits
).merge(user_traits_from_params),
event: mapping.event,
properties: properties
},
req
)
)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/castle/middleware_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

it { expect(config.api_secret).to be_eql('secret') }

it { expect(Castle.config.url.to_s).to be_eql('https://api.castle.local:3000') }
it { expect(Castle.config.base_url.to_s).to be_eql('https://api.castle.local:3000') }
end

describe '::configure' do
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
config.before do
::Castle::Middleware.configure do |c|
c.api_secret = 'secret'
c.api_options = { url: 'https://api.castle.local:3000' }
c.api_options = { base_url: 'https://api.castle.local:3000' }
c.app_id = '1234'
c.file_path = './spec/castle/middleware/castle_config.yml'
end
Expand Down

0 comments on commit fb397c5

Please sign in to comment.