fitgem-app 1.0.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/fitgem +40 -62
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a0f49f6c140e29b5e2b7c73011cd5d5acb5b05b
4
- data.tar.gz: a8c6fd7b2d5e73c56fd7a54063de3cb6d56a3759
3
+ metadata.gz: f2bf08dc4c8ae15318006ac829053e26640386de
4
+ data.tar.gz: b1897aad1d3b02a96706d950d2a7915d9141dd12
5
5
  SHA512:
6
- metadata.gz: b95189fce8f159a0788d4d8aa595ffc2e72607fbe21c63c499cb1cd2d0753c2c334e995e31c7b339528dfb14662cf1ccd3319cc32e31e7dcf878cd5a45313ff5
7
- data.tar.gz: 58f064b14f43cbf0565dec75744f2daf7c1f5dfb5749d78e76ea146244020b66ec4ce1d4d3d6ec2064655f7c35fb71b957da5d4cc18e1ca6453963aaf73c4273
6
+ metadata.gz: 0fa2f80e0df592ac6e358667bce4961579d03a8d31c98717dfa4bf80d6af40c7690e59214d1fba6b754d84cd722683b2be8d55f577571313e679cf7c5ed10742
7
+ data.tar.gz: 91980e9afbfef6c1d2ce09a9eae5d0bb7cb9379e56e5471d2df979e691dbb57eb9028ad6d4b89d346077420b2b7627261affb3b4c52730044ac189e168a778d2
data/bin/fitgem CHANGED
@@ -2,14 +2,13 @@
2
2
  require 'httparty'
3
3
  require 'multi_json'
4
4
 
5
- puts "Welcome to FitGem!"
6
5
  class FitbitAccount
7
6
  include HTTParty
8
7
  @@base_uri = 'api.fitbit.com/1/user'
9
8
 
10
9
  def initialize()
11
- @access_token = `printf $FB_ACCESS_TOKEN`
12
- @user_id = `printf $FB_USER_ID`
10
+ @access_token = `echo -n $FB_ACCESS_TOKEN`
11
+ @user_id = `echo -n $FB_USER_ID`
13
12
 
14
13
  if @access_token == "" && @user_id == ""
15
14
  puts "We need some information. It will be saved"
@@ -65,66 +64,45 @@ class FitbitAccount
65
64
  def hello
66
65
  return "Hello, World!"
67
66
  end
67
+
68
+ def help
69
+ puts "NAME"
70
+ puts " fitgem - A simple Fitbit CLI\n"
71
+ puts "SYNOPSIS"
72
+ puts " fitgem SHORT-OPTION"
73
+ puts " fitgem LONG-OPTION\n"
74
+ puts "DESCRIPTION"
75
+ puts " steps (s) -- Output steps"
76
+ puts " distance (d) -- Output distance (miles)"
77
+ puts " floors (f) -- Output climbed floors"
78
+ puts " calories (c) -- Output calories burned"
79
+ puts " all (a) -- Output a full report"
80
+ puts " full -- Same as all or a"
81
+ puts " help (?) -- Output this help. Same as leaving blank\n"
82
+ puts "BUGS"
83
+ puts " Please report any bugs to the bug tracker on Github at http://github.com/juniorRubyist/fitgem."
84
+ puts "\nLICENSE"
85
+ puts " This software is released under the MIT License.\n"
86
+ puts "AUTHOR"
87
+ puts " Joseph Geis <geis28@gmail.com> (see files AUTHORS for details)."
88
+ end
68
89
  end
69
90
 
70
91
  fitgem = FitbitAccount.new()
71
- exit_var = false
72
- travis_ci = `printf $TRAVIS_CI`
73
- # Main menu
74
- while !exit_var
75
- if travis_ci == "true"
76
- `clear`
77
- puts "Notice: Travis CI detected\n"
78
- puts "===Full Report==="
79
- fitgem.full_report
80
- puts "===Steps==="
81
- puts fitgem.steps
82
- puts "===Floors==="
83
- puts fitgem.floors
84
- puts "===Distance==="
85
- puts fitgem.distance
86
- puts "===Calories==="
87
- puts fitgem.cals_out
88
- exit_var = true
89
- else
90
- puts "Choose what to do:\n-------"
91
- puts "a -- give me full report (steps, calories, floors [if available], and distance)"
92
- puts "s -- give me steps report"
93
- puts "d -- give me distance report"
94
- puts "f -- give me floors report (if availiable)"
95
- puts "c -- give me calories burned report"
96
- puts "x -- exit Fitgem"
97
- choice = gets.chomp
98
- end
99
- system( "clear" )
100
- case choice
101
- when "a"
102
- fitgem.full_report
103
- when "s"
104
- # Step Count
105
- puts "Today's Step Count: #{fitgem.steps}"
106
- when "d"
107
- puts "Today's Distance: #{fitgem.distance} mi."
108
- when "f"
109
- puts "Floors Climbed: #{fitgem.floors}"
110
- when "c"
111
- puts "Calories Burned: #{fitgem.cals_out}"
112
- # when "o"
113
- # opt_exit = !false
114
- # while opt_exit
115
- # puts "Change Options:\n-------"
116
- # puts "a -- give me full report (steps, calories, floors [if available], and distance)"
117
- # puts "s -- give me steps report"
118
- # puts "d -- give me distance report"
119
- # puts "f -- give me floors report (if availiable)"
120
- # puts "c -- give me calories burned report"
121
- # puts "o -- options"
122
- # puts "x -- exit Fitgem"
123
- # choice = gets.chomp
124
- # end
125
- when "x"
126
- exit_var = true
127
- else
128
- puts "Try Again! Not a command"
129
- end
92
+ choice = ARGV[0]
93
+ case choice
94
+ when 'steps', 's'
95
+ puts fitgem.steps
96
+ when 'distance', 'd'
97
+ puts fitgem.distance
98
+ when 'floors', 'f'
99
+ puts fitgem.floors
100
+ when 'calories', 'c'
101
+ puts calories
102
+ when 'full', 'all', 'a'
103
+ fitgem.full_report
104
+ when 'help', 'h', '?'
105
+ fitgem.help
106
+ else
107
+ fitgem.help
130
108
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fitgem-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Geis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-19 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -56,7 +56,8 @@ homepage: http://juniorrubyist.github.io/fitgem
56
56
  licenses:
57
57
  - MIT
58
58
  metadata: {}
59
- post_install_message:
59
+ post_install_message: Please go to http://juniorRubyist.github.io/fitgem/authorize.html
60
+ to get started.
60
61
  rdoc_options: []
61
62
  require_paths:
62
63
  - lib