Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Error when provisioning an user #38

Closed

Description

@diofeher

Hello!

When trying to provision a new user, I'm receiving the following error:

2.2.4 :006 > ValidicClient.provision_user(uid: "adssad12k3")
NoMethodError: undefined method `each' for nil:NilClass
    from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/validic-0.5.0/lib/validic/utils.rb:5:in `attributes_builder'
    from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/validic-0.5.0/lib/validic/user.rb:5:in `initialize'
    from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/validic-0.5.0/lib/validic/rest/users.rb:24:in `new'
    from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/validic-0.5.0/lib/validic/rest/users.rb:24:in `provision_user'

Activity

  1. allcentury commented on Aug 4, 2016

    @allcentury
    Contributor

    Hi @diofeher - I'm not sure if that's just a bad copy & paste regarding ValidicClient but it should look/work like this:

    [1] pry(main)> require 'validic'
    => true
    [2] pry(main)> Validic::VERSION
    => "0.5.0"
    [3] pry(main)> client = Validic::Client.new(organization_id: 'YOUR_ORG_ID', access_token: 'YOUR_ACCESS_TOKEN')
    => #<Validic::Client:0x007ff471dea4c8
     @access_token="YOUR_ACCESS_TOKEN",
     @api_url="https://api.validic.com",
     @api_version="v1",
     @organization_id="YOUR_ORG_ID">
    [4] pry(main)> client.provision_user(uid: 'my_uid')
    => #<Validic::User:0x007ff472cbc2a8 @_id="NEW_USER_ID", @access_token="NEW_USER_TOKEN", @profile=nil, @uid="my_uid">
  2. diofeher commented on Aug 8, 2016

    @diofeher
    Author

    Hello @allcentury, thanks for answering.

    So ValidicClient is just a wrapper to:

    Validic.configure do |config|
      config.api_url          = 'https://api.validic.com'
      config.api_version      = 'v1'
      config.access_token     = ENV["VALIDIC_ACCESS_TOKEN"]
      'ORGANIZATION_ACCESS_TOKEN'
      config.organization_id  = ENV["VALIDIC_ORGANIZATION_ID"]
      'ORGANIZATION_ID'
    end
    
    ::ValidicClient = Validic::Client.new
    

    Anyway, I'm having a different error today, I'm receiving a 409 when trying to create users with provision_user function, even if the uid doesn't exist at the database:

    2.2.4 :008 > ValidicClient.provision_user(uid:"71asd")
    Validic::Error::Conflict: 409:
        from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/validic-0.5.0/lib/validic/rest/request.rb:90:in `request'
        from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/validic-0.5.0/lib/validic/rest/request.rb:67:in `post'
        from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/validic-0.5.0/lib/validic/rest/request.rb:27:in `post_request'
        from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/validic-0.5.0/lib/validic/rest/users.rb:23:in `provision_user'
        from (irb):8
        from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/railties-4.2.5.1/lib/rails/commands/console.rb:110:in `start'
        from /Users/diofeher/.rvm/gems/ruby-2.2.4/gems/railties-4.2.5.1/lib/rails/commands/console.rb:9:in `start'
    
    
  3. allcentury commented on Aug 8, 2016

    @allcentury
    Contributor

    Hi @diofeher - Thanks. You're likely hitting this error because you've exceeded the allowed users for a sandbox organization. The full JSON response should be:

    {
      "code": 409,
      "message": "Your organization is limited to 25 users"
    }

    The gem should do a better job explicitly calling out that message though so I've added issue #39 to address that.

  4. diofeher commented on Aug 9, 2016

    @diofeher
    Author

    Thanks @allcentury !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions