Class: CleverElements::Client
- Inherits:
-
Object
- Object
- CleverElements::Client
- Defined in:
- lib/clever_elements/client.rb
Constant Summary collapse
- API_VERSION =
"1.0"
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#savon ⇒ Object
readonly
Returns the value of attribute savon.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
- #authentication_header ⇒ Object
-
#initialize(user_id, api_key, mode = 'test') ⇒ Client
constructor
A new instance of Client.
- #proxy ⇒ Object
- #request(method, arguments = {}) ⇒ Object
Constructor Details
#initialize(user_id, api_key, mode = 'test') ⇒ Client
Returns a new instance of Client.
7 8 9 10 |
# File 'lib/clever_elements/client.rb', line 7 def initialize user_id, api_key, mode = 'test' @savon = Savon::Client.new "http://api.sendcockpit.com/server.php?wsdl" @user_id, @api_key, @mode = user_id, api_key, mode end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/clever_elements/client.rb', line 5 def api_key @api_key end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
5 6 7 |
# File 'lib/clever_elements/client.rb', line 5 def mode @mode end |
#savon ⇒ Object (readonly)
Returns the value of attribute savon.
5 6 7 |
# File 'lib/clever_elements/client.rb', line 5 def savon @savon end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
5 6 7 |
# File 'lib/clever_elements/client.rb', line 5 def user_id @user_id end |
Instance Method Details
#authentication_header ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/clever_elements/client.rb', line 19 def authentication_header { :validate => { :userid => user_id, :apikey => api_key, :version => API_VERSION, :mode => mode } } end |
#proxy ⇒ Object
30 31 32 |
# File 'lib/clever_elements/client.rb', line 30 def proxy @proxy ||= Proxy.new self end |
#request(method, arguments = {}) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/clever_elements/client.rb', line 12 def request method, arguments = {} savon.request method do soap.body = arguments soap.header = authentication_header end end |