ZCRMSDK 0.0.2 → 0.0.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.
- checksums.yaml +4 -4
- data/lib/ZCRMSDK/handler.rb +121 -33
- data/lib/ZCRMSDK/operations.rb +10 -8
- data/lib/ZCRMSDK/org.rb +29 -20
- data/lib/ZCRMSDK/test.rb +195 -25
- 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: c958933093a8ac8d8e4aae14b6d4cbbaea83f2966065cb90711ebe471f9fbfbd
|
4
|
+
data.tar.gz: c0fd94226dd808a95e0a3673fed9282ecb38cade8fd1d09775dddab9fe20ef87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3e6fc4698a5b0763ed2513ba74deb6f5b345f9113f0435deb7f5f6278d3d71e1c8266e35890e303618739a6fd7ef5d2416a210db9707a87eabdaa1a2dc78353
|
7
|
+
data.tar.gz: 7a3c2086aabb485b2dc68b733da0939d5e47af291f04d576c2adabb848e1995a4baf41f1ac55699b51eecc5a45a5f24b6666ba173f9f23fa52cce9cc7294fa26
|
data/lib/ZCRMSDK/handler.rb
CHANGED
@@ -1513,7 +1513,7 @@ module ZCRMSDK
|
|
1513
1513
|
def self.get_instance
|
1514
1514
|
OrganizationAPIHandler.new
|
1515
1515
|
end
|
1516
|
-
|
1516
|
+
|
1517
1517
|
def get_organization_details
|
1518
1518
|
handler_ins = APIHandler.get_instance
|
1519
1519
|
handler_ins.request_url_path = 'org'
|
@@ -1645,49 +1645,51 @@ module ZCRMSDK
|
|
1645
1645
|
api_response
|
1646
1646
|
end
|
1647
1647
|
|
1648
|
-
def get_all_users
|
1649
|
-
get_users
|
1648
|
+
def get_all_users(page,per_page)
|
1649
|
+
get_users('AllUsers',page,per_page)
|
1650
1650
|
end
|
1651
1651
|
|
1652
|
-
def get_all_deactive_users
|
1653
|
-
get_users('DeactiveUsers')
|
1652
|
+
def get_all_deactive_users(page,per_page)
|
1653
|
+
get_users('DeactiveUsers',page,per_page)
|
1654
1654
|
end
|
1655
1655
|
|
1656
|
-
def get_all_active_users
|
1657
|
-
get_users('ActiveUsers')
|
1656
|
+
def get_all_active_users(page,per_page)
|
1657
|
+
get_users('ActiveUsers',page,per_page)
|
1658
1658
|
end
|
1659
1659
|
|
1660
|
-
def get_all_confirmed_users
|
1661
|
-
get_users('ConfirmedUsers')
|
1660
|
+
def get_all_confirmed_users(page,per_page)
|
1661
|
+
get_users('ConfirmedUsers',page,per_page)
|
1662
1662
|
end
|
1663
1663
|
|
1664
|
-
def get_all_not_confirmed_users
|
1665
|
-
get_users('NotConfirmedUsers')
|
1664
|
+
def get_all_not_confirmed_users(page,per_page)
|
1665
|
+
get_users('NotConfirmedUsers',page,per_page)
|
1666
1666
|
end
|
1667
1667
|
|
1668
|
-
def get_all_deleted_users
|
1669
|
-
get_users('DeletedUsers')
|
1668
|
+
def get_all_deleted_users(page,per_page)
|
1669
|
+
get_users('DeletedUsers',page,per_page)
|
1670
1670
|
end
|
1671
1671
|
|
1672
|
-
def get_all_active_confirmed_users
|
1673
|
-
get_users('ActiveConfirmedUsers')
|
1672
|
+
def get_all_active_confirmed_users(page,per_page)
|
1673
|
+
get_users('ActiveConfirmedUsers',page,per_page)
|
1674
1674
|
end
|
1675
1675
|
|
1676
|
-
def get_all_admin_users
|
1677
|
-
get_users('AdminUsers')
|
1676
|
+
def get_all_admin_users(page,per_page)
|
1677
|
+
get_users('AdminUsers',page,per_page)
|
1678
1678
|
end
|
1679
1679
|
|
1680
|
-
def get_all_active_confirmed_admin_users
|
1681
|
-
get_users('ActiveConfirmedAdmins')
|
1680
|
+
def get_all_active_confirmed_admin_users(page,per_page)
|
1681
|
+
get_users('ActiveConfirmedAdmins',page,per_page)
|
1682
1682
|
end
|
1683
1683
|
|
1684
|
-
def get_current_user
|
1685
|
-
get_users('CurrentUser')
|
1684
|
+
def get_current_user(page,per_page)
|
1685
|
+
get_users('CurrentUser',page,per_page)
|
1686
1686
|
end
|
1687
1687
|
|
1688
|
-
def get_users(user_type = nil)
|
1688
|
+
def get_users(user_type = nil,page=1,per_page=200)
|
1689
1689
|
handler_ins = APIHandler.get_instance
|
1690
1690
|
handler_ins.add_param('type', user_type) unless user_type.nil?
|
1691
|
+
handler_ins.add_param('page', page)
|
1692
|
+
handler_ins.add_param('per_page', per_page)
|
1691
1693
|
handler_ins.request_url_path = 'users'
|
1692
1694
|
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1693
1695
|
handler_ins.request_api_key = Utility::APIConstants::USERS
|
@@ -1702,7 +1704,7 @@ module ZCRMSDK
|
|
1702
1704
|
bulk_api_response
|
1703
1705
|
end
|
1704
1706
|
|
1705
|
-
def search_users_by_criteria(criteria, type)
|
1707
|
+
def search_users_by_criteria(criteria, type,page,per_page)
|
1706
1708
|
if criteria.nil?
|
1707
1709
|
raise Utility::ZCRMException.get_instance('search_users_by_criteria', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'criteria must be provided', 'NO CRITERIA PROVIDED')
|
1708
1710
|
end
|
@@ -1713,6 +1715,8 @@ module ZCRMSDK
|
|
1713
1715
|
handler_ins.request_api_key = Utility::APIConstants::USERS
|
1714
1716
|
handler_ins.add_param('criteria', criteria)
|
1715
1717
|
handler_ins.add_param('type', type) unless type.nil?
|
1718
|
+
handler_ins.add_param('page', page)
|
1719
|
+
handler_ins.add_param('per_page', per_page)
|
1716
1720
|
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1717
1721
|
users_json = bulk_api_response.response_json[Utility::APIConstants::USERS]
|
1718
1722
|
user_instances = []
|
@@ -1848,6 +1852,77 @@ module ZCRMSDK
|
|
1848
1852
|
api_response.data = org_api_helper.get_zcrm_org_tax_instance(api_response.response_json[Utility::APIConstants::TAXES][0])
|
1849
1853
|
api_response
|
1850
1854
|
end
|
1855
|
+
def get_notes(sort_by, sort_order, page, per_page)
|
1856
|
+
handler_ins = APIHandler.get_instance
|
1857
|
+
handler_ins.request_url_path = 'Notes'
|
1858
|
+
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_GET
|
1859
|
+
handler_ins.request_api_key = Utility::APIConstants::DATA
|
1860
|
+
handler_ins.add_param('page', page)
|
1861
|
+
handler_ins.add_param('per_page', per_page)
|
1862
|
+
handler_ins.add_param('sort_by', sort_by)unless sort_by.nil?
|
1863
|
+
handler_ins.add_param('sort_order', sort_order)unless sort_order.nil?
|
1864
|
+
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1865
|
+
notes_json = bulk_api_response.response_json.dig(ZCRMSDK::Utility::APIConstants::DATA)
|
1866
|
+
notes_list = []
|
1867
|
+
notes_helper = RelatedListAPIHandlerHelper.get_instance
|
1868
|
+
notes_json.each do |note_json|
|
1869
|
+
record_ins=Operations::ZCRMRecord.get_instance(note_json['$se_module'], note_json['Parent_Id']['id'])
|
1870
|
+
note_ins = Operations::ZCRMNote.get_instance(record_ins,note_json['id'])
|
1871
|
+
notes_list.push(notes_helper.get_zcrm_note(note_json,note_ins))
|
1872
|
+
end
|
1873
|
+
bulk_api_response.data = notes_list
|
1874
|
+
bulk_api_response
|
1875
|
+
end
|
1876
|
+
def create_notes(note_instances)
|
1877
|
+
if note_instances.length > 100
|
1878
|
+
raise Utility::ZCRMException.get_instance('create_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note count must be less than or equals to 100', 'MORE NOTES PROVIDED')
|
1879
|
+
end
|
1880
|
+
|
1881
|
+
if note_instances.length < 1
|
1882
|
+
raise Utility::ZCRMException.get_instance('create_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note count must be at least 1', 'NO NOTES PROVIDED')
|
1883
|
+
end
|
1884
|
+
|
1885
|
+
handler_ins = APIHandler.get_instance
|
1886
|
+
handler_ins.request_url_path = 'Notes'
|
1887
|
+
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_POST
|
1888
|
+
handler_ins.request_api_key = Utility::APIConstants::DATA
|
1889
|
+
notes_api_helper = RelatedListAPIHandlerHelper.get_instance
|
1890
|
+
data_array = []
|
1891
|
+
note_instances.each do |note_instance|
|
1892
|
+
if note_instance.id.nil?
|
1893
|
+
data_array.push(notes_api_helper.get_zcrmnote_as_json(note_instance))
|
1894
|
+
else
|
1895
|
+
raise Utility::ZCRMException.get_instance('notes_Create', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note id must be nil', 'NOTE ID PROVIDED')
|
1896
|
+
end
|
1897
|
+
end
|
1898
|
+
request_json = {}
|
1899
|
+
request_json[Utility::APIConstants::DATA] = data_array
|
1900
|
+
handler_ins.request_body = request_json
|
1901
|
+
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1902
|
+
bulk_api_response
|
1903
|
+
end
|
1904
|
+
def delete_notes(note_ids)
|
1905
|
+
if note_ids.length > 100
|
1906
|
+
raise Utility::ZCRMException.get_instance('delete_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'notes count must be less than or equals to 100', 'MORE NOTES PROVIDED')
|
1907
|
+
end
|
1908
|
+
|
1909
|
+
if note_ids.length < 1
|
1910
|
+
raise Utility::ZCRMException.get_instance('delete_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'notes count must be at least 1', 'NO NOTES PROVIDED')
|
1911
|
+
end
|
1912
|
+
|
1913
|
+
handler_ins = APIHandler.get_instance
|
1914
|
+
handler_ins.request_url_path = 'Notes'
|
1915
|
+
handler_ins.request_method = Utility::APIConstants::REQUEST_METHOD_DELETE
|
1916
|
+
handler_ins.request_api_key = Utility::APIConstants::DATA
|
1917
|
+
ids_as_string = ''
|
1918
|
+
note_ids.each do |note_id|
|
1919
|
+
ids_as_string += note_id.to_s + ','
|
1920
|
+
end
|
1921
|
+
|
1922
|
+
handler_ins.add_param('ids', ids_as_string)
|
1923
|
+
bulk_api_response = Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
1924
|
+
bulk_api_response
|
1925
|
+
end
|
1851
1926
|
end
|
1852
1927
|
# THIS CLASS SERVES THE OrganizationAPIHandler CLASS CONSTRUCTING JSON BODY AND INSTANCES
|
1853
1928
|
class OrganizationAPIHandlerHelper
|
@@ -2700,9 +2775,13 @@ module ZCRMSDK
|
|
2700
2775
|
api_response
|
2701
2776
|
end
|
2702
2777
|
|
2703
|
-
def
|
2704
|
-
if
|
2705
|
-
raise Utility::ZCRMException.get_instance('
|
2778
|
+
def add_notes(note_instances)
|
2779
|
+
if note_instances.length > 100
|
2780
|
+
raise Utility::ZCRMException.get_instance('create_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note count must be less than or equals to 100', 'MORE NOTES PROVIDED')
|
2781
|
+
end
|
2782
|
+
|
2783
|
+
if note_instances.length < 1
|
2784
|
+
raise Utility::ZCRMException.get_instance('create_notes', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note count must be at least 1', 'NO NOTES PROVIDED')
|
2706
2785
|
end
|
2707
2786
|
|
2708
2787
|
handler_ins = APIHandler.get_instance
|
@@ -2710,13 +2789,20 @@ module ZCRMSDK
|
|
2710
2789
|
handler_ins.request_method = ZCRMSDK::Utility::APIConstants::REQUEST_METHOD_POST
|
2711
2790
|
handler_ins.request_url_path = @parentrecord.module_api_name + '/' + @parentrecord.entity_id + '/' + @related_list.api_name
|
2712
2791
|
handler_ins.request_api_key = Utility::APIConstants::DATA
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2792
|
+
notes_api_helper = RelatedListAPIHandlerHelper.get_instance
|
2793
|
+
data_array = []
|
2794
|
+
note_instances.each do |note_instance|
|
2795
|
+
if note_instance.id.nil?
|
2796
|
+
data_array.push(notes_api_helper.get_zcrmnote_as_json(note_instance))
|
2797
|
+
else
|
2798
|
+
raise Utility::ZCRMException.get_instance('notes_Create', Utility::APIConstants::RESPONSECODE_BAD_REQUEST, 'note id must be nil', 'NOTE ID PROVIDED')
|
2799
|
+
end
|
2800
|
+
end
|
2801
|
+
request_json = {}
|
2802
|
+
request_json[Utility::APIConstants::DATA] = data_array
|
2803
|
+
handler_ins.request_body = request_json
|
2804
|
+
bulk_api_response = ZCRMSDK::Request::APIRequest.get_instance(handler_ins).get_bulk_api_response
|
2805
|
+
bulk_api_response
|
2720
2806
|
end
|
2721
2807
|
|
2722
2808
|
def update_note(note_ins)
|
@@ -2806,6 +2892,8 @@ module ZCRMSDK
|
|
2806
2892
|
note = {}
|
2807
2893
|
note['Note_Title'] = note_ins.title unless note_ins.title.nil?
|
2808
2894
|
note['Note_Content'] = note_ins.content
|
2895
|
+
note['Parent_Id'] = note_ins.parent_id unless note_ins.parent_id.nil?
|
2896
|
+
note['se_module'] = note_ins.parent_module unless note_ins.parent_module.nil?
|
2809
2897
|
note
|
2810
2898
|
end
|
2811
2899
|
|
data/lib/ZCRMSDK/operations.rb
CHANGED
@@ -309,8 +309,8 @@ module ZCRMSDK
|
|
309
309
|
ZCRMModuleRelation.get_instance(self, junction_record).remove_relation
|
310
310
|
end
|
311
311
|
|
312
|
-
def
|
313
|
-
ZCRMModuleRelation.get_instance(self, 'Notes').
|
312
|
+
def add_notes(note_instances)
|
313
|
+
ZCRMModuleRelation.get_instance(self, 'Notes').add_notes(note_instances)
|
314
314
|
end
|
315
315
|
|
316
316
|
def update_note(note_ins)
|
@@ -824,8 +824,8 @@ module ZCRMSDK
|
|
824
824
|
Handler::RelatedListAPIHandler.get_instance(@parent_record, @junction_record).remove_relation
|
825
825
|
end
|
826
826
|
|
827
|
-
def
|
828
|
-
Handler::RelatedListAPIHandler.get_instance(@parent_record, self).
|
827
|
+
def add_notes(zcrm_note_instances)
|
828
|
+
Handler::RelatedListAPIHandler.get_instance(@parent_record, self).add_notes(zcrm_note_instances)
|
829
829
|
end
|
830
830
|
|
831
831
|
def update_note(zcrm_note_ins)
|
@@ -836,7 +836,7 @@ module ZCRMSDK
|
|
836
836
|
Handler::RelatedListAPIHandler.get_instance(@parent_record, self).delete_note(zcrm_note_ins)
|
837
837
|
end
|
838
838
|
|
839
|
-
def get_notes(sort_by = nil, sort_order = nil, page = 1, per_page =
|
839
|
+
def get_notes(sort_by = nil, sort_order = nil, page = 1, per_page = 200)
|
840
840
|
Handler::RelatedListAPIHandler.get_instance(@parent_record, self).get_notes(sort_by, sort_order, page, per_page)
|
841
841
|
end
|
842
842
|
|
@@ -860,9 +860,11 @@ module ZCRMSDK
|
|
860
860
|
@attachments = nil
|
861
861
|
@size = nil
|
862
862
|
@is_voice_note = nil
|
863
|
-
|
863
|
+
unless parent_record.nil?
|
864
|
+
@parent_module = parent_record.module_api_name
|
865
|
+
@parent_id = parent_record.entity_id
|
866
|
+
end
|
864
867
|
@parent_name = nil
|
865
|
-
@parent_id = nil
|
866
868
|
@is_editable = nil
|
867
869
|
end
|
868
870
|
|
@@ -883,7 +885,7 @@ module ZCRMSDK
|
|
883
885
|
end
|
884
886
|
|
885
887
|
def self.get_instance(parent_record = nil, note_id = nil)
|
886
|
-
ZCRMNote.new(parent_record
|
888
|
+
ZCRMNote.new(parent_record , note_id)
|
887
889
|
end
|
888
890
|
end
|
889
891
|
# THIS CLASS IS USED TO STORE PROFILE PERMISSIONS RELATED DATA
|
data/lib/ZCRMSDK/org.rb
CHANGED
@@ -57,40 +57,40 @@ module ZCRMSDK
|
|
57
57
|
Handler::OrganizationAPIHandler.get_instance.get_current_user
|
58
58
|
end
|
59
59
|
|
60
|
-
def get_all_users
|
61
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_users
|
60
|
+
def get_all_users(page=1,per_page=200)
|
61
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_users(page,per_page)
|
62
62
|
end
|
63
63
|
|
64
|
-
def get_all_active_users
|
65
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_active_users
|
64
|
+
def get_all_active_users(page=1,per_page=200)
|
65
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_active_users(page,per_page)
|
66
66
|
end
|
67
67
|
|
68
|
-
def get_all_deactive_users
|
69
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_deactive_users
|
68
|
+
def get_all_deactive_users(page=1,per_page=200)
|
69
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_deactive_users(page,per_page)
|
70
70
|
end
|
71
71
|
|
72
|
-
def get_all_confirmed_users
|
73
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_confirmed_users
|
72
|
+
def get_all_confirmed_users(page=1,per_page=200)
|
73
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_confirmed_users(page,per_page)
|
74
74
|
end
|
75
75
|
|
76
|
-
def get_all_not_confirmed_users
|
77
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_not_confirmed_users
|
76
|
+
def get_all_not_confirmed_users(page=1,per_page=200)
|
77
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_not_confirmed_users(page,per_page)
|
78
78
|
end
|
79
79
|
|
80
|
-
def get_all_deleted_users
|
81
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_deleted_users
|
80
|
+
def get_all_deleted_users(page=1,per_page=200)
|
81
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_deleted_users(page,per_page)
|
82
82
|
end
|
83
83
|
|
84
|
-
def get_all_active_confirmed_users
|
85
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_active_confirmed_users
|
84
|
+
def get_all_active_confirmed_users(page=1,per_page=200)
|
85
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_active_confirmed_users(page,per_page)
|
86
86
|
end
|
87
87
|
|
88
|
-
def get_all_admin_users
|
89
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_admin_users
|
88
|
+
def get_all_admin_users(page=1,per_page=200)
|
89
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_admin_users(page,per_page)
|
90
90
|
end
|
91
91
|
|
92
|
-
def get_all_active_confirmed_admin_users
|
93
|
-
Handler::OrganizationAPIHandler.get_instance.get_all_active_confirmed_admin_users
|
92
|
+
def get_all_active_confirmed_admin_users(page=1,per_page=200)
|
93
|
+
Handler::OrganizationAPIHandler.get_instance.get_all_active_confirmed_admin_users(page,per_page)
|
94
94
|
end
|
95
95
|
|
96
96
|
def get_all_profiles
|
@@ -129,8 +129,8 @@ module ZCRMSDK
|
|
129
129
|
Handler::OrganizationAPIHandler.get_instance.get_organization_tax(org_tax_id)
|
130
130
|
end
|
131
131
|
|
132
|
-
def search_users_by_criteria(criteria, type = nil)
|
133
|
-
Handler::OrganizationAPIHandler.get_instance.search_users_by_criteria(criteria, type)
|
132
|
+
def search_users_by_criteria(criteria, type = nil,page=1,per_page=200)
|
133
|
+
Handler::OrganizationAPIHandler.get_instance.search_users_by_criteria(criteria, type,page,per_page)
|
134
134
|
end
|
135
135
|
|
136
136
|
def create_organization_taxes(orgtax_instances)
|
@@ -148,6 +148,15 @@ module ZCRMSDK
|
|
148
148
|
def delete_organization_tax(orgtax_id)
|
149
149
|
Handler::OrganizationAPIHandler.get_instance.delete_organization_tax(orgtax_id)
|
150
150
|
end
|
151
|
+
def get_notes(sort_by=nil,sort_order=nil,page=1,per_page=200)
|
152
|
+
Handler::OrganizationAPIHandler.get_instance.get_notes(sort_by,sort_order,page,per_page)
|
153
|
+
end
|
154
|
+
def create_notes(notes_instances)
|
155
|
+
Handler::OrganizationAPIHandler.get_instance.create_notes(notes_instances)
|
156
|
+
end
|
157
|
+
def delete_notes(notes_ids)
|
158
|
+
Handler::OrganizationAPIHandler.get_instance.delete_notes(notes_ids)
|
159
|
+
end
|
151
160
|
end
|
152
161
|
end
|
153
162
|
end
|
data/lib/ZCRMSDK/test.rb
CHANGED
@@ -1,9 +1,20 @@
|
|
1
|
-
#
|
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'
|
2
13
|
require 'ZCRMSDK'
|
3
14
|
# THIS CLASS SHOWS THE EXAMPLES
|
4
|
-
class
|
15
|
+
class Tester
|
5
16
|
def initialize
|
6
|
-
config_details = { 'client_id' => 'client_id', 'client_secret' => 'client_secret', 'redirect_uri' => 'redirect_uri', 'api_base_url' => '
|
17
|
+
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' }
|
7
18
|
ZCRMSDK::RestClient::ZCRMRestClient.init(config_details)
|
8
19
|
end
|
9
20
|
|
@@ -668,7 +679,9 @@ class Test
|
|
668
679
|
|
669
680
|
def get_all_user
|
670
681
|
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
671
|
-
|
682
|
+
page=1
|
683
|
+
per_page=4
|
684
|
+
api_res = org.get_all_users(page,per_page)
|
672
685
|
users = api_res.data
|
673
686
|
users.each do |user_instance|
|
674
687
|
print user_instance.id
|
@@ -815,7 +828,7 @@ class Test
|
|
815
828
|
|
816
829
|
def get_all_active_users
|
817
830
|
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
818
|
-
api_res = org.get_all_active_users
|
831
|
+
api_res = org.get_all_active_users(1,2)
|
819
832
|
users = api_res.data
|
820
833
|
users.each do |user_instance|
|
821
834
|
print user_instance.id
|
@@ -3481,8 +3494,8 @@ class Test
|
|
3481
3494
|
end
|
3482
3495
|
|
3483
3496
|
def get_record
|
3484
|
-
module_api_name = '
|
3485
|
-
entity_id = '
|
3497
|
+
module_api_name = 'Accounts'
|
3498
|
+
entity_id = '3524033000003350015'
|
3486
3499
|
module_instance = ZCRMSDK::Operations::ZCRMModule.get_instance(module_api_name)
|
3487
3500
|
api_res = module_instance.get_record(entity_id)
|
3488
3501
|
record = api_res.data
|
@@ -4981,19 +4994,28 @@ class Test
|
|
4981
4994
|
print res.details
|
4982
4995
|
end
|
4983
4996
|
|
4984
|
-
def
|
4985
|
-
module_api_name = '
|
4986
|
-
record_id = '
|
4997
|
+
def add_notes
|
4998
|
+
module_api_name = 'Accounts'
|
4999
|
+
record_id = '3524033000003350015'
|
5000
|
+
notes=[]
|
4987
5001
|
record = ZCRMSDK::Operations::ZCRMRecord.get_instance(module_api_name, record_id)
|
4988
5002
|
note = ZCRMSDK::Operations::ZCRMNote.get_instance(record, nil)
|
4989
5003
|
note.title = 'Adssadasdasd'
|
4990
5004
|
note.content = 'Adssadasdasd'
|
4991
|
-
|
4992
|
-
|
4993
|
-
|
4994
|
-
|
4995
|
-
|
4996
|
-
|
5005
|
+
notes.push(note)
|
5006
|
+
note1 = ZCRMSDK::Operations::ZCRMNote.get_instance(record, nil)
|
5007
|
+
note1.title = 'Adssadasdasd'
|
5008
|
+
note1.content = 'Adssadasdasd'
|
5009
|
+
notes.push(note1)
|
5010
|
+
res = record.add_notes(notes).bulk_entity_response
|
5011
|
+
res.each do |response|
|
5012
|
+
print "\n"
|
5013
|
+
print response.code
|
5014
|
+
print "\n"
|
5015
|
+
print response.message
|
5016
|
+
print "\n"
|
5017
|
+
print response.details
|
5018
|
+
end
|
4997
5019
|
end
|
4998
5020
|
|
4999
5021
|
def update_note
|
@@ -5012,7 +5034,7 @@ class Test
|
|
5012
5034
|
print res.details
|
5013
5035
|
end
|
5014
5036
|
|
5015
|
-
def delete_note
|
5037
|
+
def delete_note
|
5016
5038
|
module_api_name = 'module_api_name'
|
5017
5039
|
record_id = 'record_id'
|
5018
5040
|
note_id = 'note_id'
|
@@ -5026,11 +5048,15 @@ class Test
|
|
5026
5048
|
print res.details
|
5027
5049
|
end
|
5028
5050
|
|
5029
|
-
def
|
5030
|
-
module_api_name = '
|
5031
|
-
record_id = '
|
5051
|
+
def get_notes_from_record
|
5052
|
+
module_api_name = 'accounts'
|
5053
|
+
record_id = '3524033000003350015'
|
5032
5054
|
record = ZCRMSDK::Operations::ZCRMRecord.get_instance(module_api_name, record_id)
|
5033
|
-
|
5055
|
+
page=1
|
5056
|
+
per_page=3
|
5057
|
+
sort_by='Note_Content'
|
5058
|
+
sort_order='asc'
|
5059
|
+
res = record.get_notes(sort_by, sort_order, page, per_page)
|
5034
5060
|
notes = res.data
|
5035
5061
|
notes.each do |zcrmnote_ins|
|
5036
5062
|
print zcrmnote_ins.id
|
@@ -5274,6 +5300,148 @@ class Test
|
|
5274
5300
|
note = ZCRMSDK::Operations::ZCRMNote.get_instance(record_ins, note_id) #record_ins - is not mandatory
|
5275
5301
|
note_delete_attachment_res = note.download_attachment(note_attachment_id)
|
5276
5302
|
end
|
5303
|
+
def get_notes
|
5304
|
+
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5305
|
+
page=1
|
5306
|
+
per_page=2
|
5307
|
+
sort_by='Note_Content'
|
5308
|
+
sort_order='asc'
|
5309
|
+
api_res = org.get_notes(sort_by,sort_order,page,per_page)
|
5310
|
+
notes = api_res.data
|
5311
|
+
notes.each do |zcrmnote_ins|
|
5312
|
+
print zcrmnote_ins.id
|
5313
|
+
print "\n"
|
5314
|
+
print zcrmnote_ins.title
|
5315
|
+
print "\n"
|
5316
|
+
print zcrmnote_ins.content
|
5317
|
+
owner = zcrmnote_ins.owner
|
5318
|
+
unless owner.nil?
|
5319
|
+
print "\n"
|
5320
|
+
print owner.id
|
5321
|
+
print "\n"
|
5322
|
+
print owner.name
|
5323
|
+
end
|
5324
|
+
created_by = zcrmnote_ins.created_by
|
5325
|
+
unless created_by.nil?
|
5326
|
+
print "\n"
|
5327
|
+
print created_by.id
|
5328
|
+
print "\n"
|
5329
|
+
print created_by.name
|
5330
|
+
end
|
5331
|
+
modified_by = zcrmnote_ins.modified_by
|
5332
|
+
unless modified_by.nil?
|
5333
|
+
print "\n"
|
5334
|
+
print modified_by.id
|
5335
|
+
print "\n"
|
5336
|
+
print modified_by.name
|
5337
|
+
end
|
5338
|
+
print "\n"
|
5339
|
+
print zcrmnote_ins.created_time
|
5340
|
+
print "\n"
|
5341
|
+
print zcrmnote_ins.modified_time
|
5342
|
+
print "\n"
|
5343
|
+
print zcrmnote_ins.is_voice_note
|
5344
|
+
print "\n"
|
5345
|
+
print zcrmnote_ins.parent_module
|
5346
|
+
print "\n"
|
5347
|
+
print zcrmnote_ins.parent_id
|
5348
|
+
print "\n"
|
5349
|
+
print zcrmnote_ins.parent_name
|
5350
|
+
print "\n"
|
5351
|
+
print zcrmnote_ins.size
|
5352
|
+
print "\n"
|
5353
|
+
print zcrmnote_ins.is_editable
|
5354
|
+
print "\n"
|
5355
|
+
attachments = zcrmnote_ins.attachments
|
5356
|
+
next if attachments.nil?
|
5357
|
+
|
5358
|
+
attachments.each do |zcrmattachment_ins|
|
5359
|
+
print zcrmattachment_ins.id
|
5360
|
+
print "\n"
|
5361
|
+
print zcrmattachment_ins.file_name
|
5362
|
+
print "\n"
|
5363
|
+
print zcrmattachment_ins.type
|
5364
|
+
owner = zcrmattachment_ins.owner
|
5365
|
+
unless owner.nil?
|
5366
|
+
print "\n"
|
5367
|
+
print owner.id
|
5368
|
+
print "\n"
|
5369
|
+
print owner.name
|
5370
|
+
end
|
5371
|
+
created_by = zcrmattachment_ins.created_by
|
5372
|
+
unless created_by.nil?
|
5373
|
+
print "\n"
|
5374
|
+
print created_by.id
|
5375
|
+
print "\n"
|
5376
|
+
print created_by.name
|
5377
|
+
end
|
5378
|
+
modified_by = zcrmattachment_ins.modified_by
|
5379
|
+
unless modified_by.nil?
|
5380
|
+
print "\n"
|
5381
|
+
print modified_by.id
|
5382
|
+
print "\n"
|
5383
|
+
print modified_by.name
|
5384
|
+
end
|
5385
|
+
print "\n"
|
5386
|
+
print zcrmattachment_ins.created_time
|
5387
|
+
print "\n"
|
5388
|
+
print zcrmattachment_ins.file_id
|
5389
|
+
print "\n"
|
5390
|
+
print zcrmattachment_ins.modified_time
|
5391
|
+
print "\n"
|
5392
|
+
print zcrmattachment_ins.attachment_type
|
5393
|
+
print "\n"
|
5394
|
+
print zcrmattachment_ins.parent_module
|
5395
|
+
print "\n"
|
5396
|
+
print zcrmattachment_ins.parent_id
|
5397
|
+
print "\n"
|
5398
|
+
print zcrmattachment_ins.parent_name
|
5399
|
+
print "\n"
|
5400
|
+
print zcrmattachment_ins.size
|
5401
|
+
print "\n"
|
5402
|
+
print zcrmattachment_ins.is_editable
|
5403
|
+
print "\n"
|
5404
|
+
print zcrmattachment_ins.link_url
|
5405
|
+
print "\n"
|
5406
|
+
end
|
5407
|
+
end
|
5408
|
+
end
|
5409
|
+
def create_notes
|
5410
|
+
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5411
|
+
notes=[]
|
5412
|
+
module_api_name = 'Accounts'
|
5413
|
+
record_id = '3524033000003350015'
|
5414
|
+
record = ZCRMSDK::Operations::ZCRMRecord.get_instance(module_api_name, record_id)
|
5415
|
+
note = ZCRMSDK::Operations::ZCRMNote.get_instance(record, nil)
|
5416
|
+
note.title = 'Adssadasdasd'
|
5417
|
+
note.content = 'Adssadasdasd'
|
5418
|
+
notes.push(note)
|
5419
|
+
note1 = ZCRMSDK::Operations::ZCRMNote.get_instance(record, nil)
|
5420
|
+
note1.title = 'Adssadasdasd'
|
5421
|
+
note1.content = 'Adssadasdasd'
|
5422
|
+
notes.push(note1)
|
5423
|
+
res = org.create_notes(notes).bulk_entity_response
|
5424
|
+
res.each do |response|
|
5425
|
+
print "\n"
|
5426
|
+
print response.code
|
5427
|
+
print "\n"
|
5428
|
+
print response.message
|
5429
|
+
print "\n"
|
5430
|
+
print response.details
|
5431
|
+
end
|
5432
|
+
end
|
5433
|
+
def delete_notes
|
5434
|
+
org = ZCRMSDK::Org::ZCRMOrganization.get_instance
|
5435
|
+
note_ids=['3524033000003437005','3524033000003437006']
|
5436
|
+
res = org.delete_notes(note_ids).bulk_entity_response
|
5437
|
+
res.each do |response|
|
5438
|
+
print response.code
|
5439
|
+
print "\n"
|
5440
|
+
print response.message
|
5441
|
+
print "\n"
|
5442
|
+
print response.details
|
5443
|
+
end
|
5444
|
+
end
|
5277
5445
|
end
|
5278
5446
|
|
5279
5447
|
obj = Tester.new
|
@@ -5311,7 +5479,9 @@ obj = Tester.new
|
|
5311
5479
|
# obj.delete_organization_taxes
|
5312
5480
|
# obj.delete_organization_tax
|
5313
5481
|
# obj.search_user_by_criteria
|
5314
|
-
|
5482
|
+
# obj.get_notes
|
5483
|
+
# obj.create_notes
|
5484
|
+
# obj.delete_notes
|
5315
5485
|
# ZCRMCustomView samples
|
5316
5486
|
|
5317
5487
|
# obj.get_records_from_custom_view
|
@@ -5363,10 +5533,10 @@ obj = Tester.new
|
|
5363
5533
|
# obj.delete_photo
|
5364
5534
|
# obj.add_relation
|
5365
5535
|
# obj.remove_relation
|
5366
|
-
# obj.
|
5536
|
+
# obj.add_notes
|
5367
5537
|
# obj.update_note
|
5368
5538
|
# obj.delete_note
|
5369
|
-
# obj.
|
5539
|
+
# obj.get_notes_from_record
|
5370
5540
|
# obj.get_attachments
|
5371
5541
|
# obj.get_relatedlist_records
|
5372
5542
|
# obj.add_tags
|
@@ -5395,6 +5565,6 @@ obj = Tester.new
|
|
5395
5565
|
|
5396
5566
|
#client = ZCRMSDK::OAuthClient::ZohoOAuth.get_client_instance
|
5397
5567
|
#refresh_token = 'refresh_token'
|
5398
|
-
#client.generate_access_token_from_refresh_token(refresh_token)
|
5568
|
+
#client.generate_access_token_from_refresh_token(refresh_token,useridentifier)
|
5399
5569
|
|
5400
5570
|
|
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.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: 2019-10-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|