Confluence::Client - Ruby client for the Confluence XML::RPC API.

Usage

Confluence::Client.new(url) do |confluence|

  if confluence.(user, pass)

    # Was last API call successful?
    confluence.ok?

    # Print error message if error on last API call.
    puts confluence.error if confluence.error?

    ##########
    # Spaces #
    ##########
    space = confluence.get_space('foo')
    if space
      puts "found space: #{space.inspect}"
    else
      space = confluence.add_space( 'foo', 'space name', 'space description' )
      if space
        puts "created space: #{space.inspect}"
      else
        puts "unable to create space: #{c.error}"
      end
    end

    if confluence.remove_space('foo')
      puts 'removed space'
    else
      puts "unable to remove space: #{c.error}"
    end

    #########
    # Users #
    #########
    user = confluence.get_user('stan')
    if user
      puts "found user: #{user.inspect}"
    else
      user = confluence.add_user( 'stan', 'stan has a name', '[email protected]' )       
    end

    if confluence.remove_user('stan')
      puts 'removed user'
    else
      puts "unable to remove user: #{c.error}"
    end

    #########
    # Users #
    #########
    group = confluence.get_group('some:group')
    if group
      puts "found group: #{group.inspect}"
    else
      group = confluence.add_group('some:group')
    end

    if confluence.remove_group('some:group')
      puts 'removed group'
    else
      puts "unable to remove group: #{c.error}"
    end

    ##########
    # Groups #
    ##########
    if confluence.member?('stan', 'some:group')
      if confluence.remove_user_from_group('stan', 'some:group')
        puts 'removed user from group'
      else
        puts "unable to remove user from group: #{c.error}"
      end
    else
      if confluence.add_user_to_group('stan', 'some:group')
        puts 'added user to group'
      else
        puts "unable to add user to group: #{c.error}"
      end
    end

    ###############
    # Permissions #
    ###############
    if confluence.add_permission_to_space('Edit', 'stan', 'foo')
      puts 'added permission to space'
    else
      puts "unable to add permission to space: #{c.error}"
    end
    if confluence.remove_permission_to_space('View', 'some:group', 'foo')
      puts 'removed permission from space'
    else
      puts "unable to remove permission from space: #{c.error}"
    end

    ########## 
    # Logout #
    ########## 
    confluence.logout
  end

end