a_marmita 0.5.9 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDgxN2M5M2EyZjFlNzAzOWZiZTU5ZmFkOTA1OWVhY2U2MGIxYjU2Mw==
4
+ MjNlZmJmYjIwY2YyMTE4ZDFlZTdmZGRkMjkyZmE2NDc2MmQ3MjgyNA==
5
5
  data.tar.gz: !binary |-
6
- MDQyMmE1ZWM1ZjgwYTVmOTU3NDFlY2EwZTVjZGNiYzAyZDk1ZDI3MA==
6
+ OWI4OTRhYmViYWY4YTY5Njg2MTUwZmQ0OTJmMjA5MGY1OTc5NWY2NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWM3YTE5M2RiNDUwM2U2OTE0YTMxYzU4MGZlZjYyODc1ZDQxZTkxNTg5Njkw
10
- NzdjMmEyNGM0MmUwYWY1OGFkMGEyZGQ5NzU1YjdkMmFkODExNjQ1Yjc4NGFl
11
- MzEyN2VmMGMwZmY2MTY2MjUzZmJhYWQ2NDM5YzRiYjk5MTQ3NWY=
9
+ NGZlY2U0YWVhYTk1NmUwOWE1NzVlNWU4YTA0MzVmMDliZDNjNTVjNDAxYzhj
10
+ NTQ2MzBiYzdiNDU5NTE1NGFmMmIxZTdjZGY3OThiNTY0MTZkMTI5MTc2ZWUw
11
+ NWZhZDFkOTc3Mjc1YzFjODYyZWQ0NmM1MzlmYmE0NzFkMjZiZjQ=
12
12
  data.tar.gz: !binary |-
13
- MjEzYWMwZWFkZjJlNDQ1Njg2MWQ5NjI0NDlhNWY0ODYxYzAyNTc0Njk3OTdl
14
- YTc0M2EzNWQ1N2EzOWJjZWQxN2E1NDZjZGE3ZmI5NDM3Y2UwZTdmODI5MzVl
15
- YjI2YmRmZWE5M2MzMDdkNjc3NGJlNDQ2ZDEwNzVkNzNhZjcwZWQ=
13
+ MDI1MTZjY2I0YTcwMWU5MDQ5ZGQ0OTMyZDU0YTJlN2M1NTU0ZmFjY2UzZDVh
14
+ ZWRjNGY2N2M0M2QzZmZlYmViMmQ1Yzk1MmU5ZWMyYjQ2OGZiODU4NTkxOTdl
15
+ MmQ3NmQzOWRhMmExYTdlNWQxYjU0NmNjMjk5ZDlmMjUxZWJjMjA=
@@ -21,9 +21,10 @@ module AMarmita
21
21
  end.compact
22
22
  end
23
23
 
24
- def add_item(id, date = nil, quantity = 1)
24
+ def add_item(id, date = nil, quantity = nil)
25
25
  return :bad_login if cant_log_in?
26
26
 
27
+ quantity = 1 if Helpers.blank?(quantity)
27
28
  date = Helpers.format_date(date)
28
29
 
29
30
  server_response = get_page_body("http://www.amarmita.com/enc.php?id=#{id}&qtd=#{quantity}&data=#{date}&op=1")
@@ -56,6 +56,15 @@ module AMarmita
56
56
  def get_month_number(month)
57
57
  MONTH_NAMES_PT.index(month.downcase)
58
58
  end
59
+
60
+ def blank?(object)
61
+ case object
62
+ when String
63
+ object == ''
64
+ else
65
+ object.nil?
66
+ end
67
+ end
59
68
 
60
69
  end
61
70
 
@@ -1,3 +1,3 @@
1
1
  module AMarmita
2
- VERSION = "0.5.9"
2
+ VERSION = "0.5.10"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: a_marmita
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - João Gonçalves
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-13 00:00:00.000000000 Z
11
+ date: 2014-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler