zoho_hub 0.1.16 → 0.1.17
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 +4 -4
- data/lib/zoho_hub/records/base_record.rb +6 -1
- data/lib/zoho_hub/records/quote.rb +6 -6
- data/lib/zoho_hub/response.rb +7 -1
- data/lib/zoho_hub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf4a7d2f509467db7f812178010051778b79d1039a55a8f96898ae9e073489b1
|
4
|
+
data.tar.gz: 1fcc4e9ee9ae2d1c7fad3c2bebc80a541928d42062f3e701a495b59f56d09ae7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 915784445d0975cbe42975e2879edac513e0a84cc9ed8da053afd21a85566aa56b77e010b9f336933feea5f5bce4b474e88df8ad49d003b38c12b6e2e6385d8b
|
7
|
+
data.tar.gz: f45f8e724fb663cf9b4b8c7a15b9738b824a8fd771558b151e761bd00366e0bef8ec654bd3677d78f5b23c3dc50c92ceb482ce084dfe8a49f47bd823dad33335
|
@@ -4,7 +4,7 @@ require 'zoho_hub/records/base_record'
|
|
4
4
|
|
5
5
|
module ZohoHub
|
6
6
|
class Quote < BaseRecord
|
7
|
-
attributes :id, :stage, :subject, :potential_id, :owner_id, :product_id
|
7
|
+
attributes :id, :stage, :subject, :potential_id, :owner_id, :product_id, :account_id
|
8
8
|
|
9
9
|
attribute_translation(
|
10
10
|
id: :id,
|
@@ -12,15 +12,13 @@ module ZohoHub
|
|
12
12
|
)
|
13
13
|
|
14
14
|
def initialize(params)
|
15
|
-
puts Rainbow(params).bright.red
|
16
15
|
attributes.each do |attr|
|
17
16
|
zoho_key = attr_to_zoho_key(attr)
|
18
|
-
puts "Sending #{attr}=, zoho_key: #{zoho_key}"
|
19
17
|
send("#{attr}=", params[zoho_key] || params[attr])
|
20
18
|
end
|
21
19
|
|
22
20
|
@potential_id ||= params.dig(:Deal_Name, :id)
|
23
|
-
@
|
21
|
+
@account_id ||= params.dig(:Account_Name, :id)
|
24
22
|
@owner_id ||= params.dig(:Owner, :id)
|
25
23
|
|
26
24
|
# The Quote has an array of products but we only care about one
|
@@ -34,9 +32,11 @@ module ZohoHub
|
|
34
32
|
params = super
|
35
33
|
|
36
34
|
params[:Deal_Name] = { id: @potential_id } if @potential_id
|
37
|
-
params[:Account_Name] = { id: @
|
35
|
+
params[:Account_Name] = { id: @account_id } if @account_id
|
38
36
|
params[:Owner] = { id: @owner_id } if @owner_id
|
39
|
-
params[:Product_Details] = [{ id: @product_id }] if @product_id
|
37
|
+
params[:Product_Details] = [{ product: { id: @product_id }, quantity: 1 }] if @product_id
|
38
|
+
|
39
|
+
params
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
data/lib/zoho_hub/response.rb
CHANGED
@@ -7,7 +7,9 @@ module ZohoHub
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def invalid_data?
|
10
|
-
|
10
|
+
if data.is_a?(Array)
|
11
|
+
return data.first[:code] == 'MANDATORY_NOT_FOUND'
|
12
|
+
end
|
11
13
|
|
12
14
|
data[:code] == 'INVALID_DATA'
|
13
15
|
end
|
@@ -41,6 +43,10 @@ module ZohoHub
|
|
41
43
|
def msg
|
42
44
|
msg = data[:message]
|
43
45
|
|
46
|
+
if data.dig(:code) == 'INVALID_DATA'
|
47
|
+
msg << ", error in #{data.dig(:details, :api_name)}"
|
48
|
+
end
|
49
|
+
|
44
50
|
if data.dig(:details, :expected_data_type)
|
45
51
|
expected = data.dig(:details, :expected_data_type)
|
46
52
|
field = data.dig(:details, :api_name)
|
data/lib/zoho_hub/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoho_hub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ricardo Otero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|