zoho_hub 0.1.29 → 0.2.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +4 -0
  5. data/.ruby-version +1 -1
  6. data/.travis.yml +5 -2
  7. data/README.md +91 -7
  8. data/bin/console +5 -6
  9. data/bin/read +44 -0
  10. data/bin/setup +0 -2
  11. data/bin/zoho_hub +62 -0
  12. data/cache/.git_keep +0 -0
  13. data/lib/zoho_hub/auth.rb +37 -47
  14. data/lib/zoho_hub/base_record.rb +122 -0
  15. data/lib/zoho_hub/configuration.rb +3 -4
  16. data/lib/zoho_hub/connection.rb +10 -17
  17. data/lib/zoho_hub/{records → deprecated_and_only_for_reference_records}/account.rb +0 -0
  18. data/lib/zoho_hub/{records → deprecated_and_only_for_reference_records}/campaign.rb +0 -0
  19. data/lib/zoho_hub/{records → deprecated_and_only_for_reference_records}/contact.rb +2 -4
  20. data/lib/zoho_hub/deprecated_and_only_for_reference_records/funder.rb +9 -0
  21. data/lib/zoho_hub/{records → deprecated_and_only_for_reference_records}/potential.rb +1 -14
  22. data/lib/zoho_hub/deprecated_and_only_for_reference_records/product.rb +9 -0
  23. data/lib/zoho_hub/deprecated_and_only_for_reference_records/quote.rb +34 -0
  24. data/lib/zoho_hub/errors.rb +0 -3
  25. data/lib/zoho_hub/module_builder.rb +61 -0
  26. data/lib/zoho_hub/oauth_callback_server.rb +26 -0
  27. data/lib/zoho_hub/response.rb +1 -7
  28. data/lib/zoho_hub/settings/field.rb +33 -0
  29. data/lib/zoho_hub/settings/module.rb +49 -0
  30. data/lib/zoho_hub/string_utils.rb +34 -0
  31. data/lib/zoho_hub/version.rb +1 -1
  32. data/lib/zoho_hub/views/variables.erb +72 -0
  33. data/lib/zoho_hub/with_attributes.rb +74 -0
  34. data/lib/zoho_hub/with_connection.rb +36 -0
  35. data/lib/zoho_hub.rb +20 -21
  36. data/zoho_hub.gemspec +21 -17
  37. metadata +104 -80
  38. data/lib/zoho_hub/records/adverse_criteria.rb +0 -43
  39. data/lib/zoho_hub/records/attachment.rb +0 -104
  40. data/lib/zoho_hub/records/base_record.rb +0 -189
  41. data/lib/zoho_hub/records/credit_score.rb +0 -36
  42. data/lib/zoho_hub/records/product.rb +0 -35
  43. data/lib/zoho_hub/records/quote.rb +0 -42
  44. data/lib/zoho_hub/records/vendor.rb +0 -34
metadata CHANGED
@@ -1,215 +1,230 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zoho_hub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.29
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ricardo Otero
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-01 00:00:00.000000000 Z
11
+ date: 2018-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
14
+ name: addressable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5'
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: addressable
28
+ name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.5'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.5'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: faraday
42
+ name: faraday_middleware
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.15'
47
+ version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.15'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: faraday_middleware
56
+ name: launchy
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0.12'
61
+ version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0.12'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: multi_json
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '1.13'
75
+ version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '1.13'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rainbow
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sinatra
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '3.0'
103
+ version: '0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '3.0'
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
- - - "~>"
115
+ - - ">="
102
116
  - !ruby/object:Gem::Version
103
- version: '2.0'
117
+ version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
- - - "~>"
122
+ - - ">="
109
123
  - !ruby/object:Gem::Version
110
- version: '2.0'
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: dotenv
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - "~>"
129
+ - - ">="
116
130
  - !ruby/object:Gem::Version
117
- version: '2.5'
131
+ version: '0'
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - "~>"
136
+ - - ">="
123
137
  - !ruby/object:Gem::Version
124
- version: '2.5'
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: pry-byebug
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "~>"
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: '3.6'
145
+ version: '0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - "~>"
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: '3.6'
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: rake
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - "~>"
157
+ - - ">="
144
158
  - !ruby/object:Gem::Version
145
- version: '10.0'
159
+ version: '0'
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - "~>"
164
+ - - ">="
151
165
  - !ruby/object:Gem::Version
152
- version: '10.0'
166
+ version: '0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: rspec
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - "~>"
171
+ - - ">="
158
172
  - !ruby/object:Gem::Version
159
- version: '3.0'
173
+ version: '0'
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - "~>"
178
+ - - ">="
165
179
  - !ruby/object:Gem::Version
166
- version: '3.0'
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: rubocop
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - "~>"
185
+ - - ">="
172
186
  - !ruby/object:Gem::Version
173
- version: '0.58'
187
+ version: '0'
174
188
  type: :development
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - "~>"
192
+ - - ">="
179
193
  - !ruby/object:Gem::Version
180
- version: '0.58'
194
+ version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: rubocop-rspec
183
197
  requirement: !ruby/object:Gem::Requirement
184
198
  requirements:
185
- - - "~>"
199
+ - - ">="
186
200
  - !ruby/object:Gem::Version
187
- version: '1.27'
201
+ version: '0'
188
202
  type: :development
189
203
  prerelease: false
190
204
  version_requirements: !ruby/object:Gem::Requirement
191
205
  requirements:
192
- - - "~>"
206
+ - - ">="
193
207
  - !ruby/object:Gem::Version
194
- version: '1.27'
208
+ version: '0'
195
209
  - !ruby/object:Gem::Dependency
196
210
  name: simplecov
197
211
  requirement: !ruby/object:Gem::Requirement
198
212
  requirements:
199
- - - "~>"
213
+ - - ">="
200
214
  - !ruby/object:Gem::Version
201
- version: '0.16'
215
+ version: '0'
202
216
  type: :development
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
- - - "~>"
220
+ - - ">="
207
221
  - !ruby/object:Gem::Version
208
- version: '0.16'
222
+ version: '0'
209
223
  description: Simple gem to connect to Zoho CRM API V2
210
224
  email:
211
225
  - oterosantos@gmail.com
212
- executables: []
226
+ executables:
227
+ - zoho_hub
213
228
  extensions: []
214
229
  extra_rdoc_files: []
215
230
  files:
@@ -223,31 +238,39 @@ files:
223
238
  - README.md
224
239
  - Rakefile
225
240
  - bin/console
241
+ - bin/read
226
242
  - bin/setup
243
+ - bin/zoho_hub
244
+ - cache/.git_keep
227
245
  - lib/zoho_hub.rb
228
246
  - lib/zoho_hub/auth.rb
247
+ - lib/zoho_hub/base_record.rb
229
248
  - lib/zoho_hub/configuration.rb
230
249
  - lib/zoho_hub/connection.rb
250
+ - lib/zoho_hub/deprecated_and_only_for_reference_records/account.rb
251
+ - lib/zoho_hub/deprecated_and_only_for_reference_records/campaign.rb
252
+ - lib/zoho_hub/deprecated_and_only_for_reference_records/contact.rb
253
+ - lib/zoho_hub/deprecated_and_only_for_reference_records/funder.rb
254
+ - lib/zoho_hub/deprecated_and_only_for_reference_records/potential.rb
255
+ - lib/zoho_hub/deprecated_and_only_for_reference_records/product.rb
256
+ - lib/zoho_hub/deprecated_and_only_for_reference_records/quote.rb
231
257
  - lib/zoho_hub/errors.rb
232
- - lib/zoho_hub/records/account.rb
233
- - lib/zoho_hub/records/adverse_criteria.rb
234
- - lib/zoho_hub/records/attachment.rb
235
- - lib/zoho_hub/records/base_record.rb
236
- - lib/zoho_hub/records/campaign.rb
237
- - lib/zoho_hub/records/contact.rb
238
- - lib/zoho_hub/records/credit_score.rb
239
- - lib/zoho_hub/records/potential.rb
240
- - lib/zoho_hub/records/product.rb
241
- - lib/zoho_hub/records/quote.rb
242
- - lib/zoho_hub/records/vendor.rb
258
+ - lib/zoho_hub/module_builder.rb
259
+ - lib/zoho_hub/oauth_callback_server.rb
243
260
  - lib/zoho_hub/response.rb
261
+ - lib/zoho_hub/settings/field.rb
262
+ - lib/zoho_hub/settings/module.rb
263
+ - lib/zoho_hub/string_utils.rb
244
264
  - lib/zoho_hub/version.rb
265
+ - lib/zoho_hub/views/variables.erb
266
+ - lib/zoho_hub/with_attributes.rb
267
+ - lib/zoho_hub/with_connection.rb
245
268
  - zoho_hub.gemspec
246
269
  homepage: https://github.com/rikas/zoho_hub
247
270
  licenses:
248
271
  - MIT
249
272
  metadata: {}
250
- post_install_message:
273
+ post_install_message:
251
274
  rdoc_options: []
252
275
  require_paths:
253
276
  - lib
@@ -255,15 +278,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
278
  requirements:
256
279
  - - ">="
257
280
  - !ruby/object:Gem::Version
258
- version: '0'
281
+ version: 2.1.0
259
282
  required_rubygems_version: !ruby/object:Gem::Requirement
260
283
  requirements:
261
284
  - - ">="
262
285
  - !ruby/object:Gem::Version
263
286
  version: '0'
264
287
  requirements: []
265
- rubygems_version: 3.1.4
266
- signing_key:
288
+ rubyforge_project:
289
+ rubygems_version: 2.7.6
290
+ signing_key:
267
291
  specification_version: 4
268
292
  summary: Simple gem to connect to Zoho CRM API V2
269
293
  test_files: []
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'zoho_hub/records/base_record'
4
-
5
- module ZohoHub
6
- class AdverseCriteria < BaseRecord
7
- request_path 'Adverse_Criteria'
8
-
9
- attributes :id, :account_id, :date_decided, :date_paid
10
- attributes :status, :amount, :currency, :court
11
- attributes :case_reference, :entity_details, :data_source
12
-
13
- attribute_translation(
14
- id: :id,
15
- case_reference: :Name,
16
- status: :CCJ_Status,
17
- amount: :CCJ_Amount,
18
- data_source: :CCJ_Data_Source,
19
- date_paid: :Date_paid,
20
- date_decided: :Date_decided,
21
- entity_details: :Entity_details
22
- )
23
-
24
- def initialize(params)
25
- attributes.each do |attr|
26
- zoho_key = attr_to_zoho_key(attr)
27
-
28
- send("#{attr}=", params[zoho_key] || params[attr])
29
- end
30
-
31
- # Setup values as they come from the Zoho API if needed
32
- @account_id ||= params.dig(:Account, :id)
33
- end
34
-
35
- def to_params
36
- params = super
37
-
38
- params[:Account] = { id: @account_id } if @account_id
39
-
40
- params
41
- end
42
- end
43
- end
@@ -1,104 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'zoho_hub/records/base_record'
4
-
5
- module ZohoHub
6
- class Attachment < BaseRecord
7
- attributes :id, :parent_id, :file_name, :link_url, :type, :created_time
8
- attributes :parent, :attachment_url
9
-
10
- # The translation from attribute name to the JSON field on Zoho. The default behaviour will be
11
- # to Camel_Case the attribute so on this list we should only have exceptions to this rule.
12
- attribute_translation(
13
- id: :id,
14
- link_url: :'$link_url',
15
- type: :'$type'
16
- )
17
-
18
- def initialize(params)
19
- attributes.each do |attr|
20
- zoho_key = attr_to_zoho_key(attr)
21
-
22
- send("#{attr}=", params[zoho_key] || params[attr])
23
- end
24
-
25
- @parent_id = params.dig(:Parent_Id, :id)
26
- end
27
-
28
- class << self
29
- def exists?(id, parent:)
30
- !find(id, parent: parent).nil?
31
- rescue RecordNotFound
32
- false
33
- end
34
-
35
- def find(id, parent:)
36
- body = get(File.join(request_path, id.to_s), parent: parent)
37
- response = build_response(body)
38
-
39
- if response.empty?
40
- raise RecordNotFound, "Couldn't find #{request_path.singularize} with 'id'=#{id}"
41
- end
42
-
43
- new(response.data)
44
- end
45
-
46
- def get(path, parent:, **params)
47
- # remove /search added by where method
48
- path = path.sub('/search', '')
49
- ZohoHub.connection.get(parent_module_path(path, parent), params)
50
- end
51
-
52
- def post(path, parent:, **params)
53
- ZohoHub.connection.post(parent_module_path(path, parent), params) do |conn|
54
- conn.request :multipart
55
- conn.request :url_encoded
56
- end
57
- end
58
-
59
- def put(_path, _params = {})
60
- raise NotImplementedError
61
- end
62
-
63
- def parent_module_path(path, parent)
64
- File.join(
65
- parent.class.request_path,
66
- parent.id,
67
- path
68
- )
69
- end
70
- end
71
-
72
- def post(path, _params = {})
73
- self.class.post(path, parent: parent, **to_params)
74
- end
75
-
76
- def put(_path, _params = {})
77
- raise NotImplementedError
78
- end
79
-
80
- def save(*)
81
- super
82
- rescue => e
83
- if e.message.include?('Attachment link already exists')
84
- raise AttachmentLinkTakenError, e.message
85
- else
86
- raise e
87
- end
88
- end
89
-
90
- def to_params
91
- { attachmentUrl: attachment_url }
92
- end
93
-
94
- private
95
-
96
- def to_input(**)
97
- to_params
98
- end
99
-
100
- def parent_module_path(path)
101
- self.class.parent_module_path(path, parent)
102
- end
103
- end
104
- end
@@ -1,189 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'zoho_hub/response'
4
-
5
- module ZohoHub
6
- class BaseRecord
7
- class << self
8
- def request_path(name = nil)
9
- @request_path = name if name
10
- @request_path ||= to_s.demodulize.pluralize
11
- @request_path
12
- end
13
-
14
- def attributes(*attributes)
15
- @attributes ||= []
16
-
17
- return @attributes unless attributes
18
-
19
- attr_accessor(*attributes)
20
-
21
- @attributes += attributes
22
- end
23
-
24
- def attribute_translation(translation = nil)
25
- @attribute_translation ||= {}
26
-
27
- return @attribute_translation unless translation
28
-
29
- @attribute_translation = translation
30
- end
31
-
32
- def zoho_key_translation
33
- @attribute_translation.to_a.map(&:rotate).to_h
34
- end
35
-
36
- def find(id)
37
- body = get(File.join(request_path, id.to_s))
38
- response = build_response(body)
39
-
40
- if response.empty?
41
- raise RecordNotFound, "Couldn't find #{request_path.singularize} with 'id'=#{id}"
42
- end
43
-
44
- new(response.data)
45
- end
46
-
47
- def where(params)
48
- path = File.join(request_path, 'search')
49
-
50
- response = get(path, params)
51
-
52
- data = response.nil? ? [] : response.fetch(:data, [])
53
-
54
- data.map { |info| new(info) }
55
- end
56
-
57
- def find_by(params)
58
- records = where(params)
59
- records.first
60
- end
61
-
62
- def create(params)
63
- new(params).save
64
- end
65
-
66
- def all(options = {})
67
- options[:page] ||= 1
68
- options[:per_page] ||= 200
69
-
70
- body = get(request_path, options)
71
- response = build_response(body)
72
-
73
- data = response.nil? ? [] : response.data
74
-
75
- data.map { |info| new(info) }
76
- end
77
-
78
- def get(path, params = {}, &block)
79
- ZohoHub.connection.get(path, params, &block)
80
- end
81
-
82
- def post(path, params = {}, &block)
83
- ZohoHub.connection.post(path, params.to_json, &block)
84
- end
85
-
86
- def put(path, params = {}, &block)
87
- ZohoHub.connection.put(path, params.to_json, &block)
88
- end
89
-
90
- def exists?(id)
91
- !find(id).nil?
92
- rescue RecordNotFound
93
- false
94
- end
95
-
96
- alias exist? exists?
97
-
98
- def build_response(body)
99
- response = Response.new(body)
100
-
101
- raise InvalidTokenError, response.msg if response.invalid_token?
102
- raise RecordInvalid, response.msg if response.invalid_data?
103
-
104
- response
105
- end
106
- end
107
-
108
- def attributes
109
- self.class.attributes
110
- end
111
-
112
- def get(path, params = {})
113
- self.class.get(path, params)
114
- end
115
-
116
- def post(path, params = {})
117
- self.class.post(path, params)
118
- end
119
-
120
- def put(path, params = {})
121
- self.class.put(path, params)
122
- end
123
-
124
- # Save the record to Zoho
125
- # trigger: ['workflow', 'approval', 'blueprint']
126
- def save(trigger:)
127
- body = if new_record? # create new record
128
- post(self.class.request_path, to_input(trigger: trigger))
129
- else # update existing record
130
- path = File.join(self.class.request_path, id)
131
- put(path, to_input(trigger: trigger))
132
- end
133
-
134
- response = build_response(body)
135
-
136
- id = response.data.dig(:details, :id)
137
-
138
- return id if id
139
-
140
- # Invalid errors
141
- response.data
142
- end
143
-
144
- def to_input(trigger:)
145
- json = { data: [to_params] }
146
- json[:trigger] = Array(trigger) if trigger
147
-
148
- json
149
- end
150
-
151
- def new_record?
152
- !id.present?
153
- end
154
-
155
- def to_params
156
- params = {}
157
-
158
- attributes.each do |attr|
159
- key = attr_to_zoho_key(attr)
160
-
161
- params[key] = send(attr)
162
- end
163
-
164
- params
165
- end
166
-
167
- def build_response(body)
168
- self.class.build_response(body)
169
- end
170
-
171
- private
172
-
173
- def attr_to_zoho_key(attr_name)
174
- translations = self.class.attribute_translation
175
-
176
- return translations[attr_name.to_sym] if translations.key?(attr_name.to_sym)
177
-
178
- attr_name.to_s.split('_').map(&:capitalize).join('_').to_sym
179
- end
180
-
181
- def zoho_key_to_attr(zoho_key)
182
- translations = self.class.zoho_key_translation
183
-
184
- return translations[zoho_key.to_sym] if translations.key?(zoho_key.to_sym)
185
-
186
- zoho_key.to_sym
187
- end
188
- end
189
- end