Class: Openfire::Client
- Inherits:
-
Object
- Object
- Openfire::Client
- Defined in:
- lib/openfire/client.rb
Constant Summary collapse
- HER_CLIENT =
Her::API.new
Instance Attribute Summary collapse
-
#her_client ⇒ Object
Returns the value of attribute her_client.
Instance Method Summary collapse
- #groups ⇒ Object
-
#initialize(url, token, options = {}) ⇒ Client
constructor
A new instance of Client.
- #users ⇒ Object
Constructor Details
#initialize(url, token, options = {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/openfire/client.rb', line 8 def initialize(url, token, ={}) 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 |
Instance Attribute Details
#her_client ⇒ Object
Returns the value of attribute her_client.
4 5 6 |
# File 'lib/openfire/client.rb', line 4 def her_client @her_client end |