Class: FinanceSync::Client
- Inherits:
-
Object
- Object
- FinanceSync::Client
- Defined in:
- lib/finance_sync.rb
Instance Attribute Summary collapse
-
#auth_type ⇒ Object
Returns the value of attribute auth_type.
-
#conflicts ⇒ Object
readonly
Returns the value of attribute conflicts.
-
#entities ⇒ Object
readonly
Returns the value of attribute entities.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(params) ⇒ Client
constructor
A new instance of Client.
- #synchronize(data = {}) ⇒ Object
Constructor Details
#initialize(params) ⇒ Client
Returns a new instance of Client.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/finance_sync.rb', line 14 def initialize(params) @services_url = params[:services_url] @version = params[:version] @user = params[:user] @password = params[:password] @auth_type = params[:auth_type] || :new raise ArgumentError if @user.nil? or @password.nil? raise TypeError unless @version.is_a? Fixnum @error = nil @conflicts = [] end |
Instance Attribute Details
#auth_type ⇒ Object
Returns the value of attribute auth_type.
12 13 14 |
# File 'lib/finance_sync.rb', line 12 def auth_type @auth_type end |
#conflicts ⇒ Object (readonly)
Returns the value of attribute conflicts.
11 12 13 |
# File 'lib/finance_sync.rb', line 11 def conflicts @conflicts end |
#entities ⇒ Object (readonly)
Returns the value of attribute entities.
11 12 13 |
# File 'lib/finance_sync.rb', line 11 def entities @entities end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
11 12 13 |
# File 'lib/finance_sync.rb', line 11 def error @error end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
11 12 13 |
# File 'lib/finance_sync.rb', line 11 def version @version end |
Instance Method Details
#synchronize(data = {}) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/finance_sync.rb', line 27 def synchronize(data={}) data = request_sync(data) return false if data == false @version = data['version'] @entities = data['data'] @conflicts = data['conflicts'] return true end |