/cortex-client-ruby

Cortex Ruby API Client

Primary LanguageRubyApache License 2.0Apache-2.0

cortex-client-ruby

Build Status Gem Version

Ruby client library for cortex's API.

Constructor

require 'cortex-client'

client = Cortex::Client.new(access_token: 'access_token')

client.posts.query().each do |post|
  puts post
end

Alternatively, cortex-client will handle OAuth2 authentication for you:

require 'cortex-client'

client = Cortex::Client.new(key: 'my-app-id', secret: 'my-app-secret', base_url: 'base_url', scopes: 'view:posts view:media')
 
 client.posts.query().each do |post|
  puts post
 end

Authorization

For more information about scopes and how to obtain an application key and secret, check Cortex's authorization documentation.

Result object

Cortex::Client will return a Cortex::Result object. The following methods are available:

  • contents
  • is_error?
  • errors
  • page
  • per_page
  • total_items
  • range
  • range_start
  • range_end
  • raw_headers

Supported Endpoints

  • Users - me, get, save
  • Posts - query, get, save, delete, feed, feed/get, feed/get/released, feed/authors
  • Webpages - feed

TODO

  • Support Media endpoint