moneylovercli 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +67 -0
- data/LICENSE.txt +20 -0
- data/README.md +45 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/moneylovercli +18 -0
- data/lib/moneylovercli.rb +7 -0
- data/lib/moneylovercli/api/access_token.rb +19 -0
- data/lib/moneylovercli/api/base.rb +15 -0
- data/lib/moneylovercli/api/category.rb +15 -0
- data/lib/moneylovercli/api/money_lover.rb +14 -0
- data/lib/moneylovercli/api/transaction.rb +25 -0
- data/lib/moneylovercli/api/user.rb +13 -0
- data/lib/moneylovercli/api/wallet.rb +13 -0
- data/lib/moneylovercli/cli.rb +62 -0
- data/lib/moneylovercli/command.rb +141 -0
- data/lib/moneylovercli/commands/.gitkeep +1 -0
- data/lib/moneylovercli/commands/add_transaction.rb +74 -0
- data/lib/moneylovercli/commands/login.rb +61 -0
- data/lib/moneylovercli/commands/wallets.rb +31 -0
- data/lib/moneylovercli/version.rb +4 -0
- data/moneylovercli.gemspec +33 -0
- data/sorbet/config +2 -0
- data/sorbet/rbi/gems/byebug.rbi +1041 -0
- data/sorbet/rbi/gems/coderay.rbi +92 -0
- data/sorbet/rbi/gems/equatable.rbi +26 -0
- data/sorbet/rbi/gems/httparty.rbi +421 -0
- data/sorbet/rbi/gems/method_source.rbi +64 -0
- data/sorbet/rbi/gems/mime-types-data.rbi +17 -0
- data/sorbet/rbi/gems/mime-types.rbi +218 -0
- data/sorbet/rbi/gems/multi_xml.rbi +35 -0
- data/sorbet/rbi/gems/pastel.rbi +128 -0
- data/sorbet/rbi/gems/pry-byebug.rbi +155 -0
- data/sorbet/rbi/gems/pry.rbi +1949 -0
- data/sorbet/rbi/gems/rake.rbi +645 -0
- data/sorbet/rbi/gems/rspec-core.rbi +1923 -0
- data/sorbet/rbi/gems/rspec-expectations.rbi +1123 -0
- data/sorbet/rbi/gems/rspec-mocks.rbi +1090 -0
- data/sorbet/rbi/gems/rspec-support.rbi +280 -0
- data/sorbet/rbi/gems/rspec.rbi +15 -0
- data/sorbet/rbi/gems/tty-color.rbi +44 -0
- data/sorbet/rbi/gems/zeitwerk.rbi +136 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +4361 -0
- data/sorbet/rbi/hidden-definitions/hidden.rbi +8227 -0
- data/sorbet/rbi/sorbet-typed/lib/httparty/all/httparty.rbi +427 -0
- data/sorbet/rbi/todo.rbi +20 -0
- metadata +167 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 49b8f9e1d7b921929e56094d843063ce8cc5953b53e5b695b589341b46ddd859
|
4
|
+
data.tar.gz: 54c5e9a342a7b7c56f0553c71b96ad744fdd102096fe78a01a4a5ad4f00096a1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 31578504edaf54e09ab0a87fac6a03c79d68cd1a21ec382e206d11f49268af5c03a794433b7d2976f67d7f52869703067424e8d00979295515483e3c315e1abe
|
7
|
+
data.tar.gz: 25e774c792a3c0bc7f9016df3c52bd4dc6c354d625654db797873ffc75be4b8e8b58c63f8e5883cb9df5e294cd261474f47414ce8b3069c87865bf432cd67a6c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.7.0
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at cuong.ngo@employmenthero.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
moneylovercli (0.1.0)
|
5
|
+
byebug
|
6
|
+
httparty
|
7
|
+
pastel (= 0.7.4)
|
8
|
+
pry-byebug
|
9
|
+
zeitwerk
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
byebug (11.1.3)
|
15
|
+
coderay (1.1.3)
|
16
|
+
diff-lcs (1.4.4)
|
17
|
+
equatable (0.6.1)
|
18
|
+
httparty (0.18.1)
|
19
|
+
mime-types (~> 3.0)
|
20
|
+
multi_xml (>= 0.5.2)
|
21
|
+
method_source (1.0.0)
|
22
|
+
mime-types (3.3.1)
|
23
|
+
mime-types-data (~> 3.2015)
|
24
|
+
mime-types-data (3.2020.0512)
|
25
|
+
multi_xml (0.6.0)
|
26
|
+
pastel (0.7.4)
|
27
|
+
equatable (~> 0.6)
|
28
|
+
tty-color (~> 0.5)
|
29
|
+
pry (0.13.1)
|
30
|
+
coderay (~> 1.1)
|
31
|
+
method_source (~> 1.0)
|
32
|
+
pry-byebug (3.9.0)
|
33
|
+
byebug (~> 11.0)
|
34
|
+
pry (~> 0.13.0)
|
35
|
+
rake (12.3.3)
|
36
|
+
rspec (3.9.0)
|
37
|
+
rspec-core (~> 3.9.0)
|
38
|
+
rspec-expectations (~> 3.9.0)
|
39
|
+
rspec-mocks (~> 3.9.0)
|
40
|
+
rspec-core (3.9.2)
|
41
|
+
rspec-support (~> 3.9.3)
|
42
|
+
rspec-expectations (3.9.2)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.9.0)
|
45
|
+
rspec-mocks (3.9.1)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.9.0)
|
48
|
+
rspec-support (3.9.3)
|
49
|
+
sorbet (0.5.5909)
|
50
|
+
sorbet-static (= 0.5.5909)
|
51
|
+
sorbet-runtime (0.5.5909)
|
52
|
+
sorbet-static (0.5.5909-universal-darwin-14)
|
53
|
+
tty-color (0.5.2)
|
54
|
+
zeitwerk (2.4.0)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
ruby
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
moneylovercli!
|
61
|
+
rake (~> 12.0)
|
62
|
+
rspec (~> 3.0)
|
63
|
+
sorbet
|
64
|
+
sorbet-runtime
|
65
|
+
|
66
|
+
BUNDLED WITH
|
67
|
+
2.1.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 cuongn265
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Moneylovercli
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/moneylovercli`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'moneylovercli'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install moneylovercli
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
$ moneylovercli login
|
26
|
+
$ moneylovercli add_transaction
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
+
|
32
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/moneylovercli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/moneylovercli/blob/master/CODE_OF_CONDUCT.md).
|
37
|
+
|
38
|
+
|
39
|
+
## Code of Conduct
|
40
|
+
|
41
|
+
Everyone interacting in the Moneylovercli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/moneylovercli/blob/master/CODE_OF_CONDUCT.md).
|
42
|
+
|
43
|
+
## Copyright
|
44
|
+
|
45
|
+
Copyright (c) 2020 cuongn265. See [MIT License](LICENSE.txt) for further details.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "moneylovercli"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/exe/moneylovercli
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib_path = File.expand_path('../lib', __dir__)
|
5
|
+
$:.unshift(lib_path) if !$:.include?(lib_path)
|
6
|
+
require 'moneylovercli/cli'
|
7
|
+
|
8
|
+
Signal.trap('INT') do
|
9
|
+
warn("\n#{caller.join("\n")}: interrupted")
|
10
|
+
exit(1)
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
Moneylovercli::CLI.start
|
15
|
+
rescue Moneylovercli::CLI::Error => err
|
16
|
+
puts "ERROR: #{err.message}"
|
17
|
+
exit 1
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# typed: strict
|
2
|
+
require_relative './base.rb'
|
3
|
+
|
4
|
+
module Moneylovercli
|
5
|
+
module Api
|
6
|
+
class AccessToken < Base
|
7
|
+
base_uri 'https://oauth.moneylover.me'
|
8
|
+
|
9
|
+
sig do
|
10
|
+
params(authorization_token: String, client: String, email: String, password: String)
|
11
|
+
.returns(HTTParty::Response)
|
12
|
+
end
|
13
|
+
def access_token(authorization_token:, client:, email:, password:)
|
14
|
+
self.class.post('/token', body: { email: email, password: password },
|
15
|
+
headers: { authorization: "Bearer #{authorization_token}", client: client })
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# typed: true
|
2
|
+
require 'sorbet-runtime'
|
3
|
+
|
4
|
+
module Moneylovercli
|
5
|
+
module Api
|
6
|
+
class Category < MoneyLover
|
7
|
+
sig { params(wallet_id: String).returns(HTTParty::Response) }
|
8
|
+
|
9
|
+
def list(wallet_id:)
|
10
|
+
self.class.post('/category/list', body: { walletId: wallet_id },
|
11
|
+
headers: { authorization: "AuthJWT #{@token}" })
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# typed: true
|
2
|
+
require 'sorbet-runtime'
|
3
|
+
|
4
|
+
module Moneylovercli
|
5
|
+
module Api
|
6
|
+
class Transaction < MoneyLover
|
7
|
+
sig do
|
8
|
+
params(account: String, category_id: String, amount: Integer, display_date: String)
|
9
|
+
.returns(HTTParty::Response)
|
10
|
+
end
|
11
|
+
|
12
|
+
def add(account:, category_id:, amount:, display_date:)
|
13
|
+
self.class.post('/transaction/add',
|
14
|
+
body: {
|
15
|
+
account: account,
|
16
|
+
category: category_id,
|
17
|
+
amount: amount,
|
18
|
+
displayDate: display_date
|
19
|
+
},
|
20
|
+
headers: { authorization: "AuthJWT #{@token}" })
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# typed: true
|
2
|
+
require_relative './money_lover'
|
3
|
+
|
4
|
+
module Moneylovercli
|
5
|
+
module Api
|
6
|
+
class Wallet < MoneyLover
|
7
|
+
sig { returns(HTTParty::Response) }
|
8
|
+
def list
|
9
|
+
self.class.post('/wallet/list', body: {}, headers: { authorization: "AuthJWT #{@token}" })
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|