lib/civicrm.rb in civicrm-1.1.1 vs lib/civicrm.rb in civicrm-1.2.0
- old
+ new
@@ -1,15 +1,16 @@
+require 'json'
+
require 'active_support/deprecation'
require 'active_support/core_ext/module'
require 'active_support/core_ext/hash'
require 'active_support/inflector'
require 'rest-client'
require 'nokogiri'
# utils
require 'civicrm/client'
-require 'civicrm/xml'
require 'civicrm/resource'
require 'civicrm/profiling'
require 'civicrm/version'
# actions
@@ -32,23 +33,17 @@
@@api_key = nil
@@site_key = nil
@@api_base = 'https://www.example.org/path/to/civi/codebase'
@@api_version = 'v3'
- @@user_authenticated = false
mattr_accessor :api_key, :api_base, :api_version, :site_key
def self.api_url(path = '')
base = "#{api_base}/civicrm/extern/rest.php?#{path}"
base += "&api_key=#{@@api_key}" if @@api_key
base += "&key=#{@@site_key}" if @@site_key
base
- end
-
- def self.authenticate(name, password)
- auth = Client.request(:post, q: 'civicrm/login', name: name, pass: password)
- @@api_key = auth[0]['api_key']
end
def self.api_key=(key)
@@api_key = key
end