nova-api 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a266432dc94cd0389130d02b53febc820c44077340febee798db6a731fecdf61
4
+ data.tar.gz: 29c58b11990b3deae87ff55a678058a830cb6c652677eb6509818e1b85310609
5
+ SHA512:
6
+ metadata.gz: 85e4c7c5a6858b21d66421438ca04fb86343c3ee4e7592bb56fa80a2c8807f5f133b6794238fae36be6617ffd95c363523c7aab4aafbb5e21fcf1cd6e34eb50d
7
+ data.tar.gz: 787e55980884ceb41fbc99c3f7337317da15c2a4d6410ee83773ded174d9a61c629d2d27c7395b2d5637a007dec456d00425891779eb2edb9d28dfbe380d7371
@@ -0,0 +1,43 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@0.1.2
4
+
5
+ jobs:
6
+ test:
7
+ docker:
8
+ - image: circleci/ruby:2.6.3-stretch-node
9
+ executor: ruby/default
10
+ steps:
11
+ - checkout
12
+ - run:
13
+ name: Bundle
14
+ command: bash bin/setup
15
+ - run:
16
+ name: Run tests
17
+ command: bundle exec rspec
18
+ deploy:
19
+ docker:
20
+ - image: circleci/ruby:2.6.3-stretch-node
21
+ executor: ruby/default
22
+ steps:
23
+ - checkout
24
+ - run:
25
+ name: Setup Rubygems
26
+ command: bash .circleci/setup-rubygems.sh
27
+ - run:
28
+ name: Publish to Rubygems
29
+ command: |
30
+ gem build nova-api.gemspec
31
+ gem push "nova-api-$(git describe --tags).gem"
32
+
33
+ workflows:
34
+ version: 2
35
+ test-deploy:
36
+ jobs:
37
+ - test
38
+ - deploy:
39
+ filters:
40
+ tags:
41
+ only: /.*/
42
+ branches:
43
+ ignore: /.*/
@@ -0,0 +1,3 @@
1
+ mkdir ~/.gem
2
+ echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
+ chmod 0600 /home/circleci/.gem/credentials
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.5
7
+ before_install: gem install bundler -v 1.17.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.4.0] - 2021-03-05
11
+
12
+ ### Added
13
+
14
+ - Current asset related stuff (still missing Card Taxes)
15
+
16
+ ### Changed
17
+
18
+ - The 'with_deleted' flag is now called 'with_inactive'
19
+
20
+ - The 'deleted' flags are now called 'active'
21
+
22
+ ## [0.3.0] - 2021-03-04
23
+
24
+ ### Added
25
+
26
+ - Third party related stuff
27
+
28
+ ## [0.2.0] - 2021-03-03
29
+
30
+ ### Added
31
+
32
+ - Financial account related stuff
33
+
34
+ ### Fixed
35
+
36
+ - The way that the token was sent
37
+
38
+ ## [0.1.1] - 2021-03-02
39
+
40
+ ### Added
41
+
42
+ - Apportionment related stuff
43
+
44
+ [unreleased]: https://github.com/coyosoftware/nova-api/compare/0.3.0...HEAD
45
+ [0.3.0]: https://github.com/coyosoftware/nova-api/releases/tag/0.3.0
46
+ [0.2.0]: https://github.com/coyosoftware/nova-api/releases/tag/0.2.0
47
+ [0.1.1]: https://github.com/coyosoftware/nova-api/releases/tag/0.1.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in nova-api.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nova-api (0.4.0)
5
+ dry-struct (~> 1.4.0)
6
+ dry-types (~> 1.5.1)
7
+ httparty (~> 0.1)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ addressable (2.7.0)
13
+ public_suffix (>= 2.0.2, < 5.0)
14
+ byebug (11.1.3)
15
+ concurrent-ruby (1.1.8)
16
+ crack (0.4.5)
17
+ rexml
18
+ diff-lcs (1.4.4)
19
+ docile (1.3.5)
20
+ dry-configurable (0.12.1)
21
+ concurrent-ruby (~> 1.0)
22
+ dry-core (~> 0.5, >= 0.5.0)
23
+ dry-container (0.7.2)
24
+ concurrent-ruby (~> 1.0)
25
+ dry-configurable (~> 0.1, >= 0.1.3)
26
+ dry-core (0.5.0)
27
+ concurrent-ruby (~> 1.0)
28
+ dry-inflector (0.2.0)
29
+ dry-logic (1.1.0)
30
+ concurrent-ruby (~> 1.0)
31
+ dry-core (~> 0.5, >= 0.5)
32
+ dry-struct (1.4.0)
33
+ dry-core (~> 0.5, >= 0.5)
34
+ dry-types (~> 1.5)
35
+ ice_nine (~> 0.11)
36
+ dry-types (1.5.1)
37
+ concurrent-ruby (~> 1.0)
38
+ dry-container (~> 0.3)
39
+ dry-core (~> 0.5, >= 0.5)
40
+ dry-inflector (~> 0.1, >= 0.1.2)
41
+ dry-logic (~> 1.0, >= 1.0.2)
42
+ hashdiff (1.0.1)
43
+ httparty (0.18.1)
44
+ mime-types (~> 3.0)
45
+ multi_xml (>= 0.5.2)
46
+ ice_nine (0.11.2)
47
+ mime-types (3.3.1)
48
+ mime-types-data (~> 3.2015)
49
+ mime-types-data (3.2021.0225)
50
+ multi_xml (0.6.0)
51
+ public_suffix (4.0.6)
52
+ rake (10.5.0)
53
+ rexml (3.2.4)
54
+ rspec (3.10.0)
55
+ rspec-core (~> 3.10.0)
56
+ rspec-expectations (~> 3.10.0)
57
+ rspec-mocks (~> 3.10.0)
58
+ rspec-core (3.10.1)
59
+ rspec-support (~> 3.10.0)
60
+ rspec-dry-struct (0.5.0)
61
+ dry-struct
62
+ dry-types (>= 0.15.0)
63
+ rspec
64
+ rspec-expectations (3.10.1)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.10.0)
67
+ rspec-mocks (3.10.2)
68
+ diff-lcs (>= 1.2.0, < 2.0)
69
+ rspec-support (~> 3.10.0)
70
+ rspec-support (3.10.2)
71
+ simplecov (0.21.2)
72
+ docile (~> 1.1)
73
+ simplecov-html (~> 0.11)
74
+ simplecov_json_formatter (~> 0.1)
75
+ simplecov-html (0.12.3)
76
+ simplecov_json_formatter (0.1.2)
77
+ webmock (3.11.2)
78
+ addressable (>= 2.3.6)
79
+ crack (>= 0.3.2)
80
+ hashdiff (>= 0.4.0, < 2.0.0)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ bundler (~> 1.17)
87
+ byebug (~> 11.1.3)
88
+ nova-api!
89
+ rake (~> 10.0)
90
+ rspec (~> 3.0)
91
+ rspec-dry-struct (~> 0.1)
92
+ simplecov (~> 0.21)
93
+ webmock (~> 3.11.2)
94
+
95
+ BUNDLED WITH
96
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Coyô Software
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ Nova::API
2
+ ========
3
+ [![Circle Build Status](https://circleci.com/gh/coyosoftware/nova-api.png?style=shield)](https://circleci.com/gh/coyosoftware/nova-api)
4
+ [![Maintainability](https://api.codeclimate.com/v1/badges/4592d8beaac2e6a18839/maintainability)](https://codeclimate.com/github/coyosoftware/nova-api/maintainability)
5
+ [![Gem Version](https://badge.fury.io/rb/nova-api.svg)](http://badge.fury.io/rb/nova-api)
6
+ [![Downloads](https://img.shields.io/gem/dt/nova-api.svg?style=flat)](https://rubygems.org/gems/nova-api)
7
+
8
+ # Introduction
9
+
10
+ Gem to consume the [Nova.Money API](https://app.swaggerhub.com/apis-docs/coyosoftware/Nova.Money/v1)
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'nova-api'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install nova-api
27
+
28
+ ## Usage
29
+
30
+ First set your credentials and subdomain using the ```configure``` method of the ```Nova::API``` class:
31
+
32
+ ```ruby
33
+ Nova::API.configure do |config|
34
+ config.api_key = 'your-api-key'
35
+ config.subdomain = 'your-subdomain'
36
+ end
37
+ ```
38
+
39
+ After that you can start using the resources either by:
40
+
41
+ - Instantiating a new ```Nova::API::Client``` object;
42
+
43
+ or
44
+
45
+ - Using directly the available resource class (check the resources under [api/resource](lib/nova/api/resource) folder)
46
+
47
+ To know the operations that are supported by a resource, please check the resource source code under the [api/resource](lib/nova/api/resource) folder.
48
+
49
+ ### Querying
50
+
51
+ For most of the query methods, you can pass either a Hash with the parameters described in the API documentation or, if you prefer an object oriented way, you can use the [SearchParams classes](lib/nova/api/search_params), that offer the same functionality but as an object.
52
+
53
+ ## Development
54
+
55
+ 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.
56
+
57
+ 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).
58
+
59
+ ## Contributing
60
+
61
+ Bug reports and pull requests are welcome on GitHub at https://github.com/coyosoftware/nova-api.
62
+
63
+ ## License
64
+
65
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nova/api"
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/nova/api.rb ADDED
@@ -0,0 +1,84 @@
1
+ require "nova/configuration"
2
+
3
+ require "nova/api/utils/base_struct"
4
+ require "nova/api/version"
5
+ require "nova/api/base"
6
+ require "nova/api/list_response"
7
+ require "nova/api/response"
8
+
9
+ require "nova/api/resource/apportionment_value"
10
+ require "nova/api/resource/apportionment"
11
+ require "nova/api/resource/company"
12
+
13
+ require "nova/api/resource/current_asset"
14
+ require "nova/api/resource/bank"
15
+ require "nova/api/resource/card"
16
+ require "nova/api/resource/cash"
17
+
18
+ require "nova/api/resource/financial_account"
19
+ require "nova/api/resource/third_party"
20
+ require "nova/api/resource/write_off"
21
+
22
+ require "nova/api/resource/response/current_asset_statement"
23
+
24
+ require "nova/api/search_params/apportionment"
25
+ require "nova/api/search_params/current_asset"
26
+ require "nova/api/search_params/current_asset_statement"
27
+ require "nova/api/search_params/third_party"
28
+
29
+ module Nova
30
+ module API
31
+ class Error < StandardError; end
32
+ class MissingSubdomainError < Error; end
33
+ class MissingIdError < Error; end
34
+ class EndpointNotConfiguredError < Error; end
35
+
36
+ class << self
37
+ def configuration
38
+ @configuration ||= Configuration.new
39
+ end
40
+
41
+ def configure
42
+ yield(configuration)
43
+ end
44
+ end
45
+
46
+ class Client
47
+ def apportionments
48
+ Nova::API::Resource::Apportionment
49
+ end
50
+
51
+ def apportionment_values
52
+ Nova::API::Resource::ApportionmentValue
53
+ end
54
+
55
+ def banks
56
+ Nova::API::Resource::Bank
57
+ end
58
+
59
+ def cards
60
+ Nova::API::Resource::Card
61
+ end
62
+
63
+ def cashes
64
+ Nova::API::Resource::Cash
65
+ end
66
+
67
+ def companies
68
+ Nova::API::Resource::Company
69
+ end
70
+
71
+ def current_assets
72
+ Nova::API::Resource::CurrentAsset
73
+ end
74
+
75
+ def financial_accounts
76
+ Nova::API::Resource::FinancialAccount
77
+ end
78
+
79
+ def third_parties
80
+ Nova::API::Resource::ThirdParty
81
+ end
82
+ end
83
+ end
84
+ end