class ChurchCommunityBuilder::Client
Attributes
logger[R]
password[R]
subdomain[R]
username[R]
Public Class Methods
new(subdomain, username, password, logger = false)
click to toggle source
# File lib/church_community_builder/client.rb, line 19 def initialize(subdomain, username, password, logger = false) @subdomain = subdomain @username = username @password = password @logger = logger end
Public Instance Methods
get(path, options = {})
click to toggle source
# File lib/church_community_builder/client.rb, line 26 def get(path, options = {}) connection.get(path, options).body end
post(path, options = {})
click to toggle source
# File lib/church_community_builder/client.rb, line 30 def post(path, options = {}) res = connection.post(path, options).body res end
Private Instance Methods
connection()
click to toggle source
# File lib/church_community_builder/client.rb, line 37 def connection Faraday.new(url: "https://#{subdomain}.ccbchurch.com/api.php") do |conn| conn.basic_auth username, password conn.response :logger if logger conn.response :xml conn.use FaradayMiddleware::ChurchCommunityBuilderErrorHandler conn.adapter Faraday.default_adapter end end