1c-connect-api-ruby 0.0.1

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: '0915e21537f0dacafdde45e926a8b6f20c0d8ece62b557141161a474b3ce43ef'
4
+ data.tar.gz: b5957ac9238cffa629240877b828af9cdf0ba961f5683b2b5b6cb23b91bd2809
5
+ SHA512:
6
+ metadata.gz: 433bc378ec6c7fa2147050023af815157e29d9ab937a408da2ad3b8eb95d4a934d3a67e472bc2765a179fc9ed427ef7addb7b74d83ecdfc83b251c90293fce4e
7
+ data.tar.gz: 797e400fe40072d8a8c882e3c4dfbd68316b8383626c63b9c17238237063e1faec00974c48e772ba56efe1fdac1b71d51cff596c8712624bf4b5f2940187a46f
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: CI
9
+
10
+ on:
11
+ push:
12
+ branches: [ "main" ]
13
+ pull_request:
14
+ branches: [ "main" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: [ '3.2.2' ]
26
+ env:
27
+ CONNECT_LOGIN: "login"
28
+ CONNECT_PASSWORD: "password"
29
+
30
+ steps:
31
+ - uses: actions/checkout@v3
32
+ - name: Set up Ruby
33
+ uses: ruby/setup-ruby@v1
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true
37
+ - name: Run tests
38
+ run: bundle exec rspec
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .env
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --warnings
data/.rubocop.yaml ADDED
@@ -0,0 +1,29 @@
1
+ ---
2
+ require:
3
+ - rubocop-rake
4
+ - rubocop-rspec
5
+ - rubocop-performance
6
+
7
+ AllCops:
8
+ NewCops: enable
9
+ TargetRubyVersion: 3.3
10
+
11
+ Style/Documentation:
12
+ Enabled: false
13
+
14
+ Metrics/BlockLength:
15
+ AllowedMethods:
16
+ - context
17
+ - describe
18
+ - task
19
+ Metrics/MethodLength:
20
+ Exclude:
21
+ - spec/**/*
22
+
23
+ Layout/LineLength:
24
+ Max: 120
25
+
26
+ RSpec/MultipleMemoizedHelpers:
27
+ Enabled: false
28
+ RSpec/NestedGroups:
29
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'faraday'
6
+ gem 'savon', '~> 2.13.0'
7
+ gem 'rake', '~> 13.0'
8
+ group :test do
9
+ gem 'rspec', '~> 3.4'
10
+ gem 'vcr', '~> 6.0'
11
+ gem 'webmock', '~> 3.18.1'
12
+ end
13
+
14
+ group :development do
15
+ gem 'dotenv', '~> 2.8'
16
+ gem 'rubocop', '~> 1.54.1'
17
+ gem 'rubocop-performance', '~> 1.18'
18
+ gem 'rubocop-rake', '~> 0.6.0'
19
+ gem 'rubocop-rspec', '~> 2.22.0'
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,148 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ addressable (2.8.6)
5
+ public_suffix (>= 2.0.2, < 6.0)
6
+ akami (1.3.3)
7
+ base64
8
+ gyoku (>= 0.4.0)
9
+ nokogiri
10
+ ast (2.4.2)
11
+ base64 (0.2.0)
12
+ bigdecimal (3.1.6)
13
+ builder (3.2.4)
14
+ crack (1.0.0)
15
+ bigdecimal
16
+ rexml
17
+ date (3.3.4)
18
+ diff-lcs (1.5.1)
19
+ dotenv (2.8.1)
20
+ faraday (2.7.11)
21
+ base64
22
+ faraday-net_http (>= 2.0, < 3.1)
23
+ ruby2_keywords (>= 0.0.4)
24
+ faraday-net_http (3.0.2)
25
+ gyoku (1.4.0)
26
+ builder (>= 2.1.2)
27
+ rexml (~> 3.0)
28
+ hashdiff (1.1.0)
29
+ httpi (3.0.2)
30
+ base64
31
+ mutex_m
32
+ nkf
33
+ rack (< 3)
34
+ json (2.7.1)
35
+ language_server-protocol (3.17.0.3)
36
+ mail (2.8.1)
37
+ mini_mime (>= 0.1.1)
38
+ net-imap
39
+ net-pop
40
+ net-smtp
41
+ mini_mime (1.1.5)
42
+ mutex_m (0.2.0)
43
+ net-imap (0.4.10)
44
+ date
45
+ net-protocol
46
+ net-pop (0.1.2)
47
+ net-protocol
48
+ net-protocol (0.2.2)
49
+ timeout
50
+ net-smtp (0.4.0.1)
51
+ net-protocol
52
+ nkf (0.2.0)
53
+ nokogiri (1.16.2-x64-mingw-ucrt)
54
+ racc (~> 1.4)
55
+ nori (2.7.0)
56
+ bigdecimal
57
+ parallel (1.24.0)
58
+ parser (3.3.0.5)
59
+ ast (~> 2.4.1)
60
+ racc
61
+ public_suffix (5.0.4)
62
+ racc (1.7.3)
63
+ rack (2.2.8.1)
64
+ rainbow (3.1.1)
65
+ rake (13.1.0)
66
+ regexp_parser (2.9.0)
67
+ rexml (3.2.6)
68
+ rspec (3.13.0)
69
+ rspec-core (~> 3.13.0)
70
+ rspec-expectations (~> 3.13.0)
71
+ rspec-mocks (~> 3.13.0)
72
+ rspec-core (3.13.0)
73
+ rspec-support (~> 3.13.0)
74
+ rspec-expectations (3.13.0)
75
+ diff-lcs (>= 1.2.0, < 2.0)
76
+ rspec-support (~> 3.13.0)
77
+ rspec-mocks (3.13.0)
78
+ diff-lcs (>= 1.2.0, < 2.0)
79
+ rspec-support (~> 3.13.0)
80
+ rspec-support (3.13.0)
81
+ rubocop (1.54.2)
82
+ json (~> 2.3)
83
+ language_server-protocol (>= 3.17.0)
84
+ parallel (~> 1.10)
85
+ parser (>= 3.2.2.3)
86
+ rainbow (>= 2.2.2, < 4.0)
87
+ regexp_parser (>= 1.8, < 3.0)
88
+ rexml (>= 3.2.5, < 4.0)
89
+ rubocop-ast (>= 1.28.0, < 2.0)
90
+ ruby-progressbar (~> 1.7)
91
+ unicode-display_width (>= 2.4.0, < 3.0)
92
+ rubocop-ast (1.30.0)
93
+ parser (>= 3.2.1.0)
94
+ rubocop-capybara (2.20.0)
95
+ rubocop (~> 1.41)
96
+ rubocop-factory_bot (2.25.1)
97
+ rubocop (~> 1.41)
98
+ rubocop-performance (1.20.2)
99
+ rubocop (>= 1.48.1, < 2.0)
100
+ rubocop-ast (>= 1.30.0, < 2.0)
101
+ rubocop-rake (0.6.0)
102
+ rubocop (~> 1.0)
103
+ rubocop-rspec (2.22.0)
104
+ rubocop (~> 1.33)
105
+ rubocop-capybara (~> 2.17)
106
+ rubocop-factory_bot (~> 2.22)
107
+ ruby-progressbar (1.13.0)
108
+ ruby2_keywords (0.0.5)
109
+ savon (2.13.1)
110
+ akami (~> 1.2)
111
+ builder (>= 2.1.2)
112
+ gyoku (~> 1.2)
113
+ httpi (>= 2.4.5)
114
+ mail (~> 2.5)
115
+ nokogiri (>= 1.8.1)
116
+ nori (~> 2.4)
117
+ wasabi (~> 3.4)
118
+ timeout (0.4.1)
119
+ unicode-display_width (2.5.0)
120
+ vcr (6.2.0)
121
+ wasabi (3.8.0)
122
+ addressable
123
+ httpi (~> 3.0)
124
+ nokogiri (>= 1.4.2)
125
+ webmock (3.18.1)
126
+ addressable (>= 2.8.0)
127
+ crack (>= 0.3.2)
128
+ hashdiff (>= 0.4.0, < 2.0.0)
129
+
130
+ PLATFORMS
131
+ x64-mingw-ucrt
132
+ x86_64-linux
133
+
134
+ DEPENDENCIES
135
+ dotenv (~> 2.8)
136
+ faraday
137
+ rake (~> 13.0)
138
+ rspec (~> 3.4)
139
+ rubocop (~> 1.54.1)
140
+ rubocop-performance (~> 1.18)
141
+ rubocop-rake (~> 0.6.0)
142
+ rubocop-rspec (~> 2.22.0)
143
+ savon (~> 2.13.0)
144
+ vcr (~> 6.0)
145
+ webmock (~> 3.18.1)
146
+
147
+ BUNDLED WITH
148
+ 2.5.6
@@ -0,0 +1,71 @@
1
+ module Connect
2
+ module HTTPService
3
+ module BotApi
4
+ include Connect::HTTPService::Request
5
+
6
+ def appoint_start(options)
7
+ post(
8
+ 'v1/line/appoint/start',
9
+ self,
10
+ options
11
+ )
12
+ end
13
+
14
+ def appoint_spec(options)
15
+ post(
16
+ 'v1/line/appoint/spec',
17
+ self,
18
+ options
19
+ )
20
+ end
21
+
22
+ def drop_treatment(options)
23
+ post(
24
+ 'v1/line/drop/treatment',
25
+ self,
26
+ options
27
+ )
28
+ end
29
+
30
+ def send_message_line(options)
31
+ post(
32
+ 'v1/line/send/message',
33
+ self,
34
+ options
35
+ )
36
+ end
37
+
38
+ def send_message_line(options)
39
+ post(
40
+ 'v1/line/send/message',
41
+ self,
42
+ options
43
+ )
44
+ end
45
+
46
+ def drop_keyboard(options)
47
+ post(
48
+ 'v1/line/drop/keyboard',
49
+ self,
50
+ options
51
+ )
52
+ end
53
+
54
+ def send_message_colleague(options)
55
+ post(
56
+ 'v1/colleague/send/message',
57
+ self,
58
+ options
59
+ )
60
+ end
61
+
62
+ def send_message_conference(options)
63
+ post(
64
+ 'v1/conference/send/message',
65
+ self,
66
+ options
67
+ )
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,14 @@
1
+ module Connect
2
+ module HTTPService
3
+ class Client
4
+ include Connect::HTTPService::Rest
5
+
6
+ attr_reader :login, :password
7
+
8
+ def initialize(options)
9
+ @login = options[:login]
10
+ @password = options[:password]
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module HTTPService
5
+ module Connection
6
+ BASE_URL = 'https://push.1c-connect.com/'
7
+
8
+ def connection(client)
9
+ Faraday.new(options) do |faraday|
10
+ faraday.request :authorization, :basic, client.login, client.password
11
+ faraday.adapter Faraday.default_adapter
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def options
18
+ {
19
+ headers: {
20
+ 'content-type': 'application/json'
21
+ },
22
+ url: BASE_URL
23
+ }
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,88 @@
1
+ module Connect
2
+ module HTTPService
3
+ module InformationApi
4
+ include Connect::HTTPService::Request
5
+
6
+ def get_treatments(options = {})
7
+ get(
8
+ 'v1/line/treatment/',
9
+ self,
10
+ options
11
+ )
12
+ end
13
+
14
+ def get_subscriber(options)
15
+ get(
16
+ "v1/line/subscriber/#{options[:user_id]}",
17
+ self
18
+ )
19
+ end
20
+
21
+ def get_subscribers
22
+ get(
23
+ 'v1/line/subscribers',
24
+ self
25
+ )
26
+ end
27
+
28
+ def get_subscriptions(options)
29
+ get(
30
+ 'v1/line/subscriptions',
31
+ self,
32
+ options
33
+ )
34
+ end
35
+
36
+ def get_lines
37
+ get(
38
+ 'v1/line',
39
+ self
40
+ )
41
+ end
42
+
43
+ def get_specialist(options)
44
+ get(
45
+ "v1/line/specialist/#{options[:user_id]}",
46
+ self
47
+ )
48
+ end
49
+
50
+ def get_specialists
51
+ get(
52
+ 'v1/line/specialists',
53
+ self
54
+ )
55
+ end
56
+
57
+ def get_specialists_available(options)
58
+ get(
59
+ "v1/line/specialists/#{options[:line_id]}/available",
60
+ self,
61
+ options
62
+ )
63
+ end
64
+
65
+ def get_competences(options = {})
66
+ get(
67
+ "v1/line/competences",
68
+ self,
69
+ options
70
+ )
71
+ end
72
+
73
+ def get_ticket(options)
74
+ get(
75
+ "v1/ticket/#{options[:id]}",
76
+ self
77
+ )
78
+ end
79
+
80
+ def get_ticket_by_number(options)
81
+ get(
82
+ "v1/ticket/number/#{options[:number]}",
83
+ self
84
+ )
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ module Connect
6
+ module HTTPService
7
+ module Request
8
+ include Connect::HTTPService::Connection
9
+
10
+ def get(path, client, params = {})
11
+ respond_with(connection(client).get(path, params))
12
+ end
13
+
14
+ def post(path, client, params = {}, files = {})
15
+ respond_with(connection(client).post(path, JSON.dump(params)))
16
+ end
17
+
18
+ private
19
+
20
+ def respond_with(response)
21
+ begin
22
+ JSON.parse(response.body)
23
+ rescue
24
+ {}
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module HTTPService
5
+ module Rest
6
+ include Connect::HTTPService::InformationApi
7
+ include Connect::HTTPService::BotApi
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'faraday'
2
+ require_relative 'http_service/connection'
3
+ require_relative 'http_service/request'
4
+ require_relative 'http_service/information_api'
5
+ require_relative 'http_service/bot_api'
6
+ require_relative 'http_service/rest'
7
+ require_relative 'http_service/client'
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ class Client
6
+ include Connect::WebService::Connection
7
+ include Connect::WebService::Rest
8
+
9
+ attr_reader :login, :password, :connection
10
+
11
+ def initialize(options)
12
+ @login = options[:login]
13
+ @password = options[:password]
14
+ @connection = create_connection(self)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ module ConnectParameters
6
+ class ConnectParameter
7
+ attr_accessor :property, :value, :required
8
+
9
+ def initialize(property, value, required = false)
10
+ @property = property
11
+ @value = value
12
+ @required = required
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ module ConnectParameters
6
+ class ConnectProperty
7
+ attr_accessor :xmlns, :name
8
+
9
+ def initialize(name)
10
+ @xmlns = 'http://v8.1c.ru/8.1/data/core'
11
+ @name = name
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ module ConnectParameters
6
+ class ConnectValue
7
+ attr_accessor :type, :content
8
+
9
+ def initialize(type, content)
10
+ @type = type
11
+ @content = content
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ module ConnectParameters
6
+ module ParamsFactory
7
+ def create_parameter(options)
8
+ property = ConnectProperty.new(options[:name])
9
+ value = ConnectValue.new(options[:type], options[:content])
10
+ ConnectParameter.new(property, value)
11
+ end
12
+
13
+ def create_changed_from(options)
14
+ date = options[:changed_from]
15
+ content = nil
16
+ if date
17
+ content = date.strftime('%Y-%m-%dT%H:%M:%S')
18
+ end
19
+ create_date_time(
20
+ name: 'ChangedFrom',
21
+ content: content
22
+ )
23
+ end
24
+
25
+ def create_date_time(options)
26
+ create_parameter(
27
+ name: options[:name],
28
+ type: 'xs:dateTime',
29
+ content: options[:content]
30
+ )
31
+ end
32
+
33
+ def create_string(options)
34
+ create_parameter(
35
+ name: options[:name],
36
+ type: 'xs:string',
37
+ content: options[:content]
38
+ )
39
+ end
40
+
41
+ def create_date(options)
42
+ create_parameter(
43
+ name: options[:name],
44
+ type: 'xs:date',
45
+ content: options[:content]
46
+ )
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ module ConnectParameters
6
+ class ParamsSerializer
7
+ def initialize(params)
8
+ @params = params
9
+ @xml = Builder::XmlMarkup.new
10
+ end
11
+
12
+ def serialize
13
+ @xml.par(:Params) do
14
+ @params.each do |param|
15
+ property = param.property
16
+ value = param.value
17
+ @xml.Property('xmlns' => property.xmlns, 'name' => property.name) do
18
+ @xml.Value(value.content, 'xsi:type' => value.type)
19
+ end
20
+ end
21
+ end
22
+ @xml.target!
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ require_relative 'connect_parameters/connect_parameter'
2
+ require_relative 'connect_parameters/connect_property'
3
+ require_relative 'connect_parameters/connect_value'
4
+ require_relative 'connect_parameters/params_serializer'
5
+ require_relative 'connect_parameters/params_factory'
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ module Connection
6
+ def create_connection(client)
7
+ auth_data = [client.login, client.password]
8
+ Savon.client(
9
+ wsdl: 'https://cus.1c-connect.com/cus/ws/PartnerWebAPI2?wsdl',
10
+ basic_auth: auth_data
11
+ )
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ module Request
6
+ def call(client, options)
7
+ request_params = []
8
+ request_params = options[:params] if options[:params]
9
+ method = options[:method]
10
+ method_as_s = method.to_s
11
+ camel_case_method_name = method_as_s.to_s.gsub(/(?:_|\b)([a-z])/) { $1.upcase }
12
+ xml_body = build_params(camel_case_method_name, request_params)
13
+ xml = xml_template(xml_body)
14
+ response = client.connection.call(method, xml: xml)
15
+ body = response.body
16
+ body_key = "#{method_as_s}_response".to_sym
17
+ response_data = []
18
+ if (property = body.dig(body_key, :return, :property)) && property.size > 1 && property[1][:value][:row]
19
+ response_data = property[1][:value][:row]
20
+ end
21
+ response_data
22
+ end
23
+
24
+ private
25
+
26
+ def build_params(name, params = [])
27
+ serializer = Connect::WebService::ConnectParameters::ParamsSerializer.new(params)
28
+ params = serializer.serialize
29
+ "<par:#{name}>#{params}</par:#{name}>"
30
+ end
31
+
32
+ def xml_template(body)
33
+ <<-XML
34
+ <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:par="http://buhphone.com/PartnerWebAPI2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:core="http://v8.1c.ru/8.1/data/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
35
+ <soap:Header/>
36
+ <soap:Body>
37
+ #{body}
38
+ </soap:Body>
39
+ </soap:Envelope>
40
+ XML
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Connect
4
+ module WebService
5
+ module Rest
6
+ include Connect::WebService::Request
7
+ include Connect::WebService::ConnectParameters::ParamsFactory
8
+
9
+ def region_read
10
+ call(self, method: :region_read)
11
+ end
12
+
13
+ def department_read(options = {})
14
+ params = []
15
+ add_param(params, create_changed_from(options))
16
+ call(self, method: :department_read, params: params)
17
+ end
18
+
19
+ def department_add(options)
20
+ params = []
21
+ add_param(params, create_string(name: 'Name', content: options[:name], required: true))
22
+ call(self, method: :department_add, params: params)
23
+ end
24
+
25
+ def department_edit(options)
26
+ params = []
27
+ add_param(params, create_string(name: 'DepartmentID', content: options[:department_id], required: true))
28
+ add_param(params, create_string(name: 'Name', content: options[:name]))
29
+ call(self, method: :department_edit, params: params)
30
+ end
31
+
32
+ def department_delete(options)
33
+ params = []
34
+ add_param(params, create_string(name: 'DepartmentID', content: options[:department_id], required: true))
35
+ call(self, method: :department_delete, params: params)
36
+ end
37
+
38
+ def specialist_read(options = {})
39
+ params = []
40
+ add_param(params, create_changed_from(options))
41
+ call(self, method: :specialist_read, params: params)
42
+ end
43
+
44
+ def specialist_add(options)
45
+ params = []
46
+ add_param(params, create_string(name: 'Name', content: options[:name], required: true))
47
+ add_param(params, create_string(name: 'email', content: options[:email], required: true))
48
+ add_param(params, create_string(name: 'Surname', content: options[:surname]))
49
+ add_param(params, create_string(name: 'SecondaryName', content: options[:secondary_name]))
50
+ add_param(params, create_string(name: 'Password', content: options[:password]))
51
+ add_param(params, create_date(name: 'Birthday', content: options[:birthday]))
52
+ add_param(params, create_string(name: 'Post', content: options[:post]))
53
+ add_param(params, create_string(name: 'DepartmentID', content: options[:department_id]))
54
+ add_param(params, create_string(name: 'Phone', content: options[:phone]))
55
+
56
+ call(self, method: :specialist_add, params: params)
57
+ end
58
+
59
+ def client_user_read(options = {})
60
+ params = []
61
+ add_param(params, create_changed_from(options))
62
+ add_param(params, create_string(name: 'ClientID', content: options[:client_id]))
63
+ call(self, method: :client_user_read, params: params)
64
+ end
65
+
66
+ def add_param(params, param)
67
+ params << param if param.required || param.value.content
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,6 @@
1
+ require 'savon'
2
+ require_relative 'web_service/connect_parameters'
3
+ require_relative 'web_service/connection'
4
+ require_relative 'web_service/request'
5
+ require_relative 'web_service/rest'
6
+ require_relative 'web_service/client'
data/lib/connect.rb ADDED
@@ -0,0 +1,2 @@
1
+ require_relative 'connect/web_service'
2
+ require_relative 'connect/http_service'
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: 1c-connect-api-ruby
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: 2024-02-24 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
+ - ".github/workflows/ci.yml"
20
+ - ".gitignore"
21
+ - ".rspec"
22
+ - ".rubocop.yaml"
23
+ - Gemfile
24
+ - Gemfile.lock
25
+ - lib/connect.rb
26
+ - lib/connect/http_service.rb
27
+ - lib/connect/http_service/bot_api.rb
28
+ - lib/connect/http_service/client.rb
29
+ - lib/connect/http_service/connection.rb
30
+ - lib/connect/http_service/information_api.rb
31
+ - lib/connect/http_service/request.rb
32
+ - lib/connect/http_service/rest.rb
33
+ - lib/connect/web_service.rb
34
+ - lib/connect/web_service/client.rb
35
+ - lib/connect/web_service/connect_parameters.rb
36
+ - lib/connect/web_service/connect_parameters/connect_parameter.rb
37
+ - lib/connect/web_service/connect_parameters/connect_property.rb
38
+ - lib/connect/web_service/connect_parameters/connect_value.rb
39
+ - lib/connect/web_service/connect_parameters/params_factory.rb
40
+ - lib/connect/web_service/connect_parameters/params_serializer.rb
41
+ - lib/connect/web_service/connection.rb
42
+ - lib/connect/web_service/request.rb
43
+ - lib/connect/web_service/rest.rb
44
+ homepage:
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubygems_version: 3.5.6
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: 1C-Connect API client
67
+ test_files: []