bitrix24_cloud_api 0.1.0 → 0.1.3

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.
Files changed (35) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/README.md +18 -41
  4. data/bitrix24_cloud_api.gemspec +7 -10
  5. data/lib/bitrix24_cloud_api/CRM/activity.rb +5 -0
  6. data/lib/bitrix24_cloud_api/CRM/additional_entities.rb +58 -18
  7. data/lib/bitrix24_cloud_api/CRM/address.rb +9 -0
  8. data/lib/bitrix24_cloud_api/CRM/deal_category.rb +22 -0
  9. data/lib/bitrix24_cloud_api/CRM/externalchannel.rb +30 -0
  10. data/lib/bitrix24_cloud_api/CRM/invoice.rb +10 -0
  11. data/lib/bitrix24_cloud_api/CRM/live_feed_message.rb +11 -0
  12. data/lib/bitrix24_cloud_api/CRM/measure.rb +6 -0
  13. data/lib/bitrix24_cloud_api/CRM/product.rb +20 -0
  14. data/lib/bitrix24_cloud_api/CRM/product_row.rb +11 -0
  15. data/lib/bitrix24_cloud_api/CRM/property.rb +11 -0
  16. data/lib/bitrix24_cloud_api/CRM/requisite.rb +54 -0
  17. data/lib/bitrix24_cloud_api/CRM/status.rb +16 -0
  18. data/lib/bitrix24_cloud_api/CRM/userfield.rb +22 -0
  19. data/lib/bitrix24_cloud_api/CRM/vat.rb +6 -0
  20. data/lib/bitrix24_cloud_api/aliases.rb +7 -0
  21. data/lib/bitrix24_cloud_api/base.rb +10 -4
  22. data/lib/bitrix24_cloud_api/client.rb +27 -26
  23. data/lib/bitrix24_cloud_api/common_methods/common_methods.rb +62 -0
  24. data/lib/bitrix24_cloud_api/crm.rb +11 -1
  25. data/lib/bitrix24_cloud_api/hash_conversions.rb +37 -0
  26. data/lib/bitrix24_cloud_api/version.rb +1 -1
  27. data/lib/bitrix24_cloud_api.rb +3 -1
  28. metadata +72 -24
  29. data/.idea/.name +0 -1
  30. data/.idea/.rakeTasks +0 -7
  31. data/.idea/bitrix24_cloud_api.iml +0 -19
  32. data/.idea/misc.xml +0 -29
  33. data/.idea/modules.xml +0 -8
  34. data/.idea/vcs.xml +0 -6
  35. data/.idea/workspace.xml +0 -998
@@ -0,0 +1,62 @@
1
+ module Bitrix24CloudApi
2
+ module COMMON_METHODS
3
+ class User < Base
4
+ [:admin, :access, :get].each do |action|
5
+ define_singleton_method(action) do |client, query = {}|
6
+ client.make_get_request(resource_url(client, action), query)
7
+ end
8
+ end
9
+
10
+ class << self
11
+ def resource_path
12
+ "user"
13
+ end
14
+ end
15
+ end
16
+
17
+ class App < Base
18
+ class << self
19
+
20
+ def info(client)
21
+ client.make_get_request(resource_url(client, __method__))
22
+ end
23
+
24
+ def resource_path
25
+ "app"
26
+ end
27
+ end
28
+ end
29
+
30
+ class Event < Base
31
+ [:bind, :unbind, :get].each do |action|
32
+ define_singleton_method(action) do |client, query = {}|
33
+ client.make_get_request(resource_url(client, action), query)
34
+ end
35
+ end
36
+
37
+ class << self
38
+ def resource_path
39
+ "event"
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ class CommonMethods < Base
46
+ METHODS_SCOPE = [:methods, :scope, :batch, :access_name, :events]
47
+
48
+ METHODS_SCOPE.each do |action|
49
+ define_singleton_method(action) do |client, query = {}|
50
+ client.make_get_request(resource_url(client, action), query)
51
+ end
52
+ end
53
+
54
+ class << self
55
+ def resource_path
56
+ name = super
57
+ name.gsub("commonmethods", "")
58
+ end
59
+ end
60
+ end
61
+ end
62
+
@@ -8,7 +8,6 @@ module Bitrix24CloudApi
8
8
  end
9
9
  end
10
10
 
11
-
12
11
  [:get, :list, :fields].each do |action|
13
12
  define_singleton_method(action) do |client, query = {}|
14
13
  client.make_get_request(resource_url(client, action), query)
@@ -18,15 +17,26 @@ module Bitrix24CloudApi
18
17
  end
19
18
 
20
19
  require "bitrix24_cloud_api/CRM/additional_entities"
20
+ require "bitrix24_cloud_api/CRM/address"
21
21
  require "bitrix24_cloud_api/CRM/activity"
22
22
  require "bitrix24_cloud_api/CRM/catalog"
23
23
  require "bitrix24_cloud_api/CRM/company"
24
24
  require "bitrix24_cloud_api/CRM/contact"
25
25
  require "bitrix24_cloud_api/CRM/currency"
26
26
  require "bitrix24_cloud_api/CRM/deal"
27
+ require "bitrix24_cloud_api/CRM/deal_category"
28
+ require "bitrix24_cloud_api/CRM/externalchannel"
27
29
  require "bitrix24_cloud_api/CRM/invoice"
28
30
  require "bitrix24_cloud_api/CRM/invoice_status"
29
31
  require "bitrix24_cloud_api/CRM/lead"
32
+ require "bitrix24_cloud_api/CRM/live_feed_message"
33
+ require "bitrix24_cloud_api/CRM/measure"
30
34
  require "bitrix24_cloud_api/CRM/product"
35
+ require "bitrix24_cloud_api/CRM/product_row"
31
36
  require "bitrix24_cloud_api/CRM/product_section"
37
+ require "bitrix24_cloud_api/CRM/property"
38
+ require "bitrix24_cloud_api/CRM/requisite"
39
+ require "bitrix24_cloud_api/CRM/status"
40
+ require "bitrix24_cloud_api/CRM/vat"
32
41
  require "bitrix24_cloud_api/CRM/quote"
42
+ require "bitrix24_cloud_api/CRM/userfield"
@@ -0,0 +1,37 @@
1
+ module Bitrix24CloudApi
2
+ module HashConversions
3
+
4
+ def self.to_params(hash)
5
+ hash.to_hash.map { |k, v| normalize_param(k, v) }.join.chop
6
+ end
7
+
8
+ def self.normalize_param(key, value)
9
+ param = ''
10
+ stack = []
11
+
12
+ if value.respond_to?(:to_ary)
13
+ param << if value.empty?
14
+ "#{key}[]=&"
15
+ else
16
+ value.to_ary.map.with_index { |element, index| normalize_param("#{key}[#{index}]", element) }.join
17
+ end
18
+ elsif value.respond_to?(:to_hash)
19
+ stack << [key, value.to_hash]
20
+ else
21
+ param << "#{key}=#{ERB::Util.url_encode(value.to_s)}&"
22
+ end
23
+
24
+ stack.each do |parent, hash|
25
+ hash.each do |k, v|
26
+ if v.respond_to?(:to_hash)
27
+ stack << ["#{parent}[#{k}]", v.to_hash]
28
+ else
29
+ param << normalize_param("#{parent}[#{k}]", v)
30
+ end
31
+ end
32
+ end
33
+
34
+ param
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module Bitrix24CloudApi
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.3'
3
3
  end
@@ -1,8 +1,10 @@
1
1
  require "bitrix24_cloud_api/base"
2
2
  require "bitrix24_cloud_api/client"
3
+ require "bitrix24_cloud_api/common_methods/common_methods"
3
4
  require "bitrix24_cloud_api/crm"
5
+ require "bitrix24_cloud_api/hash_conversions"
6
+ require "bitrix24_cloud_api/aliases"
4
7
  require "bitrix24_cloud_api/version"
5
8
 
6
9
  module Bitrix24CloudApi
7
- # Your code goes here...
8
10
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitrix24_cloud_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viacheslav Gruzdov
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-02 00:00:00.000000000 Z
11
+ date: 2024-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.13.7
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.13.7
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,33 +81,47 @@ dependencies:
53
81
  - !ruby/object:Gem::Version
54
82
  version: '3.0'
55
83
  - !ruby/object:Gem::Dependency
56
- name: oauth2
84
+ name: webmock
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - "~>"
87
+ - - ">="
60
88
  - !ruby/object:Gem::Version
61
- version: '1.1'
89
+ version: '0'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - "~>"
94
+ - - ">="
67
95
  - !ruby/object:Gem::Version
68
- version: '1.1'
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
- name: httparty
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: shoulda-matchers
71
113
  requirement: !ruby/object:Gem::Requirement
72
114
  requirements:
73
115
  - - "~>"
74
116
  - !ruby/object:Gem::Version
75
- version: 0.13.7
117
+ version: '2.0'
76
118
  type: :development
77
119
  prerelease: false
78
120
  version_requirements: !ruby/object:Gem::Requirement
79
121
  requirements:
80
122
  - - "~>"
81
123
  - !ruby/object:Gem::Version
82
- version: 0.13.7
124
+ version: '2.0'
83
125
  description: Bitrix24 REST API wrapper (for only cloud version)
84
126
  email:
85
127
  - lucky-@mail.ru
@@ -88,13 +130,6 @@ extensions: []
88
130
  extra_rdoc_files: []
89
131
  files:
90
132
  - ".gitignore"
91
- - ".idea/.name"
92
- - ".idea/.rakeTasks"
93
- - ".idea/bitrix24_cloud_api.iml"
94
- - ".idea/misc.xml"
95
- - ".idea/modules.xml"
96
- - ".idea/vcs.xml"
97
- - ".idea/workspace.xml"
98
133
  - ".rspec"
99
134
  - ".travis.yml"
100
135
  - CODE_OF_CONDUCT.md
@@ -108,26 +143,41 @@ files:
108
143
  - lib/bitrix24_cloud_api.rb
109
144
  - lib/bitrix24_cloud_api/CRM/activity.rb
110
145
  - lib/bitrix24_cloud_api/CRM/additional_entities.rb
146
+ - lib/bitrix24_cloud_api/CRM/address.rb
111
147
  - lib/bitrix24_cloud_api/CRM/catalog.rb
112
148
  - lib/bitrix24_cloud_api/CRM/company.rb
113
149
  - lib/bitrix24_cloud_api/CRM/contact.rb
114
150
  - lib/bitrix24_cloud_api/CRM/currency.rb
115
151
  - lib/bitrix24_cloud_api/CRM/deal.rb
152
+ - lib/bitrix24_cloud_api/CRM/deal_category.rb
153
+ - lib/bitrix24_cloud_api/CRM/externalchannel.rb
116
154
  - lib/bitrix24_cloud_api/CRM/invoice.rb
117
155
  - lib/bitrix24_cloud_api/CRM/invoice_status.rb
118
156
  - lib/bitrix24_cloud_api/CRM/lead.rb
157
+ - lib/bitrix24_cloud_api/CRM/live_feed_message.rb
158
+ - lib/bitrix24_cloud_api/CRM/measure.rb
119
159
  - lib/bitrix24_cloud_api/CRM/product.rb
160
+ - lib/bitrix24_cloud_api/CRM/product_row.rb
120
161
  - lib/bitrix24_cloud_api/CRM/product_section.rb
162
+ - lib/bitrix24_cloud_api/CRM/property.rb
121
163
  - lib/bitrix24_cloud_api/CRM/quote.rb
164
+ - lib/bitrix24_cloud_api/CRM/requisite.rb
165
+ - lib/bitrix24_cloud_api/CRM/status.rb
166
+ - lib/bitrix24_cloud_api/CRM/userfield.rb
167
+ - lib/bitrix24_cloud_api/CRM/vat.rb
168
+ - lib/bitrix24_cloud_api/aliases.rb
122
169
  - lib/bitrix24_cloud_api/base.rb
123
170
  - lib/bitrix24_cloud_api/client.rb
171
+ - lib/bitrix24_cloud_api/common_methods/common_methods.rb
124
172
  - lib/bitrix24_cloud_api/crm.rb
173
+ - lib/bitrix24_cloud_api/hash_conversions.rb
125
174
  - lib/bitrix24_cloud_api/version.rb
126
175
  homepage: https://github.com/nononoy/bitrix24_cloud_api
127
176
  licenses:
128
177
  - MIT
129
- metadata: {}
130
- post_install_message:
178
+ metadata:
179
+ source_code_uri: https://github.com/nononoy/bitrix24_cloud_api
180
+ post_install_message:
131
181
  rdoc_options: []
132
182
  require_paths:
133
183
  - lib
@@ -142,10 +192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
192
  - !ruby/object:Gem::Version
143
193
  version: '0'
144
194
  requirements: []
145
- rubyforge_project:
146
- rubygems_version: 2.5.1
147
- signing_key:
195
+ rubygems_version: 3.5.6
196
+ signing_key:
148
197
  specification_version: 4
149
198
  summary: Bitrix24 REST API on Ruby
150
199
  test_files: []
151
- has_rdoc:
data/.idea/.name DELETED
@@ -1 +0,0 @@
1
- bitrix24_cloud_api
data/.idea/.rakeTasks DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Settings><!--This file was automatically generated by Ruby plugin.
3
- You are allowed to:
4
- 1. Remove rake task
5
- 2. Add existing rake tasks
6
- To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
@@ -1,19 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="FacetManager">
4
- <facet type="gem" name="Ruby Gem">
5
- <configuration>
6
- <option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
7
- <option name="GEM_APP_TEST_PATH" value="" />
8
- <option name="GEM_APP_LIB_PATH" value="" />
9
- </configuration>
10
- </facet>
11
- </component>
12
- <component name="NewModuleRootManager">
13
- <content url="file://$MODULE_DIR$" />
14
- <orderEntry type="jdk" jdkName="RVM: ruby-2.3.1 [global]" jdkType="RUBY_SDK" />
15
- <orderEntry type="sourceFolder" forTests="false" />
16
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.12.4, RVM: ruby-2.3.1 [global]) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="rake (v10.4.2, RVM: ruby-2.3.1 [global]) [gem]" level="application" />
18
- </component>
19
- </module>
data/.idea/misc.xml DELETED
@@ -1,29 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectLevelVcsManager" settingsEditedManually="false">
4
- <OptionsSetting value="true" id="Add" />
5
- <OptionsSetting value="true" id="Remove" />
6
- <OptionsSetting value="true" id="Checkout" />
7
- <OptionsSetting value="true" id="Update" />
8
- <OptionsSetting value="true" id="Status" />
9
- <OptionsSetting value="true" id="Edit" />
10
- <ConfirmationsSetting value="0" id="Add" />
11
- <ConfirmationsSetting value="0" id="Remove" />
12
- </component>
13
- <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.9.3-p551 [global]" project-jdk-type="RUBY_SDK" />
14
- <component name="masterDetails">
15
- <states>
16
- <state key="ScopeChooserConfigurable.UI">
17
- <settings>
18
- <splitter-proportions>
19
- <option name="proportions">
20
- <list>
21
- <option value="0.2" />
22
- </list>
23
- </option>
24
- </splitter-proportions>
25
- </settings>
26
- </state>
27
- </states>
28
- </component>
29
- </project>
data/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/bitrix24_cloud_api.iml" filepath="$PROJECT_DIR$/.idea/bitrix24_cloud_api.iml" />
6
- </modules>
7
- </component>
8
- </project>
data/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>