Sha256: 77724a8c969845146f49697b0ed7dec7266d39f2af78589db0ca14f30258e8c5

Contents?: true

Size: 973 Bytes

Versions: 17

Compression:

Stored size: 973 Bytes

Contents

module Flydata
  module Command
    class Base
      def initialize
        @api_client = ApiClient.instance
      end
      def flydata; @api_client end

      def retrieve_data_entries
        data_entries = flydata.get('/data_entries')
        unless flydata.response.code == 200
          raise "Failed to retrieve data_entries"
        end
        data_entries
      end
      def register_crontab
        data_entries = retrieve_data_entries
        if data_entries.any?{|e| e['log_deletion']}
          Flydata::Command::Crontab.new.run
        end
      end

      # print console
      def newline; puts end
      def ask_yes_no(message)
        loop do
          ans = ask("#{message} (yes/no):  ")
          if ans.size > 0
            case ans[0].downcase
            when 'y'; return true
            when 'n'; return false
            end
          end
          say(" ! Please answer y[es] or n[o]")
          newline
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
flydata-0.0.3.8 lib/flydata/command/base.rb
flydata-0.0.3.7 lib/flydata/command/base.rb
flydata-0.0.3.6 lib/flydata/command/base.rb
flydata-0.0.3.5 lib/flydata/command/base.rb
flydata-0.0.3.4 lib/flydata/command/base.rb
flydata-0.0.3.3 lib/flydata/command/base.rb
flydata-0.0.3.2 lib/flydata/command/base.rb
flydata-0.0.3.1 lib/flydata/command/base.rb
flydata-0.0.3 lib/flydata/command/base.rb
flydata-0.0.3.rc1 lib/flydata/command/base.rb
flydata-0.0.2.3 lib/flydata/command/base.rb
flydata-0.0.2.2 lib/flydata/command/base.rb
flydata-0.0.2.1 lib/flydata/command/base.rb
flydata-0.0.2 lib/flydata/command/base.rb
flydata-0.0.2.rc1 lib/flydata/command/base.rb
flydata-0.0.1.2011102901 lib/flydata/command/base.rb
flydata-0.0.1.nc2 lib/flydata/command/base.rb