class Openfire::Client

Constants

HER_CLIENT

Attributes

her_client[RW]

Public Class Methods

new(url, token, options={}) click to toggle source
# File lib/openfire/client.rb, line 8
def initialize(url, token, options={})
  url.gsub!(/\/$/,'')
  url = "http://#{url}" unless url.match /^http/
  url = "#{url}/plugins/restapi/v1/"
  headers = {
    'Authorization' => token,
    'Content-Type' => 'application/json',
    'Accept' => 'application/json'
  }
  HER_CLIENT.setup url: url, headers: headers do |c|
    c.request :json
    c.response :openfire_xml,  content_type: /^application\/xml$/
    c.response :openfire_json, content_type: /(^application\/json$)|(^$)/
    c.use Faraday::Adapter::NetHttp
  end
end

Public Instance Methods

groups() click to toggle source
# File lib/openfire/client.rb, line 25
def groups
  @groups ||= Openfire::Ruby::Group
end
users() click to toggle source
# File lib/openfire/client.rb, line 29
def users
  @users ||= Openfire::Ruby::User
end