0.0
No commit activity in last 3 years
No release in over 3 years
Ruby wrapper for FreeFeed API.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
>= 0
~> 3.0

Runtime

 Project Readme

freefeed-client

Ruby wrapper for Freefeed API.

Gem Version

Installation

Add following line to your Gemfile:

gem 'freefeed-client'

And then execute:

$ bundle

Or install it system-wide:

$ gem install freefeed-client

Usage

First things first, you need to obtain a token for your user. Then create your api client like this:

require 'freefeed'

client = Freefeed::Client.new('yourFreefeedAPIToken')

post = Freefeed::Types::PostCreate.new(
  {
    post: { 
      body: 'Hello World!'
    },
    meta: {
      feeds: ['yourusername']
    }
  }
)

Freefeed::Post.create(client, post)

You can achive the same result without addressing Freefeed::Post class directly:

require 'freefeed'

client = Freefeed::Client.new('yourFreefeedAPIToken')

post = Freefeed::Types::PostCreate.new(
  {
    post: { 
      body: 'Hello World!'
    },
    meta: {
      feeds: ['yourusername']
    }
  }
)

client.posts_create(post)

You can even skip instantiating PostCreate type, but you will lose some validation:

require 'freefeed'

client = Freefeed::Client.new('yourFreefeedAPIToken')

client.posts_create({post: {body: 'Hello World!'}, meta: {feeds: ['yourusername']}})

Logging

By default, freefeed-client logs everything to STDOUT. You can change this behavior and provide your own logger class with some options. See example below:

client = Freefeed::Client.new(
  'yourFreefeedAPIToken',
  logger: Logger.new('log.txt'),
  logger_options: {bodies: false, headers: false}
)