ifin24-client 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ <component name="ProjectDictionaryState">
2
+ <dictionary name="lucassus">
3
+ <words>
4
+ <w>exceded</w>
5
+ </words>
6
+ </dictionary>
7
+ </component>
data/Rakefile CHANGED
@@ -18,6 +18,7 @@ begin
18
18
 
19
19
  gem.add_dependency "mechanize"
20
20
  gem.add_dependency "highline"
21
+ gem.add_dependency "rainbow"
21
22
 
22
23
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
23
24
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
data/bin/ifin24 CHANGED
@@ -6,6 +6,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
6
  require 'rubygems'
7
7
  require 'mechanize'
8
8
  require 'highline/import'
9
+ require 'rainbow'
9
10
 
10
11
  require 'optparse'
11
12
  require 'ostruct'
@@ -11,13 +11,13 @@ class Ifin24::Commands::AddExpense < Ifin24::Commands::Base
11
11
  menu.index = :letter
12
12
  menu.index_suffix = ") "
13
13
 
14
- menu.choice("Nazwa: #{entry.title}") { get_title(entry) }
15
- menu.choice("Data: #{entry.date}") { get_date(entry) }
16
- menu.choice("Konto: #{entry.account.name}") { get_account(entry) }
17
- menu.choice("Kategoria: #{entry.category_full_name}") { get_category(entry) }
18
- menu.choice("Kwota: #{entry.amount}") { get_amount(entry) }
19
- menu.choice("Tagi: #{entry.tags}") { get_tags(entry) }
20
- menu.choice("Opis: #{entry.note}") { get_note(entry) }
14
+ menu.choice("Nazwa: #{entry.title}") { get_title_for(entry) }
15
+ menu.choice("Data: #{entry.date}") { get_date_for(entry) }
16
+ menu.choice("Konto: #{entry.account.name}") { get_account_for(entry) }
17
+ menu.choice("Kategoria: #{entry.category_full_name}") { get_category_for(entry) }
18
+ menu.choice("Kwota: #{entry.amount}") { get_amount_for(entry) }
19
+ menu.choice("Tagi: #{entry.tags}") { get_tags_for(entry) }
20
+ menu.choice("Opis: #{entry.note}") { get_note_for(entry) }
21
21
 
22
22
  menu.choice("Powrót do głównego menu") do
23
23
  throw :all_ok
@@ -38,29 +38,29 @@ class Ifin24::Commands::AddExpense < Ifin24::Commands::Base
38
38
  def get_entry
39
39
  entry = Ifin24::Models::Entry.new
40
40
 
41
- get_title(entry)
42
- get_date(entry)
43
- get_account(entry)
44
- get_category(entry)
45
- get_amount(entry)
46
- get_tags(entry)
47
- get_note(entry)
41
+ get_title_for(entry)
42
+ get_date_for(entry)
43
+ get_account_for(entry)
44
+ get_category_for(entry)
45
+ get_amount_for(entry)
46
+ get_tags_for(entry)
47
+ get_note_for(entry)
48
48
 
49
49
  return entry
50
50
  end
51
51
 
52
- def get_title(entry)
52
+ def get_title_for(entry)
53
53
  entry.title = ask('Nazwa: ')
54
54
  end
55
55
 
56
- def get_date(entry)
56
+ def get_date_for(entry)
57
57
  curr_date = Date.today
58
58
  entry.date = ask('Data: ') do |q|
59
59
  q.default = curr_date
60
60
  end
61
61
  end
62
62
 
63
- def get_account(entry)
63
+ def get_account_for(entry)
64
64
  choose do |menu|
65
65
  menu.prompt = 'Wybierz rachunek: '
66
66
 
@@ -72,7 +72,7 @@ class Ifin24::Commands::AddExpense < Ifin24::Commands::Base
72
72
  end
73
73
  end
74
74
 
75
- def get_category(entry)
75
+ def get_category_for(entry)
76
76
  choose do |menu|
77
77
  menu.prompt = 'Wybierz kategorię: '
78
78
 
@@ -94,15 +94,15 @@ class Ifin24::Commands::AddExpense < Ifin24::Commands::Base
94
94
  end
95
95
  end
96
96
 
97
- def get_amount(entry)
97
+ def get_amount_for(entry)
98
98
  entry.amount = eval ask('Kwota: ')
99
99
  end
100
100
 
101
- def get_tags(entry)
101
+ def get_tags_for(entry)
102
102
  entry.tags = ask('Tagi: ')
103
103
  end
104
104
 
105
- def get_note(entry)
105
+ def get_note_for(entry)
106
106
  entry.note = ask('Opis: ')
107
107
  end
108
108
 
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Ifin24::Commands::ListLimits < Ifin24::Commands::Base
4
- BAR_SIZE = 50
4
+ LIMIT_BAR_SIZE = 50
5
5
 
6
6
  def execute
7
7
  limits = @client.fetch_limits
@@ -18,15 +18,16 @@ class Ifin24::Commands::ListLimits < Ifin24::Commands::Base
18
18
  private
19
19
 
20
20
  def make_limit_bar(amount, max)
21
+ limit_exceeded = amount >= max
21
22
  amount = [amount, max].min
22
- taken = ((amount / max) * BAR_SIZE).to_i
23
+ taken = ((amount / max) * LIMIT_BAR_SIZE).to_i
23
24
 
24
25
  bar = "["
25
26
  taken.times do
26
- bar << "#"
27
+ bar << "#".color(limit_exceeded ? :red : :green)
27
28
  end
28
29
 
29
- (BAR_SIZE - taken).times do
30
+ (LIMIT_BAR_SIZE - taken).times do
30
31
  bar << "."
31
32
  end
32
33
  bar << "]"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifin24-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - "\xC5\x81ukasz Bandzarewicz"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-28 00:00:00 +02:00
18
+ date: 2010-08-30 00:00:00 +02:00
19
19
  default_executable: ifin24
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -74,6 +74,20 @@ dependencies:
74
74
  version: "0"
75
75
  type: :runtime
76
76
  version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: rainbow
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ type: :runtime
90
+ version_requirements: *id005
77
91
  description: Console for iFIN24
78
92
  email: lucassus@gmail.com
79
93
  executables:
@@ -87,6 +101,7 @@ extra_rdoc_files:
87
101
  files:
88
102
  - .document
89
103
  - .gitignore
104
+ - .idea/dictionaries/lucassus.xml
90
105
  - LICENSE
91
106
  - README
92
107
  - README.rdoc