ZCRMSDK 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ZCRMSDK/handler.rb +4 -4
- data/lib/ZCRMSDK/oauth_client.rb +9 -5
- data/lib/ZCRMSDK/test.rb +23 -23
- data/lib/ZCRMSDK/utility.rb +1 -0
- data/lib/ZCRMSDK/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: c75f324861b8691cb24e427556e3102b5114fc0d8472ac9d0d7c7d32d3f524ae
|
4
|
+
data.tar.gz: d42a052548fb2dc89a47fd7719046c5f83ed49174ca849f436e12ca4f1e9362a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22b0e6582e8a0b0a66d11a2b8437ce7ac1c830cd2ad6e3bc413b9c23db8d9f093ecc65ed99bf4e85ccd28597c57e84d97677f03b2e95b635d7420ef4e7b23d0f
|
7
|
+
data.tar.gz: 72684ea5a25c1ca00cbf179dbe9b2a99dce522f83f799f978265a784249c6ad8474a052840a72a89a9ceb67cfb6dcf90489e31c256d1b93dfdf1276ebaef1e6e
|
data/lib/ZCRMSDK/handler.rb
CHANGED
@@ -965,17 +965,17 @@ module ZCRMSDK
|
|
965
965
|
|
966
966
|
if key == 'id'
|
967
967
|
zcrmrecord.entity_id = value
|
968
|
-
elsif key == 'Product_Details'
|
968
|
+
elsif key == 'Product_Details' && Utility::APIConstants::INVENTORY_MODULES.include?(@zcrmrecord.module_api_name)
|
969
969
|
line_items = value
|
970
970
|
line_items.each do |line_item|
|
971
971
|
zcrmrecord.line_items.push(entity_api_handler_helper.get_zcrminventory_line_item(line_item))
|
972
972
|
end
|
973
|
-
elsif key == 'Participants'
|
973
|
+
elsif key == 'Participants' && @zcrmrecord.module_api_name == "Events"
|
974
974
|
participants = value
|
975
975
|
participants.each do |participant|
|
976
976
|
zcrmrecord.participants.push(entity_api_handler_helper.get_zcrmparticipant(participant))
|
977
977
|
end
|
978
|
-
elsif key == 'Pricing_Details'
|
978
|
+
elsif key == 'Pricing_Details' && @zcrmrecord.module_api_name == "Price_Books"
|
979
979
|
price_details = value
|
980
980
|
price_details.each do |price_detail|
|
981
981
|
zcrmrecord.price_details.push(entity_api_handler_helper.get_zcrm_pricebook_pricing(price_detail))
|
@@ -1681,7 +1681,7 @@ module ZCRMSDK
|
|
1681
1681
|
get_users('ActiveConfirmedAdmins',page,per_page)
|
1682
1682
|
end
|
1683
1683
|
|
1684
|
-
def get_current_user(page,per_page)
|
1684
|
+
def get_current_user(page = nil, per_page = nil)
|
1685
1685
|
get_users('CurrentUser',page,per_page)
|
1686
1686
|
end
|
1687
1687
|
|
data/lib/ZCRMSDK/oauth_client.rb
CHANGED
@@ -215,11 +215,15 @@ module ZCRMSDK
|
|
215
215
|
end
|
216
216
|
|
217
217
|
def get_user_email_from_iam(access_token)
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
218
|
+
begin
|
219
|
+
header = {}
|
220
|
+
header[OAuthUtility::ZohoOAuthConstants::AUTHORIZATION] = OAuthUtility::ZohoOAuthConstants::OAUTH_HEADER_PREFIX + access_token
|
221
|
+
connector = OAuthUtility::ZohoOAuthHTTPConnector.get_instance(ZohoOAuth.get_user_info_url, nil, header, nil, OAuthUtility::ZohoOAuthConstants::REQUEST_METHOD_GET)
|
222
|
+
response = connector.trigger_request
|
223
|
+
JSON.parse(response.body)[OAuthUtility::ZohoOAuthConstants::EMAIL]
|
224
|
+
rescue StandardError => e
|
225
|
+
raise OAuthUtility::ZohoOAuthException.get_instance('generate_access_token(grant_token)', 'Exception occured while fetching User Id from access Token,Make sure AAAserver.profile.Read scope is included while generating the Grant token', 'Exception occured while fetching User Id from access Token', OAuthUtility::ZohoOAuthConstants::ERROR)
|
226
|
+
end
|
223
227
|
end
|
224
228
|
end
|
225
229
|
# THIS CLASS IS USED TO STORE THE TOKEN AS A INSTANCE AND CHECK THE VALIDITY OF THE TOKEN
|
data/lib/ZCRMSDK/test.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
require './oauth_utility'
|
2
|
-
require './operations'
|
3
|
-
require './handler'
|
4
|
-
require './oauth_client'
|
5
|
-
require './operations'
|
6
|
-
require './org'
|
7
|
-
require './persistence'
|
8
|
-
require './request'
|
9
|
-
require './response'
|
10
|
-
require './utility'
|
11
|
-
require './restclient'
|
12
|
-
require './version'
|
13
|
-
|
1
|
+
# require './oauth_utility'
|
2
|
+
# require './operations'
|
3
|
+
# require './handler'
|
4
|
+
# require './oauth_client'
|
5
|
+
# require './operations'
|
6
|
+
# require './org'
|
7
|
+
# require './persistence'
|
8
|
+
# require './request'
|
9
|
+
# require './response'
|
10
|
+
# require './utility'
|
11
|
+
# require './restclient'
|
12
|
+
# require './version'
|
13
|
+
require 'ZCRMSDK'
|
14
14
|
# THIS CLASS SHOWS THE EXAMPLES
|
15
15
|
class Tester
|
16
16
|
def initialize
|
17
17
|
|
18
|
-
|
18
|
+
config_details = { 'client_id' => 'client_id', 'client_secret' => 'client_secret', 'redirect_uri' => 'redirect_uri', 'api_base_url' => 'http://www.zohoapis.com', 'api_version' => 'v2', 'current_user_email' => 'current_user_email' ,'log_in_console' => 'true' }
|
19
19
|
ZCRMSDK::RestClient::ZCRMRestClient.init(config_details)
|
20
20
|
end
|
21
21
|
|
@@ -5467,7 +5467,7 @@ class Tester
|
|
5467
5467
|
end
|
5468
5468
|
|
5469
5469
|
def update_variable
|
5470
|
-
variable_id='
|
5470
|
+
variable_id='3524033000003209002'
|
5471
5471
|
variable_api_name='updated'
|
5472
5472
|
variable = ZCRMSDK::Operations::ZCRMVariable.get_instance(variable_api_name,variable_id)
|
5473
5473
|
variable.name="updated"
|
@@ -5483,7 +5483,7 @@ class Tester
|
|
5483
5483
|
end
|
5484
5484
|
|
5485
5485
|
def delete_variable
|
5486
|
-
variable_id='
|
5486
|
+
variable_id='3524033000003076001'
|
5487
5487
|
variable = ZCRMSDK::Operations::ZCRMVariable.get_instance(nil,variable_id)
|
5488
5488
|
response = variable.delete
|
5489
5489
|
print "\n"
|
@@ -5553,9 +5553,9 @@ class Tester
|
|
5553
5553
|
def create_variables
|
5554
5554
|
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5555
5555
|
variables=[]
|
5556
|
-
variable_ins1=ZCRMSDK::Operations::ZCRMVariable.get_instance("
|
5557
|
-
variable_ins1.name="
|
5558
|
-
variable_ins1.description="
|
5556
|
+
variable_ins1=ZCRMSDK::Operations::ZCRMVariable.get_instance("variable_api_name1",nil)
|
5557
|
+
variable_ins1.name="variable_api_name1"
|
5558
|
+
variable_ins1.description="variable_api_name1"
|
5559
5559
|
variable_ins1.type="integer"
|
5560
5560
|
variable_ins1.variable_group=ZCRMSDK::Operations::ZCRMVariableGroup.get_instance("General","3524033000000231001")
|
5561
5561
|
variable_ins1.value=23
|
@@ -5613,7 +5613,7 @@ obj = Tester.new
|
|
5613
5613
|
|
5614
5614
|
# obj.get_module
|
5615
5615
|
# obj.get_all_modules
|
5616
|
-
obj.get_organization_details
|
5616
|
+
# obj.get_organization_details
|
5617
5617
|
# obj.get_current_user
|
5618
5618
|
|
5619
5619
|
# ZCRMOrganization samples
|
@@ -5741,6 +5741,6 @@ obj.get_organization_details
|
|
5741
5741
|
|
5742
5742
|
#OAuth token generation from refresh token
|
5743
5743
|
|
5744
|
-
#
|
5745
|
-
#
|
5746
|
-
#
|
5744
|
+
#client = ZCRMSDK::OAuthClient::ZohoOAuth.get_client_instance
|
5745
|
+
#refresh_token = 'refresh_token'
|
5746
|
+
#client.generate_access_token_from_refresh_token(refresh_token,useridentifier)
|
data/lib/ZCRMSDK/utility.rb
CHANGED
@@ -194,6 +194,7 @@ module ZCRMSDK
|
|
194
194
|
CURR_WINDOW_RESET = 'X-RATELIMIT-RESET'
|
195
195
|
API_COUNT_REMAINING_FOR_THE_DAY = 'X-RATELIMIT-DAY-REMAINING'
|
196
196
|
API_LIMIT_FOR_THE_DAY = 'X-RATELIMIT-DAY-LIMIT'
|
197
|
+
INVENTORY_MODULES = ["Invoices", "Sales_Orders","Purchase_Orders","Quotes"]
|
197
198
|
end
|
198
199
|
# THIS CLASS IS USED TO FIRE THE API REQUEST
|
199
200
|
class ZohoHTTPConnector
|
data/lib/ZCRMSDK/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ZCRMSDK
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ZOHO CRM API TEAM
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|