parasut-v4 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 +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.rubocop.yml +35 -0
- data/.travis.yml +22 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +94 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/her/middleware/o_auth_provider_header.rb +51 -0
- data/lib/her/middleware/parasut_parser.rb +25 -0
- data/lib/her/model/relation.rb +11 -0
- data/lib/parasut/account.rb +13 -0
- data/lib/parasut/contact.rb +12 -0
- data/lib/parasut/document_status.rb +8 -0
- data/lib/parasut/item_category.rb +10 -0
- data/lib/parasut/options.rb +35 -0
- data/lib/parasut/payment.rb +7 -0
- data/lib/parasut/product.rb +10 -0
- data/lib/parasut/sales_invoice.rb +18 -0
- data/lib/parasut/transaction.rb +9 -0
- data/lib/parasut/version.rb +3 -0
- data/lib/parasut.rb +68 -0
- data/parasut.gemspec +37 -0
- metadata +217 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: eba423886b4b0f9f6ac5dd414d2f4a3831d3bcfd
|
|
4
|
+
data.tar.gz: ae921f81679c2de2795a3203e7cf1e8906aeac8b
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 02ef970ed86352d59bfc7bedff251ace250d7709ad962b1371b2c0e9d64464dc06ecddb97f4a254e394fc68117b4e8a4dbcc8cfca658f896ed4f0f5cbb76937b
|
|
7
|
+
data.tar.gz: 02c1d1243c5963ae2cc6ad4a7f4581f882de22b2bde7c399242fd6c3307545e02a79201dc590e186c1dcf282568e2f277a61e2312e0aa41ae810c8b84751b1fc
|
data/.coveralls.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
service_name: travis-ci
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Documentation:
|
|
2
|
+
Enabled: true
|
|
3
|
+
AllCops:
|
|
4
|
+
Include:
|
|
5
|
+
- '**/Rakefile'
|
|
6
|
+
- '**/config.ru'
|
|
7
|
+
Exclude:
|
|
8
|
+
- 'db/**/*'
|
|
9
|
+
- 'tmp/**/*'
|
|
10
|
+
- 'vendor/**/*'
|
|
11
|
+
- 'bin/**/*'
|
|
12
|
+
- 'log/**/*'
|
|
13
|
+
Metrics/AbcSize:
|
|
14
|
+
Max: 15
|
|
15
|
+
Metrics/BlockNesting:
|
|
16
|
+
Max: 3
|
|
17
|
+
Metrics/ClassLength:
|
|
18
|
+
CountComments: false # count full line comments?
|
|
19
|
+
Max: 100
|
|
20
|
+
Metrics/CyclomaticComplexity:
|
|
21
|
+
Max: 6
|
|
22
|
+
Metrics/LineLength:
|
|
23
|
+
Max: 150
|
|
24
|
+
AllowURI: true
|
|
25
|
+
URISchemes:
|
|
26
|
+
- http
|
|
27
|
+
- https
|
|
28
|
+
Metrics/MethodLength:
|
|
29
|
+
CountComments: false # count full line comments?
|
|
30
|
+
Max: 13
|
|
31
|
+
Metrics/ParameterLists:
|
|
32
|
+
Max: 5
|
|
33
|
+
CountKeywordArgs: true
|
|
34
|
+
Metrics/PerceivedComplexity:
|
|
35
|
+
Max: 7
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
before_install:
|
|
3
|
+
- gem update --system
|
|
4
|
+
- gem update bundler
|
|
5
|
+
- gem cleanup bundler
|
|
6
|
+
cache: bundler
|
|
7
|
+
rvm:
|
|
8
|
+
- 2.2.4
|
|
9
|
+
- 2.3.0
|
|
10
|
+
- 2.3.1
|
|
11
|
+
branches:
|
|
12
|
+
only:
|
|
13
|
+
- master
|
|
14
|
+
install:
|
|
15
|
+
- "travis_retry bundle install --jobs 8"
|
|
16
|
+
deploy:
|
|
17
|
+
provider: rubygems
|
|
18
|
+
api_key:
|
|
19
|
+
secure: qiDjgFtSgcJEqh51KAtCfhneUw6SvVtrXGcu8GK88ldVR4nBvlblTJj5Z2G0t3izcy1F5/qSCrwrcIM8Dxf9+U4QqGvL68i0xU+lExzts8mGjehjHhm56sFMsvUQEMX44rOpQ3/ILPhrbOXgHGIn8qh2tg/NVhr9uemsuzF4TdUICEkn8GdXXBQA48TxS42kMDPk/5YXtq1FVjbQ3q7FpDnXkIs4hWRYzW2zgcCtrZL0JxKyPhrLLwTqv1P/yuirJY9SKiGcPgYer25h2m3mR2fcYNQQnJSvp7TZIOieZBQkkyGB0VmjriqXOv5qzygZKldDprIjVpwSg7/7MOs5zDICxnU2N375M7J/Sh/A3/Mv1h1y7QM8rRBKuPMWnqSuURgW5AiSvxOP0zttO4Ot3OtwOJnDMhcYxMUusCa4o65kCkJwbEw6ijLvO0xWds1YLFED5x7FCvRYE9+9siFMcMqH4mjjiJbKwf/ZTUx1EPVy3kiJUHh1e2ZKVecBdnt92Usi7TmQEyp897odhK8w+T7FlHmOp/0IQtdwZ9eMTP7g5tXSQl0JVxviRndO93k5OYdVYvbRzCJ5HCAYTgL+KRDZ7qyzGP/C3owF0/iffnCGPRWRC3Wldw6URskTuIQmyOspOOwdLXMbNzeqOOfG3jODyJb+kOH2tcKaIFwTejs=
|
|
20
|
+
gem: parasut
|
|
21
|
+
on:
|
|
22
|
+
repo: ahtung/parasut
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributor Code of Conduct
|
|
2
|
+
|
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
|
7
|
+
|
|
8
|
+
We are committed to making participation in this project a harassment-free
|
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
|
12
|
+
|
|
13
|
+
Examples of unacceptable behavior by participants include:
|
|
14
|
+
|
|
15
|
+
* The use of sexualized language or imagery
|
|
16
|
+
* Personal attacks
|
|
17
|
+
* Trolling or insulting/derogatory comments
|
|
18
|
+
* Public or private harassment
|
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
|
20
|
+
addresses, without explicit permission
|
|
21
|
+
* Other unethical or unprofessional conduct
|
|
22
|
+
|
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
27
|
+
threatening, offensive, or harmful.
|
|
28
|
+
|
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
|
32
|
+
Conduct may be permanently removed from the project team.
|
|
33
|
+
|
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
|
35
|
+
when an individual is representing the project or its community.
|
|
36
|
+
|
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
38
|
+
reported by contacting a project maintainer at hello@dijitalgaraj.com. All
|
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
42
|
+
incident.
|
|
43
|
+
|
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
45
|
+
version 1.3.0, available at
|
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
|
47
|
+
|
|
48
|
+
[homepage]: http://contributor-covenant.org
|
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Dijital Garaj
|
|
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,94 @@
|
|
|
1
|
+
# parasut-v4
|
|
2
|
+
|
|
3
|
+
Parasut API V4 integration.
|
|
4
|
+
You can sign up for an parasut account at https://www.parasut.com/
|
|
5
|
+
|
|
6
|
+
## Dependencies
|
|
7
|
+
|
|
8
|
+
- her
|
|
9
|
+
- kaminari 0.17.0
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
* Ruby 2.0.0 or newer
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Add this line to your application's Gemfile:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
gem 'parasut-v4'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
And then execute:
|
|
24
|
+
|
|
25
|
+
$ bundle
|
|
26
|
+
|
|
27
|
+
Or install it yourself as:
|
|
28
|
+
|
|
29
|
+
$ gem install parasut-v4
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
Create an initializer for Parasut options.
|
|
34
|
+
```
|
|
35
|
+
require 'parasut'
|
|
36
|
+
|
|
37
|
+
# config/initializers/parasut.rb
|
|
38
|
+
Parasut.options do |option|
|
|
39
|
+
option.api_base_url="https://url" # this is optional, default is "https://api.parasut.com/"
|
|
40
|
+
option.client_id = 'client_id'
|
|
41
|
+
option.client_secret = 'client_secret'
|
|
42
|
+
option.username = 'username'
|
|
43
|
+
option.password = 'password'
|
|
44
|
+
option.company_id = 'company_id'
|
|
45
|
+
end
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Afterwards you can call a model:
|
|
49
|
+
|
|
50
|
+
account = Parasut::Account.find(1)
|
|
51
|
+
puts account.inspect
|
|
52
|
+
|
|
53
|
+
contacts = Parasut::Contact.all
|
|
54
|
+
puts contacts.inspect
|
|
55
|
+
|
|
56
|
+
account.destroy
|
|
57
|
+
|
|
58
|
+
To paginate collections:
|
|
59
|
+
|
|
60
|
+
contacts=Parasut::Contact.all
|
|
61
|
+
contacts.page(2).per(25)
|
|
62
|
+
# Pagination uses kaminari. (https://github.com/kaminari/kaminari)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## ENVs
|
|
66
|
+
|
|
67
|
+
- PARASUT_API_BASE_URL
|
|
68
|
+
- PARASUT_CLIENT_ID
|
|
69
|
+
- PARASUT_CLIENT_SECRET
|
|
70
|
+
- PARASUT_USERNAME
|
|
71
|
+
- PARASUT_PASSWORD
|
|
72
|
+
- PARASUT_COMPANY_ID
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
77
|
+
|
|
78
|
+
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).
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dijitalgaraj/parasut-v4. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
84
|
+
|
|
85
|
+
## Contributors
|
|
86
|
+
|
|
87
|
+
This gem uses @ahtung 's Parasut API v1 gem as its base. (https://github.com/ahtung/parasut)
|
|
88
|
+
|
|
89
|
+
API Version 4 compability implemented by @dijitalgaraj - @feapaydin
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "parasut"
|
|
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
|
data/bin/setup
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
module Her
|
|
2
|
+
module Middleware
|
|
3
|
+
# OAuthProviderHeader
|
|
4
|
+
class OAuthProviderHeader < Faraday::Middleware
|
|
5
|
+
def add_header(headers)
|
|
6
|
+
headers.merge! Authorization: "Bearer #{refresh_token['access_token']}"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def refresh_token
|
|
10
|
+
uri = URI("#{token_url}?#{URI.encode_www_form(refresh_token_params)}")
|
|
11
|
+
res = Net::HTTP.post_form(uri, {})
|
|
12
|
+
JSON.parse(res.body)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def refresh_token_params
|
|
16
|
+
{
|
|
17
|
+
client_id: Parasut.options.client_id,
|
|
18
|
+
client_secret: Parasut.options.client_secret,
|
|
19
|
+
grant_type: 'refresh_token',
|
|
20
|
+
refresh_token: password['refresh_token']
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def password_params
|
|
25
|
+
{
|
|
26
|
+
client_id: Parasut.options.client_id,
|
|
27
|
+
client_secret: Parasut.options.client_secret,
|
|
28
|
+
username: Parasut.options.username,
|
|
29
|
+
password: Parasut.options.password,
|
|
30
|
+
grant_type: 'password',
|
|
31
|
+
redirect_uri: 'urn:ietf:wg:oauth:2.0:oob'
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def token_url
|
|
36
|
+
"#{Parasut.options.api_base_url}/oauth/token"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def password
|
|
40
|
+
uri = URI("#{token_url}?#{URI.encode_www_form(password_params)}")
|
|
41
|
+
res = Net::HTTP.post_form(uri, {})
|
|
42
|
+
JSON.parse(res.body)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def call(env)
|
|
46
|
+
add_header(env[:request_headers])
|
|
47
|
+
@app.call(env)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Her
|
|
2
|
+
module Middleware
|
|
3
|
+
# ParasutParser
|
|
4
|
+
|
|
5
|
+
# DEPRECATED:
|
|
6
|
+
# API Version 4 uses JsonAPI 1.0 Standarts.
|
|
7
|
+
# 'Her' has its own JsonApiParser
|
|
8
|
+
# No need for an additional parse class.
|
|
9
|
+
|
|
10
|
+
# class ParasutParser < Her::Middleware::DefaultParseJSON
|
|
11
|
+
# def parse(body)
|
|
12
|
+
# json = parse_json(body)
|
|
13
|
+
# data = json
|
|
14
|
+
|
|
15
|
+
# data=data[:data]
|
|
16
|
+
|
|
17
|
+
# {
|
|
18
|
+
# data: data || {},
|
|
19
|
+
# errors: json[:errors] || [],
|
|
20
|
+
# metadata: json[:meta] || {}
|
|
21
|
+
# }
|
|
22
|
+
# end
|
|
23
|
+
# end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'singleton'
|
|
2
|
+
|
|
3
|
+
# lib/parasut/options.rb
|
|
4
|
+
module Parasut
|
|
5
|
+
# Options
|
|
6
|
+
class Options
|
|
7
|
+
include Singleton
|
|
8
|
+
|
|
9
|
+
ATTRIBUTES = [:api_base_url, :client_id, :client_secret, :username, :password, :company_id].freeze
|
|
10
|
+
|
|
11
|
+
# Attributes
|
|
12
|
+
attr_accessor *ATTRIBUTES
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
# Initializer
|
|
17
|
+
def self.options
|
|
18
|
+
|
|
19
|
+
instance=Options.instance
|
|
20
|
+
|
|
21
|
+
if block_given?
|
|
22
|
+
yield instance
|
|
23
|
+
|
|
24
|
+
# Execute her setup
|
|
25
|
+
Parasut.her_setup
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Try to set the defaults when needed
|
|
29
|
+
instance.api_base_url = ENV['PARASUT_API_BASE_URL'] || Parasut.default_api_url if instance.api_base_url.nil?
|
|
30
|
+
instance.company_id = ENV['PARASUT_COMPANY_ID'] if instance.company_id.nil?
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
instance
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# lib/parasut/sales_invoice.rb
|
|
2
|
+
module Parasut
|
|
3
|
+
# SalesInvoice
|
|
4
|
+
class SalesInvoice
|
|
5
|
+
include Her::JsonApi::Model
|
|
6
|
+
#
|
|
7
|
+
include_root_in_json true
|
|
8
|
+
parse_root_in_json true
|
|
9
|
+
|
|
10
|
+
has_one :e_document_status, class_name: 'DocumentStatus'
|
|
11
|
+
|
|
12
|
+
def e_document_type
|
|
13
|
+
self.class.get_raw("sales_invoices/#{id}/e_document_type") do |parsed_data, response|
|
|
14
|
+
parsed_data[:data][:e_document_type]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/parasut.rb
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
require 'her'
|
|
2
|
+
require 'json'
|
|
3
|
+
require 'uri'
|
|
4
|
+
require 'kaminari/config'
|
|
5
|
+
require 'kaminari/helpers/action_view_extension'
|
|
6
|
+
# Note: Decent kaminari versions does not contain 'kaminari/helpers/action_view_extension' file.
|
|
7
|
+
# Kaminari version has to be locked to a valid one. (0.17.0 is a valid)
|
|
8
|
+
|
|
9
|
+
require 'kaminari/helpers/paginator'
|
|
10
|
+
require 'kaminari/models/page_scope_methods'
|
|
11
|
+
require 'kaminari/models/configuration_methods'
|
|
12
|
+
require 'kaminari/hooks'
|
|
13
|
+
|
|
14
|
+
Kaminari::Hooks.init
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# We will use parasut options to setup "her"
|
|
18
|
+
# So it has to be initially available
|
|
19
|
+
require_relative 'parasut/options'
|
|
20
|
+
|
|
21
|
+
require_relative 'her/middleware/o_auth_provider_header'
|
|
22
|
+
require_relative 'her/model/relation'
|
|
23
|
+
|
|
24
|
+
# Models that are including Her::JsonApi::Model has to be required after Her initialization
|
|
25
|
+
def require_parasut
|
|
26
|
+
require_relative 'parasut/version'
|
|
27
|
+
require_relative 'parasut/product'
|
|
28
|
+
require_relative 'parasut/document_status'
|
|
29
|
+
require_relative 'parasut/contact'
|
|
30
|
+
require_relative 'parasut/item_category'
|
|
31
|
+
require_relative 'parasut/account'
|
|
32
|
+
require_relative 'parasut/sales_invoice'
|
|
33
|
+
require_relative 'parasut/transaction'
|
|
34
|
+
require_relative 'parasut/payment'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# lib/parasut.rb
|
|
40
|
+
module Parasut
|
|
41
|
+
|
|
42
|
+
# Parasut.options.api_base_url will override this.
|
|
43
|
+
def self.default_api_url
|
|
44
|
+
"https://api.parasut.com/"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def self.her_setup
|
|
49
|
+
|
|
50
|
+
# Make the her setup when necessary, using options
|
|
51
|
+
Her::API.setup url: "#{Parasut.options.api_base_url}/v4/#{Parasut.options.company_id}" do |config|
|
|
52
|
+
# config.use Her::Middleware::ParasutParser
|
|
53
|
+
config.use Her::Middleware::JsonApiParser
|
|
54
|
+
config.use Faraday::Request::UrlEncoded
|
|
55
|
+
config.use Her::Middleware::OAuthProviderHeader
|
|
56
|
+
config.use Faraday::Adapter::NetHttp
|
|
57
|
+
# config.use Faraday::Response::Logger, ActiveSupport::Logger.new(STDOUT)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Call parasut models
|
|
61
|
+
require_parasut
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
# end her_setup
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
|
data/parasut.gemspec
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'parasut/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'parasut-v4'
|
|
8
|
+
spec.version = Parasut::VERSION
|
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
|
10
|
+
spec.required_ruby_version = '>= 2.0.0'
|
|
11
|
+
spec.authors = ['Dijital Garaj','Furkan Enes Apaydın','Dunya Kirkali', 'Onur Kucukkecce']
|
|
12
|
+
spec.email = ['hello@dijitalgaraj.com','feapaydin@gmail.com','dunyakirkali@ahtung.co', 'onurkucukkece@ahtung.co']
|
|
13
|
+
|
|
14
|
+
spec.summary = %q{Parasut client.}
|
|
15
|
+
spec.description = %q{Parasut client.}
|
|
16
|
+
spec.homepage = 'https://github.com/dijitalgaraj/parasut-v4'
|
|
17
|
+
spec.license = 'MIT'
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
|
+
spec.bindir = 'exe'
|
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
|
+
spec.require_paths = ['lib']
|
|
25
|
+
|
|
26
|
+
spec.required_ruby_version = '>= 2.0.0'
|
|
27
|
+
spec.add_development_dependency 'bundler', '>= 1.13.0'
|
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
30
|
+
spec.add_development_dependency 'rubocop', '~> 0.49.0'
|
|
31
|
+
spec.add_development_dependency 'coveralls'
|
|
32
|
+
spec.add_development_dependency 'pry'
|
|
33
|
+
spec.add_development_dependency 'webmock'
|
|
34
|
+
spec.add_runtime_dependency 'oauth2'
|
|
35
|
+
spec.add_runtime_dependency 'her'
|
|
36
|
+
spec.add_runtime_dependency 'kaminari', '0.17.0'
|
|
37
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: parasut-v4
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Dijital Garaj
|
|
8
|
+
- Furkan Enes Apaydın
|
|
9
|
+
- Dunya Kirkali
|
|
10
|
+
- Onur Kucukkecce
|
|
11
|
+
autorequire:
|
|
12
|
+
bindir: exe
|
|
13
|
+
cert_chain: []
|
|
14
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
|
15
|
+
dependencies:
|
|
16
|
+
- !ruby/object:Gem::Dependency
|
|
17
|
+
name: bundler
|
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
|
19
|
+
requirements:
|
|
20
|
+
- - ">="
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 1.13.0
|
|
23
|
+
type: :development
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: 1.13.0
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: rake
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
- - "~>"
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '10.0'
|
|
37
|
+
type: :development
|
|
38
|
+
prerelease: false
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - "~>"
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '10.0'
|
|
44
|
+
- !ruby/object:Gem::Dependency
|
|
45
|
+
name: rspec
|
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - "~>"
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: '3.0'
|
|
51
|
+
type: :development
|
|
52
|
+
prerelease: false
|
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
54
|
+
requirements:
|
|
55
|
+
- - "~>"
|
|
56
|
+
- !ruby/object:Gem::Version
|
|
57
|
+
version: '3.0'
|
|
58
|
+
- !ruby/object:Gem::Dependency
|
|
59
|
+
name: rubocop
|
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
|
61
|
+
requirements:
|
|
62
|
+
- - "~>"
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: 0.49.0
|
|
65
|
+
type: :development
|
|
66
|
+
prerelease: false
|
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - "~>"
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: 0.49.0
|
|
72
|
+
- !ruby/object:Gem::Dependency
|
|
73
|
+
name: coveralls
|
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
|
75
|
+
requirements:
|
|
76
|
+
- - ">="
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
version: '0'
|
|
79
|
+
type: :development
|
|
80
|
+
prerelease: false
|
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
82
|
+
requirements:
|
|
83
|
+
- - ">="
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '0'
|
|
86
|
+
- !ruby/object:Gem::Dependency
|
|
87
|
+
name: pry
|
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
|
89
|
+
requirements:
|
|
90
|
+
- - ">="
|
|
91
|
+
- !ruby/object:Gem::Version
|
|
92
|
+
version: '0'
|
|
93
|
+
type: :development
|
|
94
|
+
prerelease: false
|
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
- - ">="
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: '0'
|
|
100
|
+
- !ruby/object:Gem::Dependency
|
|
101
|
+
name: webmock
|
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0'
|
|
107
|
+
type: :development
|
|
108
|
+
prerelease: false
|
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
110
|
+
requirements:
|
|
111
|
+
- - ">="
|
|
112
|
+
- !ruby/object:Gem::Version
|
|
113
|
+
version: '0'
|
|
114
|
+
- !ruby/object:Gem::Dependency
|
|
115
|
+
name: oauth2
|
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
|
117
|
+
requirements:
|
|
118
|
+
- - ">="
|
|
119
|
+
- !ruby/object:Gem::Version
|
|
120
|
+
version: '0'
|
|
121
|
+
type: :runtime
|
|
122
|
+
prerelease: false
|
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
124
|
+
requirements:
|
|
125
|
+
- - ">="
|
|
126
|
+
- !ruby/object:Gem::Version
|
|
127
|
+
version: '0'
|
|
128
|
+
- !ruby/object:Gem::Dependency
|
|
129
|
+
name: her
|
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
|
131
|
+
requirements:
|
|
132
|
+
- - ">="
|
|
133
|
+
- !ruby/object:Gem::Version
|
|
134
|
+
version: '0'
|
|
135
|
+
type: :runtime
|
|
136
|
+
prerelease: false
|
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
138
|
+
requirements:
|
|
139
|
+
- - ">="
|
|
140
|
+
- !ruby/object:Gem::Version
|
|
141
|
+
version: '0'
|
|
142
|
+
- !ruby/object:Gem::Dependency
|
|
143
|
+
name: kaminari
|
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
|
145
|
+
requirements:
|
|
146
|
+
- - '='
|
|
147
|
+
- !ruby/object:Gem::Version
|
|
148
|
+
version: 0.17.0
|
|
149
|
+
type: :runtime
|
|
150
|
+
prerelease: false
|
|
151
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
152
|
+
requirements:
|
|
153
|
+
- - '='
|
|
154
|
+
- !ruby/object:Gem::Version
|
|
155
|
+
version: 0.17.0
|
|
156
|
+
description: Parasut client.
|
|
157
|
+
email:
|
|
158
|
+
- hello@dijitalgaraj.com
|
|
159
|
+
- feapaydin@gmail.com
|
|
160
|
+
- dunyakirkali@ahtung.co
|
|
161
|
+
- onurkucukkece@ahtung.co
|
|
162
|
+
executables: []
|
|
163
|
+
extensions: []
|
|
164
|
+
extra_rdoc_files: []
|
|
165
|
+
files:
|
|
166
|
+
- ".coveralls.yml"
|
|
167
|
+
- ".gitignore"
|
|
168
|
+
- ".rspec"
|
|
169
|
+
- ".rubocop.yml"
|
|
170
|
+
- ".travis.yml"
|
|
171
|
+
- CODE_OF_CONDUCT.md
|
|
172
|
+
- Gemfile
|
|
173
|
+
- LICENSE.txt
|
|
174
|
+
- README.md
|
|
175
|
+
- Rakefile
|
|
176
|
+
- bin/console
|
|
177
|
+
- bin/setup
|
|
178
|
+
- lib/her/middleware/o_auth_provider_header.rb
|
|
179
|
+
- lib/her/middleware/parasut_parser.rb
|
|
180
|
+
- lib/her/model/relation.rb
|
|
181
|
+
- lib/parasut.rb
|
|
182
|
+
- lib/parasut/account.rb
|
|
183
|
+
- lib/parasut/contact.rb
|
|
184
|
+
- lib/parasut/document_status.rb
|
|
185
|
+
- lib/parasut/item_category.rb
|
|
186
|
+
- lib/parasut/options.rb
|
|
187
|
+
- lib/parasut/payment.rb
|
|
188
|
+
- lib/parasut/product.rb
|
|
189
|
+
- lib/parasut/sales_invoice.rb
|
|
190
|
+
- lib/parasut/transaction.rb
|
|
191
|
+
- lib/parasut/version.rb
|
|
192
|
+
- parasut.gemspec
|
|
193
|
+
homepage: https://github.com/dijitalgaraj/parasut-v4
|
|
194
|
+
licenses:
|
|
195
|
+
- MIT
|
|
196
|
+
metadata: {}
|
|
197
|
+
post_install_message:
|
|
198
|
+
rdoc_options: []
|
|
199
|
+
require_paths:
|
|
200
|
+
- lib
|
|
201
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
202
|
+
requirements:
|
|
203
|
+
- - ">="
|
|
204
|
+
- !ruby/object:Gem::Version
|
|
205
|
+
version: 2.0.0
|
|
206
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
|
+
requirements:
|
|
208
|
+
- - ">="
|
|
209
|
+
- !ruby/object:Gem::Version
|
|
210
|
+
version: '0'
|
|
211
|
+
requirements: []
|
|
212
|
+
rubyforge_project:
|
|
213
|
+
rubygems_version: 2.6.14.4
|
|
214
|
+
signing_key:
|
|
215
|
+
specification_version: 4
|
|
216
|
+
summary: Parasut client.
|
|
217
|
+
test_files: []
|