lunchmoney 0.10.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0eee6d8599ca3bcc3937bff5208db6a4502029ed711940ffbe90e807c4b0bd1
4
- data.tar.gz: e8f7d58fbf604cf59c60111963c063273f04b7bab3e7d3ddf1e0684213cab1d2
3
+ metadata.gz: 66fd4ba45ca3d30c32dea0c70f504714811980af2bf373b2412232da5e9d19da
4
+ data.tar.gz: 1a2becc26568423ff1b6fa70108400efa5cc366cd65e1ced013eb34084c65dee
5
5
  SHA512:
6
- metadata.gz: a6a0af1c49bac3eccbaaa802dc7c4d9c59122083e69ae19efdeda3bf322e3f5c290b1f207d4805cc4b9fcff62ae317fb2249cd2340ce3186fef0b930b9132a20
7
- data.tar.gz: 971503cc33d3bec22fc0e643141d85d49ba5a5295fc85f2f7e3d37f40216c57368f05e394293a86184f6052696c9aed1efc58104b177c5614194b8b3a970dcd5
6
+ metadata.gz: 5a3a997026a7ab6c541ef0cb4c8b1fb6fcf992ad91d2ae6cc1ba408007f88a7a001cb9703d7c15038f4ce87fa36d78a9580b4cd5010e3a36a747c4845ce5e96b
7
+ data.tar.gz: 3a4c3ec3283535b9829afd17427f89e7f88538826b4c30f02075e13807e925fac9070d90f9061ea7ec6cc8f135099dc43623929f83a322a48c987644083931d7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lunchmoney (0.10.0)
4
+ lunchmoney (1.0.0)
5
5
  activesupport (>= 6.1)
6
6
  faraday (>= 1.0.0)
7
7
  sorbet-runtime (>= 0.5)
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # lunchmoney
2
2
 
3
- This gem and readme are very much a work in progress. More to come!
3
+ [![Gem Version](https://badge.fury.io/rb/lunchmoney.svg)](https://badge.fury.io/rb/lunchmoney)
4
+ [![CI](https://github.com/halorrr/lunchmoney/actions/workflows/ci.yml/badge.svg)](https://github.com/halorrr/lunchmoney/actions/workflows/ci.yml)
5
+ [![Yard Docs](https://github.com/halorrr/lunchmoney/actions/workflows/build_and_publish_yard_docs.yml/badge.svg)](https://github.com/halorrr/lunchmoney/actions/workflows/build_and_publish_yard_docs.yml)
4
6
 
5
- This gem is a library of the [LunchMoney API](https://lunchmoney.dev/) for the wonderful [LunchMoney](http://lunchmoney.app/) web app for personal finance & budgeting.
7
+ This gem is a API client library of the [LunchMoney API](https://lunchmoney.dev/) for the wonderful [LunchMoney](http://lunchmoney.app/) web app for personal finance & budgeting.
6
8
 
7
- You can find the yard docs for this gem [here](https://halorrr.github.io/lunchmoney/)
9
+ Documentation is still a work in process, but you can find the yard docs for this gem [here](https://halorrr.github.io/lunchmoney/) as well as some write ups of the basics below.
8
10
 
9
11
  ## Usage
10
12
 
@@ -36,13 +38,48 @@ LunchMoney::Api.new(api_key: "your_api_key")
36
38
 
37
39
  ### Using the API
38
40
 
39
- Create an instance of the api, then call the endpoint you need:
41
+ It is intended that all calls typically go through a `LunchMoney::Api` instannce. This class delegates methods to their
42
+ relvant classes behind the scenes. Create an instance of the api, then call the endpoint you need:
40
43
 
41
44
  ```Ruby
42
45
  api = LunchMoney::Api.new
43
46
  api.categories
44
47
  ```
45
48
 
49
+ When the api returns an error a `LunchMoney::Errors` object will be returned. You can check the errors that occured via
50
+ `.messages` on the instance. This will return an array of errors.
51
+
52
+ ```Ruby
53
+ api = LunchMoney::Api.new
54
+ response = api.categories
55
+
56
+ response.class
57
+ => LunchMoney::Errors
58
+
59
+ response.messages
60
+ => ["Some error returned by the API"]
61
+ ```
62
+
63
+ The instance itself has been set up to act like an array, delegating a lot of common array getter methods directly to
64
+ messages for you. This enables things like:
65
+
66
+ ```Ruby
67
+ api = LunchMoney::Api.new
68
+ response = api.categories
69
+
70
+ response.class
71
+ => LunchMoney::Errors
72
+
73
+ response.first
74
+ => "Some error returned by the API"
75
+
76
+ response.empty?
77
+ => false
78
+
79
+ response[0]
80
+ => "Some error returned by the API"
81
+ ```
82
+
46
83
  ## Contributing to this repo
47
84
 
48
85
  Feel free to contribute and submit PRs to improve this gem
@@ -3,5 +3,5 @@
3
3
 
4
4
  module LunchMoney
5
5
  # Current version of the gem
6
- VERSION = "0.10.0"
6
+ VERSION = "1.0.0"
7
7
  end
data/lunchmoney.gemspec CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["documentation_uri"] = "https://halorrr.github.io/lunchmoney/"
19
20
  spec.metadata["changelog_uri"] = "#{spec.homepage}/releases"
20
21
 
21
22
  # Specify which files should be added to the gem when it is released.
@@ -10908,43 +10908,43 @@ class ActiveSupport::TestCase < ::Minitest::Test
10908
10908
  # source://activesupport//lib/active_support/callbacks.rb#963
10909
10909
  def _teardown_callbacks; end
10910
10910
 
10911
- # source://minitest/5.21.1/lib/minitest/assertions.rb#736
10911
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#736
10912
10912
  def assert_no_match(matcher, obj, msg = T.unsafe(nil)); end
10913
10913
 
10914
- # source://minitest/5.21.1/lib/minitest/assertions.rb#665
10914
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#665
10915
10915
  def assert_not_empty(obj, msg = T.unsafe(nil)); end
10916
10916
 
10917
- # source://minitest/5.21.1/lib/minitest/assertions.rb#676
10917
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#676
10918
10918
  def assert_not_equal(exp, act, msg = T.unsafe(nil)); end
10919
10919
 
10920
- # source://minitest/5.21.1/lib/minitest/assertions.rb#688
10920
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#688
10921
10921
  def assert_not_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end
10922
10922
 
10923
- # source://minitest/5.21.1/lib/minitest/assertions.rb#700
10923
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#700
10924
10924
  def assert_not_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end
10925
10925
 
10926
- # source://minitest/5.21.1/lib/minitest/assertions.rb#707
10926
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#707
10927
10927
  def assert_not_includes(collection, obj, msg = T.unsafe(nil)); end
10928
10928
 
10929
- # source://minitest/5.21.1/lib/minitest/assertions.rb#718
10929
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#718
10930
10930
  def assert_not_instance_of(cls, obj, msg = T.unsafe(nil)); end
10931
10931
 
10932
- # source://minitest/5.21.1/lib/minitest/assertions.rb#728
10932
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#728
10933
10933
  def assert_not_kind_of(cls, obj, msg = T.unsafe(nil)); end
10934
10934
 
10935
- # source://minitest/5.21.1/lib/minitest/assertions.rb#746
10935
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#746
10936
10936
  def assert_not_nil(obj, msg = T.unsafe(nil)); end
10937
10937
 
10938
- # source://minitest/5.21.1/lib/minitest/assertions.rb#781
10938
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#781
10939
10939
  def assert_not_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end
10940
10940
 
10941
- # source://minitest/5.21.1/lib/minitest/assertions.rb#804
10941
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#804
10942
10942
  def assert_not_predicate(o1, op, msg = T.unsafe(nil)); end
10943
10943
 
10944
- # source://minitest/5.21.1/lib/minitest/assertions.rb#813
10944
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#813
10945
10945
  def assert_not_respond_to(obj, meth, msg = T.unsafe(nil), include_all: T.unsafe(nil)); end
10946
10946
 
10947
- # source://minitest/5.21.1/lib/minitest/assertions.rb#822
10947
+ # source://minitest/5.21.2/lib/minitest/assertions.rb#822
10948
10948
  def assert_not_same(exp, act, msg = T.unsafe(nil)); end
10949
10949
 
10950
10950
  # source://activesupport//lib/active_support/testing/file_fixtures.rb#20
@@ -10956,7 +10956,7 @@ class ActiveSupport::TestCase < ::Minitest::Test
10956
10956
  # source://activesupport//lib/active_support/test_case.rb#298
10957
10957
  def inspect; end
10958
10958
 
10959
- # source://minitest/5.21.1/lib/minitest.rb#311
10959
+ # source://minitest/5.21.2/lib/minitest.rb#311
10960
10960
  def method_name; end
10961
10961
 
10962
10962
  class << self
@@ -13364,7 +13364,7 @@ end
13364
13364
  # source://activesupport//lib/active_support/xml_mini/rexml.rb#11
13365
13365
  ActiveSupport::XmlMini_REXML::CONTENT_KEY = T.let(T.unsafe(nil), String)
13366
13366
 
13367
- # source://activesupport//lib/active_support/core_ext/object/blank.rb#83
13367
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#39
13368
13368
  class Array
13369
13369
  include ::Enumerable
13370
13370
 
@@ -13699,6 +13699,13 @@ class Date
13699
13699
  # source://activesupport//lib/active_support/core_ext/date/calculations.rb#152
13700
13700
  def <=>(other); end
13701
13701
 
13702
+ # Duck-types as a Date-like class. See Object#acts_like?.
13703
+ #
13704
+ # @return [Boolean]
13705
+ #
13706
+ # source://activesupport//lib/active_support/core_ext/date/acts_like.rb#7
13707
+ def acts_like_date?; end
13708
+
13702
13709
  # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with
13703
13710
  # any of these keys: <tt>:years</tt>, <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>.
13704
13711
  #
@@ -15253,7 +15260,7 @@ class Exception
15253
15260
  def as_json(options = T.unsafe(nil)); end
15254
15261
  end
15255
15262
 
15256
- # source://activesupport//lib/active_support/core_ext/object/blank.rb#61
15263
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#32
15257
15264
  class FalseClass
15258
15265
  # source://activesupport//lib/active_support/core_ext/object/json.rb#89
15259
15266
  def as_json(options = T.unsafe(nil)); end
@@ -16397,7 +16404,7 @@ class NameError < ::StandardError
16397
16404
  include ::DidYouMean::Correctable
16398
16405
  end
16399
16406
 
16400
- # source://activesupport//lib/active_support/core_ext/object/blank.rb#50
16407
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#18
16401
16408
  class NilClass
16402
16409
  # source://activesupport//lib/active_support/core_ext/object/json.rb#95
16403
16410
  def as_json(options = T.unsafe(nil)); end
@@ -16438,7 +16445,7 @@ class NilClass
16438
16445
  def try!(*_arg0); end
16439
16446
  end
16440
16447
 
16441
- # source://activesupport//lib/active_support/core_ext/object/blank.rb#134
16448
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#9
16442
16449
  class Numeric
16443
16450
  include ::Comparable
16444
16451
 
@@ -16469,6 +16476,20 @@ class Numeric
16469
16476
  # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#15
16470
16477
  def bytes; end
16471
16478
 
16479
+ # Returns a Duration instance matching the number of days provided.
16480
+ #
16481
+ # 2.days # => 2 days
16482
+ #
16483
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#37
16484
+ def day; end
16485
+
16486
+ # Returns a Duration instance matching the number of days provided.
16487
+ #
16488
+ # 2.days # => 2 days
16489
+ #
16490
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#37
16491
+ def days; end
16492
+
16472
16493
  # Returns the number of bytes equivalent to the exabytes provided.
16473
16494
  #
16474
16495
  # 2.exabytes # => 2_305_843_009_213_693_952
@@ -16483,6 +16504,20 @@ class Numeric
16483
16504
  # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#63
16484
16505
  def exabytes; end
16485
16506
 
16507
+ # Returns a Duration instance matching the number of fortnights provided.
16508
+ #
16509
+ # 2.fortnights # => 4 weeks
16510
+ #
16511
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#53
16512
+ def fortnight; end
16513
+
16514
+ # Returns a Duration instance matching the number of fortnights provided.
16515
+ #
16516
+ # 2.fortnights # => 4 weeks
16517
+ #
16518
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#53
16519
+ def fortnights; end
16520
+
16486
16521
  # Returns the number of bytes equivalent to the gigabytes provided.
16487
16522
  #
16488
16523
  # 2.gigabytes # => 2_147_483_648
@@ -16497,11 +16532,34 @@ class Numeric
16497
16532
  # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#39
16498
16533
  def gigabytes; end
16499
16534
 
16535
+ # Returns a Duration instance matching the number of hours provided.
16536
+ #
16537
+ # 2.hours # => 2 hours
16538
+ #
16539
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#29
16540
+ def hour; end
16541
+
16542
+ # Returns a Duration instance matching the number of hours provided.
16543
+ #
16544
+ # 2.hours # => 2 hours
16545
+ #
16546
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#29
16547
+ def hours; end
16548
+
16500
16549
  # @return [Boolean]
16501
16550
  #
16502
16551
  # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#13
16503
16552
  def html_safe?; end
16504
16553
 
16554
+ # Returns the number of milliseconds equivalent to the seconds provided.
16555
+ # Used with the standard time durations.
16556
+ #
16557
+ # 2.in_milliseconds # => 2000
16558
+ # 1.hour.in_milliseconds # => 3600000
16559
+ #
16560
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#63
16561
+ def in_milliseconds; end
16562
+
16505
16563
  # Returns the number of bytes equivalent to the kilobytes provided.
16506
16564
  #
16507
16565
  # 2.kilobytes # => 2048
@@ -16530,6 +16588,20 @@ class Numeric
16530
16588
  # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#31
16531
16589
  def megabytes; end
16532
16590
 
16591
+ # Returns a Duration instance matching the number of minutes provided.
16592
+ #
16593
+ # 2.minutes # => 2 minutes
16594
+ #
16595
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#21
16596
+ def minute; end
16597
+
16598
+ # Returns a Duration instance matching the number of minutes provided.
16599
+ #
16600
+ # 2.minutes # => 2 minutes
16601
+ #
16602
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#21
16603
+ def minutes; end
16604
+
16533
16605
  # Returns the number of bytes equivalent to the petabytes provided.
16534
16606
  #
16535
16607
  # 2.petabytes # => 2_251_799_813_685_248
@@ -16544,6 +16616,20 @@ class Numeric
16544
16616
  # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#55
16545
16617
  def petabytes; end
16546
16618
 
16619
+ # Returns a Duration instance matching the number of seconds provided.
16620
+ #
16621
+ # 2.seconds # => 2 seconds
16622
+ #
16623
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#13
16624
+ def second; end
16625
+
16626
+ # Returns a Duration instance matching the number of seconds provided.
16627
+ #
16628
+ # 2.seconds # => 2 seconds
16629
+ #
16630
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#13
16631
+ def seconds; end
16632
+
16547
16633
  # Returns the number of bytes equivalent to the terabytes provided.
16548
16634
  #
16549
16635
  # 2.terabytes # => 2_199_023_255_552
@@ -16558,6 +16644,20 @@ class Numeric
16558
16644
  # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#47
16559
16645
  def terabytes; end
16560
16646
 
16647
+ # Returns a Duration instance matching the number of weeks provided.
16648
+ #
16649
+ # 2.weeks # => 2 weeks
16650
+ #
16651
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#45
16652
+ def week; end
16653
+
16654
+ # Returns a Duration instance matching the number of weeks provided.
16655
+ #
16656
+ # 2.weeks # => 2 weeks
16657
+ #
16658
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#45
16659
+ def weeks; end
16660
+
16561
16661
  # Returns the number of bytes equivalent to the zettabytes provided.
16562
16662
  #
16563
16663
  # 2.zettabytes # => 2_361_183_241_434_822_606_848
@@ -16613,7 +16713,7 @@ Numeric::ZETTABYTE = T.let(T.unsafe(nil), Integer)
16613
16713
  # using that rescue idiom.
16614
16714
  # ++
16615
16715
  #
16616
- # source://activesupport//lib/active_support/core_ext/object/blank.rb#5
16716
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#5
16617
16717
  class Object < ::BasicObject
16618
16718
  include ::ActiveSupport::ToJsonWithActiveSupportEncoder
16619
16719
  include ::ActiveSupport::Dependencies::RequireDependency
@@ -16820,7 +16920,7 @@ end
16820
16920
  #
16821
16921
  # 'ScaleScore'.tableize # => "scale_scores"
16822
16922
  #
16823
- # source://activesupport//lib/active_support/core_ext/object/blank.rb#103
16923
+ # source://activesupport//lib/active_support/core_ext/string/multibyte.rb#5
16824
16924
  class String
16825
16925
  include ::Comparable
16826
16926
 
@@ -17477,7 +17577,7 @@ class Thread
17477
17577
  def active_support_execution_state=(_arg0); end
17478
17578
  end
17479
17579
 
17480
- # source://activesupport//lib/active_support/core_ext/object/blank.rb#146
17580
+ # source://activesupport//lib/active_support/core_ext/time/conversions.rb#7
17481
17581
  class Time
17482
17582
  include ::Comparable
17483
17583
  include ::DateAndTime::Zones
@@ -17974,7 +18074,7 @@ Time::COMMON_YEAR_DAYS_IN_MONTH = T.let(T.unsafe(nil), Array)
17974
18074
  # source://activesupport//lib/active_support/core_ext/time/conversions.rb#8
17975
18075
  Time::DATE_FORMATS = T.let(T.unsafe(nil), Hash)
17976
18076
 
17977
- # source://activesupport//lib/active_support/core_ext/object/blank.rb#72
18077
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#25
17978
18078
  class TrueClass
17979
18079
  # source://activesupport//lib/active_support/core_ext/object/json.rb#83
17980
18080
  def as_json(options = T.unsafe(nil)); end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lunchmoney
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "@halorrr"
@@ -205,6 +205,7 @@ metadata:
205
205
  allowed_push_host: https://rubygems.org
206
206
  homepage_uri: https://github.com/halorrr/lunchmoney
207
207
  source_code_uri: https://github.com/halorrr/lunchmoney
208
+ documentation_uri: https://halorrr.github.io/lunchmoney/
208
209
  changelog_uri: https://github.com/halorrr/lunchmoney/releases
209
210
  post_install_message:
210
211
  rdoc_options: []