auth0 3.4.0 → 3.5.0

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
  SHA1:
3
- metadata.gz: 8c8cbc5c686f482699408775f046cabd798eb6fb
4
- data.tar.gz: 4876cce548226a3b7dcee445475d9be7621a159c
3
+ metadata.gz: af6137265bad4b8ee94d95e6f260aa8594614df3
4
+ data.tar.gz: 42e5145db97b457f3f7127dc880cb27b6d6da959
5
5
  SHA512:
6
- metadata.gz: 3b59e6938ee61772c70a87c275d88654507f4b419444d4e8332bd3ea18ebb7bca924d00ca27dd3fc358894391d59b3b05113d91c610b453775e1ae709eda1a3b
7
- data.tar.gz: b9e0c9a9295e0db1197e44914ae23764d0c1d4caa698908ffa6e837dcbcba88776f4ed992522f75b9e1335fac87d19b73f863caf3407ab7695145129ccbefd9d
6
+ metadata.gz: 0865e559b9dc2b027a03e5b4286cc59870c2271602069306677347b52afdb9419f99ef43291ac024b5dc3023947d965a71024f7f72375754d924bd794916fd3d
7
+ data.tar.gz: aa6c2e53a3fbe2998c75c932a79178ce953223268c10d7c05a0ab17f51de139ffc217e5a69ba900d0dd87f72d58387f3f0e097d7363c4952a5d191534eb4dfcd
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env rake
2
2
  require "bundler/gem_tasks"
3
3
 
4
+ puts "Entity suffix is #{ENV["TRAVIS_JOB_ID"] || "_local"}"
4
5
  begin
5
6
  require 'rspec/core/rake_task'
6
7
 
@@ -12,7 +12,7 @@ module Auth0
12
12
  domain = api_domain options
13
13
  raise InvalidApiNamespace, "Api namespace must supply an API domain" if domain.nil?
14
14
  self.class.base_uri "https://#{domain}"
15
- self.class.headers "Content-Type" => 'application/json'
15
+ self.class.headers client_headers(config)
16
16
  self.extend Auth0::Api::AuthenticationEndpoints
17
17
  @client_id = options[:client_id]
18
18
  initialize_v2(options) if api_v2?(options)
@@ -28,6 +28,15 @@ module Auth0
28
28
 
29
29
  private
30
30
 
31
+ def client_headers(config)
32
+ sdk_headers = {
33
+ 'Content-Type' => 'application/json',
34
+ }
35
+ sdk_headers['User-Agent'] = "Ruby/#{RUBY_VERSION}" if not config[:opt_out_sdk_info]
36
+ sdk_headers['Auth0-Client'] = "ruby-auth0/#{Auth0::VERSION}" if not config[:opt_out_sdk_info]
37
+ sdk_headers
38
+ end
39
+
31
40
  def api_domain(options)
32
41
  options[:domain] || options[:namespace]
33
42
  end
@@ -1,4 +1,4 @@
1
1
  module Auth0
2
2
  # current version of gem
3
- VERSION = "3.4.0"
3
+ VERSION = "3.5.0"
4
4
  end
@@ -16,7 +16,6 @@ describe Auth0::Api::V1::Users do
16
16
  let(:users) { client.users() }
17
17
 
18
18
  it { expect(users.size).to be > 0 }
19
- it { expect(users.find {|user| user["email"] == email}).to_not be_nil }
20
19
 
21
20
  context "#filters" do
22
21
  it { expect(client.users("email: #{email}").size).to be 1 }
@@ -20,7 +20,6 @@ describe Auth0::Api::V2::Users do
20
20
  let(:users) { client.users() }
21
21
 
22
22
  it { expect(users.size).to be > 0 }
23
- it { expect(users.find {|user| user["email"] == email}).to_not be_nil }
24
23
 
25
24
  context "#filters" do
26
25
  it { expect(client.users(per_page: 1).size).to be 1 }
@@ -42,4 +42,15 @@ describe Auth0::Client do
42
42
  let(:credentials) { v2_credentials.merge({access_token: ENV["MASTER_JWT"]}) }
43
43
  end
44
44
 
45
+ describe "client headers" do
46
+ let(:access_token) { 'abc123' }
47
+ let(:domain) { 'myhost.auth0.com' }
48
+ let(:client) { Auth0::Client.new(v2_credentials.merge({access_token: access_token, domain: domain})) }
49
+
50
+ let(:headers) { client.class.headers }
51
+ specify { expect(headers).to include("Auth0-Client" => "ruby-auth0/#{Auth0::VERSION}") }
52
+ specify { expect(headers).to include("User-Agent" => "Ruby/#{RUBY_VERSION}") }
53
+ specify { expect(headers).to include("Authorization" => "Bearer #{access_token}") }
54
+ specify { expect(headers).to include("Content-Type" => "application/json") }
55
+ end
45
56
  end
@@ -20,21 +20,23 @@ Dir[("./lib/**/*.rb")].each { |f| require f }
20
20
  Dir[("./spec/support/**/*.rb")].each { |f| require f }
21
21
 
22
22
  def entity_suffix
23
- ENV["TRAVIS_BUILD_ID"] || "_local"
23
+ ENV["TRAVIS_JOB_ID"] || "_local"
24
24
  end
25
25
 
26
26
  RSpec.configure do |config|
27
+ config.filter_run :focus => true
28
+ config.run_all_when_everything_filtered = true
27
29
  config.include Rack::Test::Methods
28
30
  config.include Credentials
29
31
  config.after(:suite) do
30
32
  v2_client = Auth0Client.new({token: ENV["MASTER_JWT"], api_version: 2, domain: ENV["DOMAIN"]})
31
33
  v2_client
32
34
  .clients
33
- .select { |client| client["name"] != "DefaultApp" and not client["global"] and client["name"].end_with? entity_suffix }
35
+ .select { |client| client["name"] != "DefaultApp" and not client["global"] and client["name"].include? entity_suffix }
34
36
  .each { |client| v2_client.delete_client(client["client_id"]) }
35
37
  v2_client
36
38
  .users
37
- .select { |user| user["email"].split("@").first.include? entity_suffix }
39
+ .select { |user| user["email"].split("@").first.end_with? entity_suffix }
38
40
  .each { |user| v2_client.delete_user(user["user_id"])}
39
41
  end
40
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth0
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Auth0
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-05-07 00:00:00.000000000 Z
14
+ date: 2015-05-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty