zen_freshdesk 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2462d6ca9d89272f1ad3ab52a2ec87c2fcf6ed5
4
- data.tar.gz: 85ffc063a62db91ffeb28cb3e2c396252d2b150d
3
+ metadata.gz: 92afde6988d878206ec64481062db30049e59884
4
+ data.tar.gz: 2be16a604d7197e8bc37d197d05691ad89f20965
5
5
  SHA512:
6
- metadata.gz: 23b5ce1840ba14bcbfff499a419179faf02cf3433dceb8a411c52c009187b464dcc4d0052b80aee02284d0ca3cfe888fefd846ae0e555fb5b70d05f269f7f7f1
7
- data.tar.gz: b94fc116b8db2d5f3c28ec2da6af0892ff4a506d1b71a4a5a19037fd556b8ea2ce92bf89f30e78b591513cbbe0aaa1ff57290eecf03ecb4829cd5c56d4a7ad1c
6
+ metadata.gz: 5e4f03a04539ba472c8f0df6667d491064e63741a0853076ea7982e911f1de158f7f6326977db759af71d28cfb95b954b5fa647cfbbbc33288228eef298d5043
7
+ data.tar.gz: 9b827a7b6b57738cc70c1ed48ed21d1d7399ae71a19b5903b94fa312aaa80dad4670ef85981cedc1c135da40943935d6bb58d8fa28b065300e3c7319a9b2ffd3
@@ -1,3 +1,3 @@
1
1
  module ZenFreshdesk
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/zen_freshdesk.rb CHANGED
@@ -18,53 +18,39 @@ module ZenFreshdesk
18
18
  :subject, :description, :header, :email
19
19
  end
20
20
 
21
- def self.create_ticket(uri_api,api_key,project,datas,submiter)
22
- header = {:content_type => "application/json", :Authorization => "Basic #{Base64.encode64(api_key)}"}
23
- body = JSON.parse(datas)
24
-
25
- data = {
26
- "helpdesk_ticket" => {
27
- "description" => body["helpdesk_ticket"]["description"],
28
- "subject" => body["helpdesk_ticket"]["subject"],
29
- "email" => body["helpdesk_ticket"]["email"],
30
- "priority" => 1,
31
- "status" => 2,
32
- "ticket_type" => "Question"
33
- },
34
- "requester_id" => body["helpdesk_ticket"]["requester_id"],
35
- "responder_id" => body["helpdesk_ticket"]["responder_id"]
36
- }.to_json()
37
-
38
-
39
- res = RestClient.post(uri_api, data, header )
40
- puts res.code
41
- puts res
21
+ def self.create_ticket()
22
+ header = {:content_type => "application/json", :Authorization => "Basic #{Base64.encode64(ZenFreshdesk.configuration.api_key)}"}
23
+
24
+ body = {
25
+ "helpdesk_ticket" => {
26
+ "description" => ZenFreshdesk.configuration.description,
27
+ "subject" => ZenFreshdesk.configuration.subject,
28
+ "email" => ZenFreshdesk.configuration.email,
29
+ "priority" => 1,
30
+ "status" => 2,
31
+ "ticket_type" => "Question"
32
+ },
33
+ "requester_id" => ZenFreshdesk.configuration.requester_id,
34
+ "responder_id" => ZenFreshdesk.configuration.responder_id
35
+ }.to_json()
36
+
37
+ res = RestClient.post(ZenFreshdesk.configuration.uri_api, body, header )
38
+ puts res.code
39
+ puts res
40
+ end
42
41
  end
43
42
 
44
- URI_API = "http://chinh.freshdesk.com/helpdesk/tickets.json?tags=test"
45
- API_KEY = "UPf8ktY8VePpIOQPsNsq"
46
- PROJECT = ""
47
- REQUESTER_ID = 1 #User-id of the REQUESTER. For existing contacts, requester_id can be passed instead of email
48
- SUBMITTER = ""
49
- RESPONDER_ID = 3 #ID of the AGENT to whom the ticket is assigned
50
- SUBJECT = "chinh Support needed.."
51
- DESCRIPTION = "chinh Some details on the issue ..."
52
- EMAIL = "tom@outerspace.com"
53
-
54
-
55
- @body = {
56
- "helpdesk_ticket" => {
57
- "description" => DESCRIPTION,
58
- "subject" => SUBJECT,
59
- "email" => EMAIL,
60
- "priority" => 1,
61
- "status" => 2,
62
- "ticket_type" => "Question"
63
- },
64
- "requester_id" => REQUESTER_ID,
65
- "responder_id" => RESPONDER_ID
66
- }.to_json()
43
+ # ZenFreshdesk.configure do |config|
44
+ # config.api_key = "UPf8ktY8VePpIOQPsNsq"
45
+ # config.uri_api = "http://chinh.freshdesk.com/helpdesk/tickets.json?tags=test"
46
+ # config.projects = ""
47
+ # config.requester_id = "1"
48
+ # config.submitter_id = ""
49
+ # config.responder_id = "3"
50
+ # config.subject = "chinh Support needed.."
51
+ # config.description = "chinh Some details on the issue ..."
52
+ # config.email = "tom@outerspace.com"
53
+ # end
67
54
 
55
+ ZenFreshdesk.create_ticket()
68
56
 
69
- # create_ticket(URI_API,API_KEY,PROJECT,@body,SUBMITTER)
70
- end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zen_freshdesk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hoangtrungchinh