ZCRMSDK 0.0.3 → 0.0.4
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 +258 -0
- data/lib/ZCRMSDK/operations.rb +46 -0
- data/lib/ZCRMSDK/org.rb +12 -0
- data/lib/ZCRMSDK/test.rb +179 -1
- data/lib/ZCRMSDK/utility.rb +2 -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: 36b7ac4b8c5f3f22bb1b8ae168bcef8e41969647fee3cb4de3144e6e34484767
|
4
|
+
data.tar.gz: f6af5e1498785a14bb23aca9375e58f29f04eb89e154d54bf19d9764a4ee3a14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c694c2c8d4fb10f5d29ae59e65af31f4b75518234cf09a5fa8703cee02d84999316a9222e3655464ea2004a0d01d14b3710d388def517e5844021a59485dccc
|
7
|
+
data.tar.gz: 596ee58a73ea581efd6d2c189076e3566cc7e8426a03e75b960da9815902dd7ab07113b1a953f40cd8c881e75fcc284648f9f87812b28fa9c7ccb3a7bca29171
|
data/lib/ZCRMSDK/handler.rb
CHANGED
@@ -3028,5 +3028,263 @@ module ZCRMSDK
|
|
3028
3028
|
attachment_ins
|
3029
3029
|
end
|
3030
3030
|
end
|
3031
|
+
|
3032
|
+
class VariableAPIHandler < APIHandler
|
3033
|
+
def initialize(variable_ins = nil)
|
3034
|
+
@zcrmvariable = variable_ins
|
3035
|
+
end
|
3036
|
+
|
3037
|
+
def self.get_instance(variable_ins = nil)
|
3038
|
+
VariableAPIHandler.new(variable_ins)
|
3039
|
+
end
|
3040
|
+
|
3041
|
+
def create_variables(variables)
|
3042
|
+
if variables.length > 100
|
3043
|
+
raise Utility::ZCRMException.get_instance('create_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable count must be less than or equals to 100', 'MORE VARIABLES PROVIDED')
|
3044
|
+
end
|
3045
|
+
|
3046
|
+
if variables.length < 1
|
3047
|
+
raise Utility::ZCRMException.get_instance('create_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable count must at least be 1', 'NO VARIABLES PROVIDED')
|
3048
|
+
end
|
3049
|
+
|
3050
|
+
handler_ins = APIHandler.get_instance
|
3051
|
+
handler_ins.request_url_path = 'settings/variables'
|
3052
|
+
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
3053
|
+
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::VARIABLE
|
3054
|
+
variable_array = []
|
3055
|
+
variable_helper = VariableAPIHandlerHelper.get_instance
|
3056
|
+
variables.each do |variable|
|
3057
|
+
if variable.id.nil?
|
3058
|
+
variable_array.push(variable_helper.get_zcrmvariable_as_json(variable))
|
3059
|
+
else
|
3060
|
+
raise Utility::ZCRMException.get_instance('create_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable id must be nil', 'VARIABLE ID PROVIDED')
|
3061
|
+
end
|
3062
|
+
end
|
3063
|
+
request_json = {}
|
3064
|
+
request_json[Utility::APIConstants::VARIABLE] = variable_array
|
3065
|
+
handler_ins.request_body = request_json
|
3066
|
+
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
3067
|
+
bulk_api_response
|
3068
|
+
end
|
3069
|
+
|
3070
|
+
def update_variables(variables)
|
3071
|
+
if variables.length > 100
|
3072
|
+
raise Utility::ZCRMException.get_instance('update_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable count must be less than or equals to 100', 'MORE VARIABLES PROVIDED')
|
3073
|
+
end
|
3074
|
+
|
3075
|
+
if variables.length < 1
|
3076
|
+
raise Utility::ZCRMException.get_instance('update_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable count must at least be 1', 'NO VARIABLES PROVIDED')
|
3077
|
+
end
|
3078
|
+
|
3079
|
+
handler_ins = APIHandler.get_instance
|
3080
|
+
handler_ins.request_url_path = 'settings/variables'
|
3081
|
+
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_PUT
|
3082
|
+
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::VARIABLE
|
3083
|
+
variable_array = []
|
3084
|
+
variable_helper = VariableAPIHandlerHelper.get_instance
|
3085
|
+
variables.each do |variable|
|
3086
|
+
unless variable.id.nil?
|
3087
|
+
variable_array.push(variable_helper.get_zcrmvariable_as_json(variable))
|
3088
|
+
else
|
3089
|
+
raise Utility::ZCRMException.get_instance('update_variables', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'variable id must not be nil', 'VARIABLE ID NOT PROVIDED')
|
3090
|
+
end
|
3091
|
+
end
|
3092
|
+
request_json = {}
|
3093
|
+
request_json[Utility::APIConstants::VARIABLE] = variable_array
|
3094
|
+
handler_ins.request_body = request_json
|
3095
|
+
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
3096
|
+
bulk_api_response
|
3097
|
+
end
|
3098
|
+
|
3099
|
+
def get_variable(group_id)
|
3100
|
+
if @zcrmvariable.id.nil?
|
3101
|
+
raise Utility::ZCRMException.get_instance('get_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the variable', 'ID IS NOT PROVIDED')
|
3102
|
+
end
|
3103
|
+
|
3104
|
+
if group_id.nil?
|
3105
|
+
raise Utility::ZCRMException.get_instance('get_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'group should be set for the variable', 'ID IS NOT PROVIDED')
|
3106
|
+
end
|
3107
|
+
|
3108
|
+
handler_ins = APIHandler.get_instance
|
3109
|
+
handler_ins.request_url_path = ''
|
3110
|
+
handler_ins.request_url_path = 'settings/variables/' + @zcrmvariable.id.to_s
|
3111
|
+
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
3112
|
+
handler_ins.request_api_key = Utility::APIConstants::VARIABLE
|
3113
|
+
handler_ins.add_param('group',group_id)
|
3114
|
+
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
3115
|
+
obj = VariableAPIHandlerHelper.get_instance
|
3116
|
+
obj.get_zcrmvariable(@zcrmvariable, api_response.response_json.dig(Utility::APIConstants::VARIABLE, 0))
|
3117
|
+
api_response.data = @zcrmvariable
|
3118
|
+
api_response
|
3119
|
+
end
|
3120
|
+
|
3121
|
+
def update_variable
|
3122
|
+
if @zcrmvariable.id.nil?
|
3123
|
+
raise Utility::ZCRMException.get_instance('update_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the variable', 'ID IS NOT PROVIDED')
|
3124
|
+
end
|
3125
|
+
|
3126
|
+
handler_ins = APIHandler.get_instance
|
3127
|
+
handler_ins.request_url_path = ''
|
3128
|
+
handler_ins.request_url_path = 'settings/variables/' + @zcrmvariable.id.to_s
|
3129
|
+
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_PUT
|
3130
|
+
handler_ins.request_api_key = Utility::APIConstants::VARIABLE
|
3131
|
+
helper_obj = VariableAPIHandlerHelper.get_instance
|
3132
|
+
input_json = helper_obj.get_zcrmvariable_as_json(@zcrmvariable)
|
3133
|
+
handler_ins.request_body = Utility::CommonUtil.create_api_supported_input_json(input_json, Utility::APIConstants::VARIABLE)
|
3134
|
+
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
3135
|
+
response_details = api_response.response_json.dig(Utility::APIConstants::VARIABLE, 0, 'details')
|
3136
|
+
@zcrmvariable.id = response_details['id']
|
3137
|
+
api_response.data = @zcrmvariable
|
3138
|
+
api_response
|
3139
|
+
end
|
3140
|
+
|
3141
|
+
def delete_variable
|
3142
|
+
if @zcrmvariable.id.nil?
|
3143
|
+
raise Utility::ZCRMException.get_instance('delete_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the variable', 'ID IS NOT PROVIDED')
|
3144
|
+
end
|
3145
|
+
|
3146
|
+
handler_ins = APIHandler.get_instance
|
3147
|
+
handler_ins.request_url_path = ''
|
3148
|
+
handler_ins.request_url_path = 'settings/variables/' + @zcrmvariable.id.to_s
|
3149
|
+
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_DELETE
|
3150
|
+
handler_ins.request_api_key = Utility::APIConstants::VARIABLE
|
3151
|
+
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
3152
|
+
api_response
|
3153
|
+
end
|
3154
|
+
|
3155
|
+
def get_variables
|
3156
|
+
handler_ins = APIHandler.get_instance
|
3157
|
+
handler_ins.request_url_path = 'settings/variables'
|
3158
|
+
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
3159
|
+
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::VARIABLE
|
3160
|
+
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
3161
|
+
variables_json = bulk_api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::VARIABLE)
|
3162
|
+
variable_list = []
|
3163
|
+
variable_helper = VariableAPIHandlerHelper.get_instance
|
3164
|
+
variables_json.each do |variable_json|
|
3165
|
+
variable_ins = Operations::ZCRMVariable.get_instance(variable_json['api_name'], variable_json['id'])
|
3166
|
+
variable_list.push(variable_helper.get_zcrmvariable(variable_ins, variable_json))
|
3167
|
+
end
|
3168
|
+
bulk_api_response.data = variable_list
|
3169
|
+
bulk_api_response
|
3170
|
+
end
|
3171
|
+
end
|
3172
|
+
|
3173
|
+
class VariableAPIHandlerHelper
|
3174
|
+
def initialize; end
|
3175
|
+
|
3176
|
+
def self.get_instance
|
3177
|
+
VariableAPIHandlerHelper.new
|
3178
|
+
end
|
3179
|
+
|
3180
|
+
def get_zcrmvariable(zcrm_variable_ins, variable_details)
|
3181
|
+
variable_details.each do |key, value|
|
3182
|
+
zcrm_variable_ins.id = value if (key == 'id') && !value.nil?
|
3183
|
+
if (key == 'variable_group') && !value.nil?
|
3184
|
+
zcrm_variable_ins.variable_group = Operations::ZCRMVariableGroup.get_instance(variable_details['variable_group']['api_name'], variable_details['variable_group']['id'])
|
3185
|
+
elsif (key == 'api_name') && !value.nil?
|
3186
|
+
zcrm_variable_ins.api_name = variable_details['api_name']
|
3187
|
+
elsif (key == 'name') && !value.nil?
|
3188
|
+
zcrm_variable_ins.name = variable_details['name']
|
3189
|
+
elsif (key == 'id') && !value.nil?
|
3190
|
+
zcrm_variable_ins.id = variable_details['id']
|
3191
|
+
elsif (key == 'type') && !value.nil?
|
3192
|
+
zcrm_variable_ins.type = variable_details['type']
|
3193
|
+
elsif (key == 'value') && !value.nil?
|
3194
|
+
zcrm_variable_ins.value = variable_details['value']
|
3195
|
+
elsif (key == 'description') && !value.nil?
|
3196
|
+
zcrm_variable_ins.description = variable_details['description']
|
3197
|
+
end
|
3198
|
+
end
|
3199
|
+
zcrm_variable_ins
|
3200
|
+
end
|
3201
|
+
|
3202
|
+
def get_zcrmvariable_as_json(zcrm_variable_ins)
|
3203
|
+
variable_json = {}
|
3204
|
+
variable_json['id'] = zcrm_variable_ins.id unless zcrm_variable_ins.id.nil?
|
3205
|
+
variable_json['name'] = zcrm_variable_ins.name unless zcrm_variable_ins.name.nil?
|
3206
|
+
variable_json['api_name'] = zcrm_variable_ins.api_name unless zcrm_variable_ins.api_name.nil?
|
3207
|
+
variable_json['type'] = zcrm_variable_ins.type unless zcrm_variable_ins.type.nil?
|
3208
|
+
variable_json['value'] = zcrm_variable_ins.value unless zcrm_variable_ins.value.nil?
|
3209
|
+
variable_json['description'] = zcrm_variable_ins.description unless zcrm_variable_ins.description.nil?
|
3210
|
+
unless zcrm_variable_ins.variable_group.nil?
|
3211
|
+
variable_group_json = {}
|
3212
|
+
variable_group_json['id'] = zcrm_variable_ins.variable_group.id unless zcrm_variable_ins.variable_group.nil? || zcrm_variable_ins.variable_group.id.nil?
|
3213
|
+
variable_group_json['api_name'] = zcrm_variable_ins.variable_group.id unless zcrm_variable_ins.variable_group.nil? || zcrm_variable_ins.variable_group.id.nil?
|
3214
|
+
variable_json['variable_group']= variable_group_json
|
3215
|
+
end
|
3216
|
+
variable_json
|
3217
|
+
end
|
3218
|
+
end
|
3219
|
+
|
3220
|
+
class VariableGroupAPIHandler < APIHandler
|
3221
|
+
def initialize(variable_group_ins = nil)
|
3222
|
+
@zcrmvariablegroup = variable_group_ins
|
3223
|
+
end
|
3224
|
+
|
3225
|
+
def self.get_instance(variable_group_ins = nil)
|
3226
|
+
VariableGroupAPIHandler.new(variable_group_ins)
|
3227
|
+
end
|
3228
|
+
|
3229
|
+
def get_variable_group
|
3230
|
+
if @zcrmvariablegroup.id.nil?
|
3231
|
+
raise Utility::ZCRMException.get_instance('get_variable', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'id should be set for the variable', 'ID IS NOT PROVIDED')
|
3232
|
+
end
|
3233
|
+
|
3234
|
+
handler_ins = APIHandler.get_instance
|
3235
|
+
handler_ins.request_url_path = ''
|
3236
|
+
handler_ins.request_url_path = 'settings/variable_groups/' + @zcrmvariablegroup.id.to_s
|
3237
|
+
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
3238
|
+
handler_ins.request_api_key = Utility::APIConstants::VARIABLE_GROUP
|
3239
|
+
api_response = Request::APIRequest.get_instance(handler_ins).get_api_response
|
3240
|
+
obj = VariableGroupAPIHandlerHelper.get_instance
|
3241
|
+
obj.get_zcrmvariablegroup(@zcrmvariablegroup, api_response.response_json.dig(Utility::APIConstants::VARIABLE_GROUP, 0))
|
3242
|
+
api_response.data = @zcrmvariablegroup
|
3243
|
+
api_response
|
3244
|
+
end
|
3245
|
+
|
3246
|
+
def get_variable_groups
|
3247
|
+
handler_ins = APIHandler.get_instance
|
3248
|
+
handler_ins.request_url_path = 'settings/variable_groups'
|
3249
|
+
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_GET
|
3250
|
+
handler_ins.request_api_key = ZCRMSDK::Utility::APIConstants::VARIABLE_GROUP
|
3251
|
+
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
3252
|
+
variable_groups_json = bulk_api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::VARIABLE_GROUP)
|
3253
|
+
variable_group_list = []
|
3254
|
+
variable_group_helper = VariableGroupAPIHandlerHelper.get_instance
|
3255
|
+
variable_groups_json.each do |variable_group_json|
|
3256
|
+
variable_group_ins = Operations::ZCRMVariableGroup.get_instance(variable_group_json['api_name'], variable_group_json['id'])
|
3257
|
+
variable_group_list.push(variable_group_helper.get_zcrmvariablegroup(variable_group_ins, variable_group_json))
|
3258
|
+
end
|
3259
|
+
bulk_api_response.data = variable_group_list
|
3260
|
+
bulk_api_response
|
3261
|
+
end
|
3262
|
+
end
|
3263
|
+
|
3264
|
+
class VariableGroupAPIHandlerHelper
|
3265
|
+
def initialize; end
|
3266
|
+
|
3267
|
+
def self.get_instance
|
3268
|
+
VariableGroupAPIHandlerHelper.new
|
3269
|
+
end
|
3270
|
+
|
3271
|
+
def get_zcrmvariablegroup(zcrm_variablegroup_ins, variable_group_details)
|
3272
|
+
variable_group_details.each do |key, value|
|
3273
|
+
zcrm_variablegroup_ins.id = value if (key == 'id') && !value.nil?
|
3274
|
+
if (key == 'api_name') && !value.nil?
|
3275
|
+
zcrm_variablegroup_ins.api_name = variable_group_details['api_name']
|
3276
|
+
elsif (key == 'name') && !value.nil?
|
3277
|
+
zcrm_variablegroup_ins.name = variable_group_details['name']
|
3278
|
+
elsif (key == 'id') && !value.nil?
|
3279
|
+
zcrm_variablegroup_ins.id = variable_group_details['id']
|
3280
|
+
elsif (key == 'display_label') && !value.nil?
|
3281
|
+
zcrm_variablegroup_ins.display_label = variable_group_details['display_label']
|
3282
|
+
elsif (key == 'description') && !value.nil?
|
3283
|
+
zcrm_variablegroup_ins.description = variable_group_details['description']
|
3284
|
+
end
|
3285
|
+
end
|
3286
|
+
zcrm_variablegroup_ins
|
3287
|
+
end
|
3288
|
+
end
|
3031
3289
|
end
|
3032
3290
|
end
|
data/lib/ZCRMSDK/operations.rb
CHANGED
@@ -1041,5 +1041,51 @@ module ZCRMSDK
|
|
1041
1041
|
ZCRMTrashRecord.new(module_api_name, entity_type, entity_id)
|
1042
1042
|
end
|
1043
1043
|
end
|
1044
|
+
class ZCRMVariable
|
1045
|
+
attr_accessor :id, :name, :api_name, :type, :value, :variable_group, :description
|
1046
|
+
def initialize(api_name =nil ,id = nil)
|
1047
|
+
@id = id
|
1048
|
+
@name = nil
|
1049
|
+
@api_name = api_name
|
1050
|
+
@type = nil
|
1051
|
+
@value = nil
|
1052
|
+
@variable_group = nil
|
1053
|
+
@description = nil
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
def self.get_instance(api_name=nil,id = nil)
|
1057
|
+
ZCRMVariable.new(api_name,id)
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
def get(group_id)
|
1061
|
+
Handler::VariableAPIHandler.get_instance(self).get_variable(group_id)
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
def update
|
1065
|
+
Handler::VariableAPIHandler.get_instance(self).update_variable
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
def delete
|
1069
|
+
Handler::VariableAPIHandler.get_instance(self).delete_variable
|
1070
|
+
end
|
1071
|
+
end
|
1072
|
+
class ZCRMVariableGroup
|
1073
|
+
attr_accessor :id, :name, :api_name,:display_label, :description
|
1074
|
+
def initialize(api_name=nil,id = nil)
|
1075
|
+
@id = id
|
1076
|
+
@name = nil
|
1077
|
+
@api_name = api_name
|
1078
|
+
@display_label = nil
|
1079
|
+
@description = nil
|
1080
|
+
end
|
1081
|
+
|
1082
|
+
def self.get_instance(api_name=nil,id = nil)
|
1083
|
+
ZCRMVariableGroup.new(api_name,id)
|
1084
|
+
end
|
1085
|
+
|
1086
|
+
def get
|
1087
|
+
Handler::VariableGroupAPIHandler.get_instance(self).get_variable_group
|
1088
|
+
end
|
1089
|
+
end
|
1044
1090
|
end
|
1045
1091
|
end
|
data/lib/ZCRMSDK/org.rb
CHANGED
@@ -157,6 +157,18 @@ module ZCRMSDK
|
|
157
157
|
def delete_notes(notes_ids)
|
158
158
|
Handler::OrganizationAPIHandler.get_instance.delete_notes(notes_ids)
|
159
159
|
end
|
160
|
+
def get_variable_groups
|
161
|
+
Handler::VariableGroupAPIHandler.get_instance.get_variable_groups
|
162
|
+
end
|
163
|
+
def get_variables
|
164
|
+
Handler::VariableAPIHandler.get_instance.get_variables
|
165
|
+
end
|
166
|
+
def create_variables(variable_instances)
|
167
|
+
Handler::VariableAPIHandler.get_instance.create_variables(variable_instances)
|
168
|
+
end
|
169
|
+
def update_variables(variable_instances)
|
170
|
+
Handler::VariableAPIHandler.get_instance.update_variables(variable_instances)
|
171
|
+
end
|
160
172
|
end
|
161
173
|
end
|
162
174
|
end
|
data/lib/ZCRMSDK/test.rb
CHANGED
@@ -14,6 +14,7 @@ require 'ZCRMSDK'
|
|
14
14
|
# THIS CLASS SHOWS THE EXAMPLES
|
15
15
|
class Tester
|
16
16
|
def initialize
|
17
|
+
|
17
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' }
|
18
19
|
ZCRMSDK::RestClient::ZCRMRestClient.init(config_details)
|
19
20
|
end
|
@@ -5432,7 +5433,7 @@ class Tester
|
|
5432
5433
|
end
|
5433
5434
|
def delete_notes
|
5434
5435
|
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5435
|
-
note_ids=['
|
5436
|
+
note_ids=['3524033000003454001','3524033000003454001']
|
5436
5437
|
res = org.delete_notes(note_ids).bulk_entity_response
|
5437
5438
|
res.each do |response|
|
5438
5439
|
print response.code
|
@@ -5442,6 +5443,168 @@ class Tester
|
|
5442
5443
|
print response.details
|
5443
5444
|
end
|
5444
5445
|
end
|
5446
|
+
|
5447
|
+
def get_variable
|
5448
|
+
variable_id='3524033000003052001'
|
5449
|
+
variable = ZCRMSDK::Operations::ZCRMVariable.get_instance(nil,variable_id)
|
5450
|
+
group_id = '3524033000000231001'
|
5451
|
+
variable_ins = variable.get(group_id).data
|
5452
|
+
print variable_ins.id
|
5453
|
+
print "\n"
|
5454
|
+
print variable_ins.api_name
|
5455
|
+
print "\n"
|
5456
|
+
print variable_ins.name
|
5457
|
+
print "\n"
|
5458
|
+
print variable_ins.description
|
5459
|
+
print "\n"
|
5460
|
+
print variable_ins.value
|
5461
|
+
print "\n"
|
5462
|
+
print variable_ins.type
|
5463
|
+
print "\n"
|
5464
|
+
print variable_ins.variable_group.id
|
5465
|
+
print "\n"
|
5466
|
+
print variable_ins.variable_group.api_name
|
5467
|
+
end
|
5468
|
+
|
5469
|
+
def update_variable
|
5470
|
+
variable_id='3524033000003209002'
|
5471
|
+
variable_api_name='updated'
|
5472
|
+
variable = ZCRMSDK::Operations::ZCRMVariable.get_instance(variable_api_name,variable_id)
|
5473
|
+
variable.name="updated"
|
5474
|
+
variable.description="updated"
|
5475
|
+
variable.value=4
|
5476
|
+
response = variable.update
|
5477
|
+
print "\n"
|
5478
|
+
print response.code
|
5479
|
+
print "\n"
|
5480
|
+
print response.message
|
5481
|
+
print "\n"
|
5482
|
+
print response.details
|
5483
|
+
end
|
5484
|
+
|
5485
|
+
def delete_variable
|
5486
|
+
variable_id='3524033000003076001'
|
5487
|
+
variable = ZCRMSDK::Operations::ZCRMVariable.get_instance(nil,variable_id)
|
5488
|
+
response = variable.delete
|
5489
|
+
print "\n"
|
5490
|
+
print response.code
|
5491
|
+
print "\n"
|
5492
|
+
print response.message
|
5493
|
+
print "\n"
|
5494
|
+
print response.details
|
5495
|
+
end
|
5496
|
+
|
5497
|
+
def get_variable_group
|
5498
|
+
variable_group_id='3524033000000231001'
|
5499
|
+
variable_group = ZCRMSDK::Operations::ZCRMVariableGroup.get_instance(nil,variable_group_id)
|
5500
|
+
variable_group_ins = variable_group.get.data
|
5501
|
+
print variable_group_ins.id
|
5502
|
+
print "\n"
|
5503
|
+
print variable_group_ins.api_name
|
5504
|
+
print "\n"
|
5505
|
+
print variable_group_ins.name
|
5506
|
+
print "\n"
|
5507
|
+
print variable_group_ins.description
|
5508
|
+
print "\n"
|
5509
|
+
print variable_group_ins.display_label
|
5510
|
+
end
|
5511
|
+
|
5512
|
+
def get_variable_groups
|
5513
|
+
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5514
|
+
api_res = org.get_variable_groups
|
5515
|
+
variable_groups = api_res.data
|
5516
|
+
variable_groups.each do |variable_group_ins|
|
5517
|
+
print variable_group_ins.id
|
5518
|
+
print "\n"
|
5519
|
+
print variable_group_ins.api_name
|
5520
|
+
print "\n"
|
5521
|
+
print variable_group_ins.name
|
5522
|
+
print "\n"
|
5523
|
+
print variable_group_ins.description
|
5524
|
+
print "\n"
|
5525
|
+
print variable_group_ins.display_label
|
5526
|
+
end
|
5527
|
+
end
|
5528
|
+
|
5529
|
+
def get_variables
|
5530
|
+
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5531
|
+
api_res = org.get_variables
|
5532
|
+
variables = api_res.data
|
5533
|
+
variables.each do |variable_ins|
|
5534
|
+
print "\n"
|
5535
|
+
print variable_ins.id
|
5536
|
+
print "\n"
|
5537
|
+
print variable_ins.api_name
|
5538
|
+
print "\n"
|
5539
|
+
print variable_ins.name
|
5540
|
+
print "\n"
|
5541
|
+
print variable_ins.description
|
5542
|
+
print "\n"
|
5543
|
+
print variable_ins.value
|
5544
|
+
print "\n"
|
5545
|
+
print variable_ins.type
|
5546
|
+
print "\n"
|
5547
|
+
print variable_ins.variable_group.id
|
5548
|
+
print "\n"
|
5549
|
+
print variable_ins.variable_group.api_name
|
5550
|
+
end
|
5551
|
+
end
|
5552
|
+
|
5553
|
+
def create_variables
|
5554
|
+
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5555
|
+
variables=[]
|
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
|
+
variable_ins1.type="integer"
|
5560
|
+
variable_ins1.variable_group=ZCRMSDK::Operations::ZCRMVariableGroup.get_instance("General","3524033000000231001")
|
5561
|
+
variable_ins1.value=23
|
5562
|
+
variables.push(variable_ins1)
|
5563
|
+
variable_ins2=ZCRMSDK::Operations::ZCRMVariable.get_instance("variable_api_name2",nil)
|
5564
|
+
variable_ins2.name="variable_api_name2"
|
5565
|
+
variable_ins2.description="variable_api_name2"
|
5566
|
+
variable_ins2.type="integer"
|
5567
|
+
variable_ins2.variable_group=ZCRMSDK::Operations::ZCRMVariableGroup.get_instance("General","3524033000000231001")
|
5568
|
+
variable_ins2.value=32
|
5569
|
+
variables.push(variable_ins2)
|
5570
|
+
res = org.create_variables(variables).bulk_entity_response
|
5571
|
+
res.each do |response|
|
5572
|
+
print "\n"
|
5573
|
+
print response.code
|
5574
|
+
print "\n"
|
5575
|
+
print response.message
|
5576
|
+
print "\n"
|
5577
|
+
print response.details
|
5578
|
+
end
|
5579
|
+
end
|
5580
|
+
|
5581
|
+
def update_variables
|
5582
|
+
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5583
|
+
variables=[]
|
5584
|
+
variable_ins1=ZCRMSDK::Operations::ZCRMVariable.get_instance("variable_api_name1","3524033000003461001")
|
5585
|
+
variable_ins1.name="variableasd_api_name1"
|
5586
|
+
variable_ins1.description="variabasde_api_name1"
|
5587
|
+
variable_ins1.type="integer"
|
5588
|
+
variable_ins1.variable_group=ZCRMSDK::Operations::ZCRMVariableGroup.get_instance("General","3524033000000231001")
|
5589
|
+
variable_ins1.value=23
|
5590
|
+
variables.push(variable_ins1)
|
5591
|
+
variable_ins2=ZCRMSDK::Operations::ZCRMVariable.get_instance("variable_api_name2","3524033000003461002")
|
5592
|
+
variable_ins2.name="variable_apiasd_name2"
|
5593
|
+
variable_ins2.description="variableasd_api_name2"
|
5594
|
+
variable_ins2.type="integer"
|
5595
|
+
variable_ins2.variable_group=ZCRMSDK::Operations::ZCRMVariableGroup.get_instance("General","3524033000000231001")
|
5596
|
+
variable_ins2.value=32
|
5597
|
+
variables.push(variable_ins2)
|
5598
|
+
res = org.update_variables(variables).bulk_entity_response
|
5599
|
+
res.each do |response|
|
5600
|
+
print "\n"
|
5601
|
+
print response.code
|
5602
|
+
print "\n"
|
5603
|
+
print response.message
|
5604
|
+
print "\n"
|
5605
|
+
print response.details
|
5606
|
+
end
|
5607
|
+
end
|
5445
5608
|
end
|
5446
5609
|
|
5447
5610
|
obj = Tester.new
|
@@ -5482,6 +5645,11 @@ obj = Tester.new
|
|
5482
5645
|
# obj.get_notes
|
5483
5646
|
# obj.create_notes
|
5484
5647
|
# obj.delete_notes
|
5648
|
+
# obj.get_variable_groups
|
5649
|
+
# obj.get_variables
|
5650
|
+
# obj.create_variables
|
5651
|
+
# obj.update_variables
|
5652
|
+
|
5485
5653
|
# ZCRMCustomView samples
|
5486
5654
|
|
5487
5655
|
# obj.get_records_from_custom_view
|
@@ -5555,6 +5723,16 @@ obj = Tester.new
|
|
5555
5723
|
# obj.get_attachments_from_note
|
5556
5724
|
# obj.delete_attachment_of_note
|
5557
5725
|
|
5726
|
+
#ZCRMVariable samples
|
5727
|
+
|
5728
|
+
# obj.get_variable
|
5729
|
+
# obj.delete_variable
|
5730
|
+
# obj.update_variable
|
5731
|
+
|
5732
|
+
#ZCRMVariableGroup samples
|
5733
|
+
|
5734
|
+
# obj.get_variable_group
|
5735
|
+
|
5558
5736
|
#OAuth token generation from grant token
|
5559
5737
|
|
5560
5738
|
#client = ZCRMSDK::OAuthClient::ZohoOAuth.get_client_instance
|
data/lib/ZCRMSDK/utility.rb
CHANGED
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: 0.0.
|
4
|
+
version: 0.0.4
|
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: 2019-10-
|
11
|
+
date: 2019-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|