Class: SyncwiseApi::Client
Instance Method Summary collapse
-
#initialize(username, password) ⇒ Client
constructor
A new instance of Client.
- #make_request(action_code, params) ⇒ Object
Constructor Details
#initialize(username, password) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 |
# File 'lib/syncwise_api/client.rb', line 4 def initialize(username, password) @username = username @password = password login end |
Instance Method Details
#make_request(action_code, params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/syncwise_api/client.rb', line 10 def make_request(action_code, params) if action_code == :user_login puts 'Login is done automatically when a new Client is created. Ignoring this call.' else action_code = action_code.camelize if SyncwiseApi::Requests::V1_0.const_defined?(action_code) params[:'Action Code'] = action_code params[:'API Key'] = @username params[:secretKey] = @secret_key params[:accountId] = @account_id request_class = SyncwiseApi::Requests::V1_0.const_get(action_code) request = request_class.new(params) response = request.send_request else puts 'Sorry, that\'s not a valid request type.' end end end |