Class: Disqussion::Forums

Inherits:
Client
  • Object
show all
Defined in:
lib/disqussion/client/forums.rb

Instance Method Summary collapse

Methods included from Request

#get, #post

Instance Method Details

#create(*args) ⇒ Hashie::Rash

Creates a new forum. @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/forums/create.json

Examples:

Creates a new forum 'myforum'

Disqussion::Client.forums.create("the88", "My Forum", "myforum")

Parameters:

  • website (String)

    Disqus website name.

  • name (String)

    Forum name.

  • short_name (String)

    Forum short name (aka forum id).

Returns:

  • (Hashie::Rash)

    New forum infos



16
17
18
19
20
21
22
23
24
# File 'lib/disqussion/client/forums.rb', line 16

def create(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  if args.size == 3
    options.merge!(:website => args[0], :name => args[1], :short_name => args[2])
    response = get('forums/create', options)
  else
    puts "#{Kernel.caller.first}: forums.create expects 3 arguments: website, name, short_name"
  end
end

#details(*args) ⇒ Hashie::Rash

Returns forum details. @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/forums/details.json

Examples:

Return extended information for forum 'myforum'

Disqussion::Client.forums.details("myforum")

Parameters:

  • forum (String)

    Forum ID (aka short name).

Returns:

  • (Hashie::Rash)

    Details on the requested forum.



37
38
39
40
41
# File 'lib/disqussion/client/forums.rb', line 37

def details(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  options[:forum] = args.first
  response = get('forums/details', options)
end

#listCategories(*args) ⇒ Hashie::Rash

Returns a list of categories within a forum. @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/forums/listCategories.json

Examples:

Return list of categories within forum 'myforum'

Disqussion::Client.categories.list("myforum", {:cursor => 10, :limit => 10, :order => 'asc'})

Parameters:

  • forum (String)

    Forum ID (aka short name).

  • options (Hash)

    A customizable set of options.

Returns:

  • (Hashie::Rash)

    Details on the requested list of categories.



59
60
61
62
63
# File 'lib/disqussion/client/forums.rb', line 59

def listCategories(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  options[:forum] = args.first
  response = get('forums/listCategories', options)
end

#listModerators(*args) ⇒ Hashie::Rash

Returns a list of Moderators for the forum @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: true @limited: false @see: http://disqus.com/api/3.0/forums/listModerators.json

Examples:

Return list of moderators within forum 'the88'

Disqussion::Client.forums.listModerators("the88")

Parameters:

  • forum (String)

    Forum ID (aka short name).

Returns:

  • (Hashie::Rash)

    Details on the requested list of moderators.



76
77
78
79
80
# File 'lib/disqussion/client/forums.rb', line 76

def listModerators(*args)
	options = args.last.is_a?(Hash) ? args.pop : {}
	options[:forum] = args.first
	response = get('forums/listModerators', options)
end

#listMostActiveUsers(*args) ⇒ Hashie::Rash

Returns a list of the most active users for the forum @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/forums/listMostActiveUsers.json

Examples:

Return list of most active users within forum 'the88'

Disqussion::Client.forums.listMostActiveUsers("the88")

Parameters:

  • forum (String)

    Forum ID (aka short name).

  • options (Hash)

    A customizable set of options.

Returns:

  • (Hashie::Rash)

    Details on the requested list of most active users.



97
98
99
100
101
# File 'lib/disqussion/client/forums.rb', line 97

def listMostActiveUsers(*args)
	options = args.last.is_a?(Hash) ? args.pop : {}
	options[:forum] = args.first
	response = get('forums/listMostActiveUsers', options)
end

#listMostLikedUsers(*args) ⇒ Hashie::Rash

Returns a list of users active within a forum ordered by most likes received. @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/forums/listMostLikedUsers.json

Examples:

Return list of most liked users for forum 'myforum'

Disqussion::Client.forums.listMostLikedUsers("myforum")

Parameters:

  • forum (String)

    Forum ID (aka short name).

  • options (Hash)

    A customizable set of options.

Returns:

  • (Hashie::Rash)

    Details on the list of posts.



119
120
121
122
123
# File 'lib/disqussion/client/forums.rb', line 119

def listMostLikedUsers(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  options[:forum] = args.first
  response = get('forums/listMostLikedUsers', options)
end

#listPosts(*args) ⇒ Hashie::Rash

Returns a list of posts within a forum. @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/forums/listPosts.json

Examples:

Return list of (all) posts for forum 'myforum', including related threads

Disqussion::Client.forums.listPosts("myforum", {:related => ["thread"], :include => ["spam", "deleted", "flagged"]})

Parameters:

  • forum (String)

    Forum ID (aka short name).

  • options (Hash)

    A customizable set of options.

Returns:

  • (Hashie::Rash)

    Details on the list of posts.



144
145
146
147
148
# File 'lib/disqussion/client/forums.rb', line 144

def listPosts(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  options[:forum] = args.first
  response = get('forums/listPosts', options)
end

#listThreads(*args) ⇒ Hashie::Rash

Returns a list of threads within a forum. @accessibility: public key, secret key @methods: GET @format: json, jsonp, rss @authenticated: false @limited: false @see: http://disqus.com/api/3.0/forums/listThreads.json

Examples:

Return list of (all) threads for forum 'myforum', including closed ones and related forums.

Disqussion::Client.forums.listThreads("myforum", {:related => ["forum"], :include => ["close"]})

Parameters:

  • forum (String)

    Forum ID (aka short name).

  • options (Hash)

    A customizable set of options.

Returns:

  • (Hashie::Rash)

    Details on the list of posts.



169
170
171
172
173
# File 'lib/disqussion/client/forums.rb', line 169

def listThreads(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  options[:forum] = args.first
  response = get('forums/listThreads', options)
end

#listUsers(*args) ⇒ Hashie::Rash

Returns a list of users active within a forum. @accessibility: public key, secret key @methods: GET @format: json, jsonp @authenticated: false @limited: false @see: http://disqus.com/api/3.0/forums/listUsers.json

Examples:

Return list of active users for forum 'myforum'

Disqussion::Client.forums.listUsers("myforum")

Parameters:

  • forum (String)

    Forum ID (aka short name).

  • options (Hash)

    A customizable set of options.

Returns:

  • (Hashie::Rash)

    Details on the list of posts.



191
192
193
194
195
# File 'lib/disqussion/client/forums.rb', line 191

def listUsers(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  options[:forum] = args.first
  response = get('forums/listUsers', options)
end