Sha256: 9fbf75eb55afc75ef3c5586d33bf8a1dae6d9a69d82ff58b064ee9c09880053a

Contents?: true

Size: 861 Bytes

Versions: 46

Compression:

Stored size: 861 Bytes

Contents

class Ey::Core::Client
  class Real
    def create_account(params={})
      request(
        :method => :post,
        :path   => "/accounts",
        :params => params,
      )
    end
  end # Real

  class Mock
    def create_account(params={})
      resource_id = self.uuid
      owner_id    = params["owner"] || @current_user && @current_user["id"]

      find(:users, owner_id)

      if name_prefix = params["account"].delete("name_prefix")
        params["account"]["name"] = "#{name_prefix}-#{resource_id[0,4]}"
      end

      resource = mock_account_setup(resource_id, params["account"].dup)

      self.data[:accounts][resource_id] = resource.merge(:account_users => [owner_id], :account_owners => [owner_id])

      response(
        :body    => {"account" => resource},
        :status  => 201,
      )
    end
  end # Mock
end # Ey::Core::Client

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
ey-core-3.4.4 lib/ey-core/requests/create_account.rb
ey-core-3.4.2 lib/ey-core/requests/create_account.rb
ey-core-3.4.1 lib/ey-core/requests/create_account.rb
ey-core-3.4.0 lib/ey-core/requests/create_account.rb
ey-core-3.3.1 lib/ey-core/requests/create_account.rb
ey-core-3.3.0 lib/ey-core/requests/create_account.rb
ey-core-3.2.6 lib/ey-core/requests/create_account.rb
ey-core-3.2.5 lib/ey-core/requests/create_account.rb
ey-core-3.2.4 lib/ey-core/requests/create_account.rb
ey-core-3.2.3 lib/ey-core/requests/create_account.rb
ey-core-3.2.2 lib/ey-core/requests/create_account.rb
ey-core-3.2.1 lib/ey-core/requests/create_account.rb
ey-core-3.2.0 lib/ey-core/requests/create_account.rb
ey-core-3.1.11 lib/ey-core/requests/create_account.rb
ey-core-3.1.10 lib/ey-core/requests/create_account.rb
ey-core-3.1.9 lib/ey-core/requests/create_account.rb
ey-core-3.1.8 lib/ey-core/requests/create_account.rb
ey-core-3.1.7 lib/ey-core/requests/create_account.rb
ey-core-3.1.6 lib/ey-core/requests/create_account.rb
ey-core-3.1.5 lib/ey-core/requests/create_account.rb