Skip to content

chicobico/posty_client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

posty_client

Client library for the post_api server: https://github.com/posty/posty_api

Install

gem install posty_client

Usage

Create at least a configuration file at ~/.posty-cli.yml

Cli:

$ posty-client help

Library:

require 'pp'

ENV['RESTCLIENT_LOG'] = 'stdout'

$: << '.'
require 'lib/posty_client.rb'

d = PostyClient::Resources::Domain.new('posty-soft1.org')
puts d.name, d.primary_key
pp d.attributes

unless d.save
  pp d.errors
end

d = PostyClient::Resources::Domain.new('posty-soft.org')
unless d.save
  pp d.errors
end

puts '--'*10

pp d.users

puts '*'*20

u = PostyClient::Resources::User.new(d, 'to')
u.attributes['password'] = 'lalalala'
unless u.save
  pp u.errors
  exit
end

u = PostyClient::Resources::Alias.new(d, 'tommy')
u.attributes['destination'] = 'bheller'
unless u.save
  pp u.errors
  exit
end

puts '--'*10
pp d.aliases

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%