Class: Wunderlist::Sync
- Inherits:
-
Object
- Object
- Wunderlist::Sync
- Defined in:
- lib/wunderlist/sync.rb
Overview
Strongly based on js/backend/wunderlist.sync.js
This is where the ‘steps’ come from.
Instance Attribute Summary collapse
- #lists ⇒ Object
-
#step_1_response ⇒ Object
readonly
Debug only, may be removed without warning.
- #tasks ⇒ Object
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(email, password, options = {}) ⇒ Sync
constructor
A new instance of Sync.
- #sync ⇒ Object
Constructor Details
#initialize(email, password, options = {}) ⇒ Sync
Returns a new instance of Sync.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wunderlist/sync.rb', line 15 def initialize email, password, = {} @options = Wunderlist::DEFAULTS.merge() if @options[:app_name] == Wunderlist::DEFAULTS[:app_name] STDERR.write "%s:%d: %s\n" % [ File.(__FILE__), __LINE__, 'Please set :app_name and :app_version to non-default values.' ] end @email = email if [:hashed_password] @password_md5 = password else @password_md5 = OpenSSL::Digest.hexdigest('md5', password) end end |
Instance Attribute Details
#lists ⇒ Object
48 49 50 |
# File 'lib/wunderlist/sync.rb', line 48 def lists @lists ||= Array.new end |
#step_1_response ⇒ Object (readonly)
Debug only, may be removed without warning
12 13 14 |
# File 'lib/wunderlist/sync.rb', line 12 def step_1_response @step_1_response end |
#tasks ⇒ Object
52 53 54 |
# File 'lib/wunderlist/sync.rb', line 52 def tasks @tasks ||= Array.new end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
13 14 15 |
# File 'lib/wunderlist/sync.rb', line 13 def user_id @user_id end |
Instance Method Details
#sync ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/wunderlist/sync.rb', line 33 def sync # Sends: # - Tasks & lists: already synced, id & version # - TODO: New lists # Receives: # - New and updated tasks # - New and updated lists # - TODO: delete_tasks # - Current user id run_step_1 # Process step 1 data run_step_2 nil end |