Class: GitFit::Import::Tbulu
- Inherits:
-
Source::Base
- Object
- Source::Base
- GitFit::Import::Tbulu
- Defined in:
- lib/git_fit/import/tbulu.rb
Constant Summary collapse
- DEFAULT_IMPORT_DIR =
'data/import/2bulu'
Instance Attribute Summary
Attributes inherited from Source::Base
Instance Method Summary collapse
- #authenticate ⇒ Object
- #before_call ⇒ Object
- #call ⇒ Object
-
#initialize(config:, db:, activity_filter: nil, privacy: nil, time_budget: nil) ⇒ Tbulu
constructor
A new instance of Tbulu.
- #pending_ids ⇒ Object
- #raw_dir ⇒ Object
- #source_label ⇒ Object
- #std_dir ⇒ Object
Methods inherited from Source::Base
Constructor Details
#initialize(config:, db:, activity_filter: nil, privacy: nil, time_budget: nil) ⇒ Tbulu
Returns a new instance of Tbulu.
14 15 16 17 18 |
# File 'lib/git_fit/import/tbulu.rb', line 14 def initialize(config:, db:, activity_filter: nil, privacy: nil, time_budget: nil) super @import_dir = config['import_dir'] || DEFAULT_IMPORT_DIR @timezone_resolver = GitFit::Timezone::Resolver.new(config) end |
Instance Method Details
#authenticate ⇒ Object
25 26 27 |
# File 'lib/git_fit/import/tbulu.rb', line 25 def authenticate true end |
#before_call ⇒ Object
20 21 22 23 |
# File 'lib/git_fit/import/tbulu.rb', line 20 def before_call return false unless File.directory?(@import_dir) super end |
#call ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/git_fit/import/tbulu.rb', line 29 def call return 0 unless before_call files = scan_files total = 0 files.each do |file_path| break if time_expired? && total.positive? r = process_one(file_path) total += 1 if r report_progress(total, files.size, File.basename(file_path)) if r end total end |
#pending_ids ⇒ Object
44 45 46 |
# File 'lib/git_fit/import/tbulu.rb', line 44 def pending_ids [] end |
#raw_dir ⇒ Object
52 53 54 |
# File 'lib/git_fit/import/tbulu.rb', line 52 def raw_dir File.join('data', 'raw', '2bulu') end |
#source_label ⇒ Object
48 49 50 |
# File 'lib/git_fit/import/tbulu.rb', line 48 def source_label '2bulu' end |
#std_dir ⇒ Object
56 57 58 |
# File 'lib/git_fit/import/tbulu.rb', line 56 def std_dir File.join('data', 'std', '2bulu') end |