portal_1c 0.0.1
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/.gitignore +1 -0
- data/.rspec +4 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +85 -0
- data/README.md +117 -0
- data/lib/portal_1c/client.rb +14 -0
- data/lib/portal_1c/connection.rb +25 -0
- data/lib/portal_1c/request.rb +23 -0
- data/lib/portal_1c/rest.rb +117 -0
- data/lib/portal_1c.rb +9 -0
- data/rubocop.yml +14 -0
- metadata +53 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c6f549d2281ebd3b8c43aa30f58940f5bea83e0f3321758171b0db8095b2ec79
|
4
|
+
data.tar.gz: e519ceb5f329c4479fd35c3c51f3a1aa495ed891601d2332fae309ff3e403df4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0c28e424e6800314711a39073570681ad497b0da3b31b4b0cc6797ded73c863ff89e6bc126cb2d1f72f08f34de7e53e432e8e1fda94ba29fa5445da88ff88ae8
|
7
|
+
data.tar.gz: 7feeb75ebdef3d8c2cb33fd506601ea7feb608ab659b6f0ac21426a8f5e547d9b8bd0bd6a52ed60739c66df25d522970369b2743367c40094b89f29cdbf2d970
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.env
|
data/.rspec
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
gem 'faraday'
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'rspec', '~> 3.12'
|
8
|
+
gem 'vcr', '~> 6.1.0'
|
9
|
+
gem 'webmock', '~> 3.18.1'
|
10
|
+
end
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem 'dotenv', '~> 2.8.1'
|
14
|
+
gem 'rubocop', '~> 1.51.0'
|
15
|
+
gem 'rubocop-performance', '~> 1.0'
|
16
|
+
gem 'rubocop-rspec', '~> 2.0'
|
17
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.8.4)
|
5
|
+
public_suffix (>= 2.0.2, < 6.0)
|
6
|
+
ast (2.4.2)
|
7
|
+
crack (0.4.5)
|
8
|
+
rexml
|
9
|
+
diff-lcs (1.5.0)
|
10
|
+
dotenv (2.8.1)
|
11
|
+
faraday (2.7.10)
|
12
|
+
faraday-net_http (>= 2.0, < 3.1)
|
13
|
+
ruby2_keywords (>= 0.0.4)
|
14
|
+
faraday-net_http (3.0.2)
|
15
|
+
hashdiff (1.0.1)
|
16
|
+
json (2.6.3)
|
17
|
+
parallel (1.23.0)
|
18
|
+
parser (3.2.2.3)
|
19
|
+
ast (~> 2.4.1)
|
20
|
+
racc
|
21
|
+
public_suffix (5.0.3)
|
22
|
+
racc (1.7.1)
|
23
|
+
rainbow (3.1.1)
|
24
|
+
regexp_parser (2.8.1)
|
25
|
+
rexml (3.2.6)
|
26
|
+
rspec (3.12.0)
|
27
|
+
rspec-core (~> 3.12.0)
|
28
|
+
rspec-expectations (~> 3.12.0)
|
29
|
+
rspec-mocks (~> 3.12.0)
|
30
|
+
rspec-core (3.12.2)
|
31
|
+
rspec-support (~> 3.12.0)
|
32
|
+
rspec-expectations (3.12.3)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.12.0)
|
35
|
+
rspec-mocks (3.12.6)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.12.0)
|
38
|
+
rspec-support (3.12.1)
|
39
|
+
rubocop (1.51.0)
|
40
|
+
json (~> 2.3)
|
41
|
+
parallel (~> 1.10)
|
42
|
+
parser (>= 3.2.0.0)
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
44
|
+
regexp_parser (>= 1.8, < 3.0)
|
45
|
+
rexml (>= 3.2.5, < 4.0)
|
46
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
47
|
+
ruby-progressbar (~> 1.7)
|
48
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
49
|
+
rubocop-ast (1.29.0)
|
50
|
+
parser (>= 3.2.1.0)
|
51
|
+
rubocop-capybara (2.18.0)
|
52
|
+
rubocop (~> 1.41)
|
53
|
+
rubocop-factory_bot (2.23.1)
|
54
|
+
rubocop (~> 1.33)
|
55
|
+
rubocop-performance (1.18.0)
|
56
|
+
rubocop (>= 1.7.0, < 2.0)
|
57
|
+
rubocop-ast (>= 0.4.0)
|
58
|
+
rubocop-rspec (2.22.0)
|
59
|
+
rubocop (~> 1.33)
|
60
|
+
rubocop-capybara (~> 2.17)
|
61
|
+
rubocop-factory_bot (~> 2.22)
|
62
|
+
ruby-progressbar (1.13.0)
|
63
|
+
ruby2_keywords (0.0.5)
|
64
|
+
unicode-display_width (2.4.2)
|
65
|
+
vcr (6.1.0)
|
66
|
+
webmock (3.18.1)
|
67
|
+
addressable (>= 2.8.0)
|
68
|
+
crack (>= 0.3.2)
|
69
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
70
|
+
|
71
|
+
PLATFORMS
|
72
|
+
x64-mingw-ucrt
|
73
|
+
|
74
|
+
DEPENDENCIES
|
75
|
+
dotenv (~> 2.8.1)
|
76
|
+
faraday
|
77
|
+
rspec (~> 3.12)
|
78
|
+
rubocop (~> 1.51.0)
|
79
|
+
rubocop-performance (~> 1.0)
|
80
|
+
rubocop-rspec (~> 2.0)
|
81
|
+
vcr (~> 6.1.0)
|
82
|
+
webmock (~> 3.18.1)
|
83
|
+
|
84
|
+
BUNDLED WITH
|
85
|
+
2.4.10
|
data/README.md
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# Ruby [partner-api.1c.ru](https://partner-api.1c.ru/api/swagger-ui/index.html)
|
2
|
+
|
3
|
+
## Usage
|
4
|
+
|
5
|
+
* Get your login and password from https://portal.1c.ru/partner/faq
|
6
|
+
|
7
|
+
## Quitstart
|
8
|
+
|
9
|
+
```rb
|
10
|
+
require 'portal_1c'
|
11
|
+
|
12
|
+
portal1c = Portal1C::Client.new('login', 'password')
|
13
|
+
```
|
14
|
+
|
15
|
+
## Examples
|
16
|
+
|
17
|
+
### subscription-rest-controller
|
18
|
+
|
19
|
+
#### Check contract by regnum
|
20
|
+
|
21
|
+
```rb
|
22
|
+
regnums = [801895194, 202680616, 8029772]
|
23
|
+
result = porta1c.check_its_by_reg_num(regnums)
|
24
|
+
```
|
25
|
+
|
26
|
+
#### Check contract by subscriber code
|
27
|
+
|
28
|
+
```rb
|
29
|
+
codes = %w[CL-12382 CL-898382 CL-932992]
|
30
|
+
result = porta1c.check_its_by_subscriber_code(codes)
|
31
|
+
```
|
32
|
+
|
33
|
+
#### Check contract by login
|
34
|
+
|
35
|
+
```rb
|
36
|
+
logins = ['foobar@example.com', 'foo@example.com', 'bar@example.com']
|
37
|
+
result = porta1c.check_its_by_login(logins)
|
38
|
+
```
|
39
|
+
|
40
|
+
### subscriber-rest-controller
|
41
|
+
|
42
|
+
#### Get subscribers list
|
43
|
+
|
44
|
+
```rb
|
45
|
+
result = porta1c.subscriber(page: 0, size: 1)
|
46
|
+
```
|
47
|
+
|
48
|
+
### option-rest-controller
|
49
|
+
|
50
|
+
#### Billing report
|
51
|
+
|
52
|
+
```rb
|
53
|
+
codes = %w[CL-12382 CL-898382 CL-932992]
|
54
|
+
billing_report = porta1c.billing_report(type: 'CLOUD_BACKUP', subscriber_code_list: codes)
|
55
|
+
report_id = billing_report['reportUeid']
|
56
|
+
result = portal1c.get_billing_report(report_id)
|
57
|
+
```
|
58
|
+
|
59
|
+
### industry-rest-controller
|
60
|
+
|
61
|
+
#### Check industry by subscriber code
|
62
|
+
|
63
|
+
```rb
|
64
|
+
codes = %w[CL-12382 CL-898382 CL-932992]
|
65
|
+
result = portal1c.check_industry_by_subscriber_code(codes)
|
66
|
+
```
|
67
|
+
|
68
|
+
#### Check industry by regnum
|
69
|
+
|
70
|
+
```rb
|
71
|
+
regnums = [801895194, 202680616, 8029772]
|
72
|
+
result = portal1c.check_industry_by_reg_num(regnums)
|
73
|
+
```
|
74
|
+
|
75
|
+
#### Check industry by login
|
76
|
+
|
77
|
+
```rb
|
78
|
+
logins = ['foobar@example.com', 'foo@example.com', 'bar@example.com']
|
79
|
+
result = portal1c.check_industry_by_login(logins)
|
80
|
+
```
|
81
|
+
|
82
|
+
### program-version-rest-controller
|
83
|
+
|
84
|
+
#### Programs
|
85
|
+
|
86
|
+
```rb
|
87
|
+
result = portal1c.programs
|
88
|
+
```
|
89
|
+
|
90
|
+
#### Program versions
|
91
|
+
|
92
|
+
```rb
|
93
|
+
result = portal1c.program_versions(cursor: 0, nick: 'CRM')
|
94
|
+
```
|
95
|
+
|
96
|
+
### nomenclature-rest-controller
|
97
|
+
|
98
|
+
```rb
|
99
|
+
regnums = [801895194, 202680616, 8029772]
|
100
|
+
result = portal1c.get_nomencluture_by_reg_numbers(regnums)
|
101
|
+
```
|
102
|
+
|
103
|
+
### client-program-access-controller
|
104
|
+
|
105
|
+
#### Client program access by regnum
|
106
|
+
|
107
|
+
```rb
|
108
|
+
regnums = [801895194, 202680616, 8029772]
|
109
|
+
result = portal1c.client_program_access_by_reg_number(regnums)
|
110
|
+
```
|
111
|
+
|
112
|
+
#### Client program access by login
|
113
|
+
|
114
|
+
```rb
|
115
|
+
regnums = [801895194, 202680616, 8029772]
|
116
|
+
result = portal1c.client_program_access_by_login(login: 'login')
|
117
|
+
```
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Portal1C
|
4
|
+
module Connection
|
5
|
+
BASE_URL = 'https://partner-api.1c.ru/'
|
6
|
+
|
7
|
+
def connection(client)
|
8
|
+
Faraday.new(options) do |faraday|
|
9
|
+
faraday.request :authorization, :basic, client.login, client.password
|
10
|
+
faraday.adapter Faraday.default_adapter
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def options
|
17
|
+
{
|
18
|
+
headers: {
|
19
|
+
'content-type': 'application/json'
|
20
|
+
},
|
21
|
+
url: BASE_URL
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Portal1C
|
6
|
+
module Request
|
7
|
+
include Portal1C::Connection
|
8
|
+
|
9
|
+
def get(path, client, params = {})
|
10
|
+
respond_with(connection(client).get(path, params))
|
11
|
+
end
|
12
|
+
|
13
|
+
def post(path, client, params = {})
|
14
|
+
respond_with(connection(client).post(path, JSON.dump(params)))
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def respond_with(response)
|
20
|
+
JSON.parse(response.body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Portal1C
|
4
|
+
module Rest
|
5
|
+
include Portal1C::Request
|
6
|
+
|
7
|
+
def check_its_by_subscriber_code(subscriber_code_list)
|
8
|
+
post(
|
9
|
+
'api/rest/public/subscription/checkItsBySubscriberCode',
|
10
|
+
self,
|
11
|
+
{ subscriberCodeList: subscriber_code_list }
|
12
|
+
)
|
13
|
+
end
|
14
|
+
|
15
|
+
def check_its_by_reg_num(reg_number_list)
|
16
|
+
post(
|
17
|
+
'api/rest/public/subscription/checkItsByRegNum',
|
18
|
+
self,
|
19
|
+
{ regNumberList: reg_number_list }
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def check_its_by_login(login_list)
|
24
|
+
post(
|
25
|
+
'api/rest/public/subscription/checkItsByLogin',
|
26
|
+
self,
|
27
|
+
{ loginList: login_list }
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def subscriber(body)
|
32
|
+
post(
|
33
|
+
'api/rest/public/subscriber',
|
34
|
+
self,
|
35
|
+
body
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def billing_report(body)
|
40
|
+
post(
|
41
|
+
'api/rest/public/option/billing-report',
|
42
|
+
self,
|
43
|
+
body
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_billing_report(report_id)
|
48
|
+
get(
|
49
|
+
"api/rest/public/option/billing-report/#{report_id}",
|
50
|
+
self
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
def check_industry_by_subscriber_code(subscriber_code_list)
|
55
|
+
post(
|
56
|
+
'api/rest/public/industry/checkIndustryBySubscriberCode',
|
57
|
+
self,
|
58
|
+
{ subscriberCodeList: subscriber_code_list }
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
def check_industry_by_reg_num(reg_number_list)
|
63
|
+
post(
|
64
|
+
'api/rest/public/industry/checkByRegNum',
|
65
|
+
self,
|
66
|
+
{ regNumberList: reg_number_list }
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def check_industry_by_login(login_list)
|
71
|
+
post(
|
72
|
+
'api/rest/public/industry/checkByLogin',
|
73
|
+
self,
|
74
|
+
{ loginList: login_list }
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
def program_versions(cursor:, nick:)
|
79
|
+
post(
|
80
|
+
'api/program-versions',
|
81
|
+
self,
|
82
|
+
{ cursor: cursor, nick: nick }
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
def programs
|
87
|
+
get(
|
88
|
+
'api/programs',
|
89
|
+
self
|
90
|
+
)
|
91
|
+
end
|
92
|
+
|
93
|
+
def get_nomencluture_by_reg_numbers(reg_number_list)
|
94
|
+
post(
|
95
|
+
'api/nomenclature/getByRegNumbers',
|
96
|
+
self,
|
97
|
+
reg_number_list
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
def client_program_access_by_reg_number(reg_number:)
|
102
|
+
post(
|
103
|
+
'api/client-program-access/search/reg-number',
|
104
|
+
self,
|
105
|
+
{ regNumber: reg_number }
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
def client_program_access_by_login(login:)
|
110
|
+
post(
|
111
|
+
'api/client-program-access/search/login',
|
112
|
+
self,
|
113
|
+
{ login: login }
|
114
|
+
)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
data/lib/portal_1c.rb
ADDED
data/rubocop.yml
ADDED
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: portal_1c
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Anatoly Busygin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-11-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: anatolyb94@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- ".gitignore"
|
20
|
+
- ".rspec"
|
21
|
+
- Gemfile
|
22
|
+
- Gemfile.lock
|
23
|
+
- README.md
|
24
|
+
- lib/portal_1c.rb
|
25
|
+
- lib/portal_1c/client.rb
|
26
|
+
- lib/portal_1c/connection.rb
|
27
|
+
- lib/portal_1c/request.rb
|
28
|
+
- lib/portal_1c/rest.rb
|
29
|
+
- rubocop.yml
|
30
|
+
homepage: https://github.com/Suban05/partners-api-portal-1c-ruby
|
31
|
+
licenses:
|
32
|
+
- MIT
|
33
|
+
metadata: {}
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubygems_version: 3.4.10
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Portal 1C client
|
53
|
+
test_files: []
|