Sha256: 6289699bbb700efe8debfde5cbc1728e8b79ae221b0df8282de73d5dd51574d5

Contents?: true

Size: 1007 Bytes

Versions: 8

Compression:

Stored size: 1007 Bytes

Contents

begin
  require 'harvestthings/harvest'
  require 'harvestthings/things'
  require 'harvestthings/sync'
rescue LoadError => e
  puts "there was an error loading a dependancy: #{e}"
end

module HarvestThings
  
  class Application
    
    # include sync mixin
    include Sync
    
    # initialize - defines a harvest and things object  
    #
    # @return [Boolean]
    def initialize
      @harvest = Harvest.new
      @things = Things.new
      init_sync if config_checks?
    end
    
    # init_sync - kicks off the syncing  
    #
    # @return [String]
    def init_sync
      print "starting sync"
      things_projects_to_harvest
      puts ".finished. ciao!"
    end
    
  private
    
    # config_checks? - makes sure the config credentials are correct  
    #
    # @return [Boolean]
    def config_checks?
      begin
        response = @harvest.request '/clients', :get
      rescue
        exception = true
      end
      return exception == true ? false : true
    end
    
  end
  
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
harvestthings-1.0.3 lib/harvestthings/application.rb
harvestthings-1.0.2 lib/harvestthings/application.rb
harvestthings-1.0.1 lib/harvestthings/application.rb
harvestthingstest-1.0.0.4 lib/harvestthings/application.rb
harvestthingstest-1.0.0.3 lib/harvestthings/application.rb
harvestthingstest-1.0.0.2 lib/harvestthings/application.rb
harvestthingstest-1.0.0.1 lib/harvestthings/application.rb
harvestthings-1.0.0 lib/harvestthings/application.rb