Sha256: a2c02ea2027ad57293433da936af8c40559222b479bb142d8e3664ed0e1fa4bc

Contents?: true

Size: 696 Bytes

Versions: 10

Compression:

Stored size: 696 Bytes

Contents

require 'eloqua/remote_object'

module Eloqua
  
  class Asset < RemoteObject
    
    self.remote_group = :asset

    def add_member(entity)
      member_operation(:add_group_member, entity)
    end

    def remove_member(entity)
      member_operation(:remove_group_member, entity)
    end
    
    private

    def member_operation(method, entity)
      unless (entity.is_a?(Eloqua::Entity))
        raise(ArgumentError, "Must pass a Eloqua::Entity")
      end
      unless (entity.persisted?)
        raise(ArgumentError, "Cannot add member Entity has not been saved. (!entity.persisted?")
      end
      api.send(method, remote_type, id, entity.remote_type, entity.id)
    end

  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
eloqua-1.2.4 lib/eloqua/asset.rb
eloqua-1.2.3 lib/eloqua/asset.rb
eloqua-1.2.2 lib/eloqua/asset.rb
eloqua-1.2.1 lib/eloqua/asset.rb
eloqua-1.2.0 lib/eloqua/asset.rb
eloqua-1.1.4 lib/eloqua/asset.rb
eloqua-1.1.3 lib/eloqua/asset.rb
eloqua-1.1.2 lib/eloqua/asset.rb
eloqua-1.1.1 lib/eloqua/asset.rb
eloqua-1.1.0 lib/eloqua/asset.rb