New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

commentatr

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commentatr

  • 0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Ruby wrapper for Commentatr API

This gem supports ruby version 1.9+ only.

Installation

Add this line to your application's Gemfile:

gem 'commentatr'

And then execute:

$ bundle

Or install it yourself as:

$ gem install commentatr

Usage

Initialize client

# Without params
Commentatr::Client.new()

# With blog credentials
Commentatr::Client.new(partner_host: "example.com", token: "...your secret token...")

# With client credentials
Commentatr::Client.new(client_id: 42, token: "...your secret token...")

Fetch comments for blog

# All entry comments
cttr.comments(page_id: "blog-1")

# Last 5 entry comments
cttr.comments(page_id: "blog-1", order: "desc", limit: 5)

# All comments since last time you checked
cttr.comments(page_id: "blog-1", after: Time.now.to_i - 3600)

Fetch comments for all client blogs

cttr.client_comments(order: "asc", offset: 100, limit: 10)

Fetch counters of comments for each entry of each client blog

cttr.counters

Moderator actions

cttr.approve(comment_id: 1)
cttr.reject(comment_id: 2)
cttr.delete(comment_id: 3)
cttr.junk(comment_id: 4)

# Mass management
cttr.approve(comment_id: [1, 2, 3, 4])

Admin actions

# Change comments approval setting
cttr = Commentatr::Client.new(partner_host: "example.com", token: "...your secret token...")
cttr.update_config(approval: false, readonly: true)

# Regenerate blog token
commentatr_config[:token] = cttr.regenerate_blog_token(partner_host: "example.com")

# Regenerate client token
commentatr_config[:token] = cttr.regenerate_client_token

You can perform all these actions passing all needed authentication params for each query

cttr = Commentatr::Client.new
cttr.comments(
  partner_host: "example.com",
  token: "...your secret token...",
  page_id: "blog-1",
  order: "asc",
  offset: 50,
  limit: 10
)

Working with responses

All responses are stored in Commentatr::Response objects

response = cttr.comments(page_id: "blog-1")
response.code
# => 200
response.body.success
# => true
response.body.data
# => [ ...comments here... ]
response.body.errors
# => []

FAQs

Package last updated on 04 Aug 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc