freshservice_apiv2 0.1.0 → 0.1.1
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/freshservice_apiv2.rb +40 -42
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c5d514bc5d9e497b19ce487cbd53b385d789da3
|
4
|
+
data.tar.gz: f5eeeb4bc7ae66eb4037678b989e086bef23a9e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 154c20799285f03a3e564873dcf5f7fa5137721a0080178bbd4385bb1cad292d4b98e2f3773e55b336dec92b704dbcbd1d6d97c05bafbcaa41efd77337b69ab7
|
7
|
+
data.tar.gz: fa664b77967dfc9a40ec954dc8664e52f45e5ea1e574694cf945c12464104bef973e330ef85823cd152176b61f67b2650bf3cf78bc92a65e6bb0802bc3b6b0cd
|
data/lib/freshservice_apiv2.rb
CHANGED
@@ -5,12 +5,6 @@ require 'base64'
|
|
5
5
|
class FreshServiceApiv2
|
6
6
|
attr_accessor :header,:username,:password,:apikey,:baseurl
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
class AlreadyExistedError < StandardError; end # have to add better error handling #ToDO
|
11
|
-
class ConnectionError < StandardError; end
|
12
|
-
|
13
|
-
|
14
8
|
def initialize(uri)
|
15
9
|
@baseurl = uri.chomp('/')
|
16
10
|
end
|
@@ -79,54 +73,58 @@ class FreshServiceApiv2
|
|
79
73
|
|
80
74
|
end
|
81
75
|
|
82
|
-
|
76
|
+
module FreshService
|
83
77
|
|
84
|
-
|
85
|
-
TICKET_FIELDS = "/api/v2/ticket_fields"
|
86
|
-
TICKET_CONVERSATIONS = "/api/v2/conversations"
|
78
|
+
class Tickets < FreshServiceApiv2
|
87
79
|
|
88
|
-
|
89
|
-
|
90
|
-
|
80
|
+
TICKET_ENDPOINT = "/api/v2/tickets"
|
81
|
+
TICKET_FIELDS = "/api/v2/ticket_fields"
|
82
|
+
TICKET_CONVERSATIONS = "/api/v2/conversations"
|
91
83
|
|
92
|
-
|
93
|
-
|
94
|
-
|
84
|
+
def initialize(uri)
|
85
|
+
super(uri)
|
86
|
+
end
|
95
87
|
|
96
|
-
|
97
|
-
|
98
|
-
|
88
|
+
def create_ticket(data)
|
89
|
+
response = post(TICKET_ENDPOINT,data.to_json)
|
90
|
+
end
|
99
91
|
|
100
|
-
|
101
|
-
|
102
|
-
|
92
|
+
def view_ticket(id)
|
93
|
+
response = get(TICKET_ENDPOINT + "/#{id}")
|
94
|
+
end
|
103
95
|
|
104
|
-
|
105
|
-
|
106
|
-
|
96
|
+
def view_all_ticket_fields
|
97
|
+
response = get(TICKET_FIELDS)
|
98
|
+
end
|
107
99
|
|
108
|
-
|
109
|
-
|
110
|
-
|
100
|
+
def delete_ticket(id)
|
101
|
+
response = delete(TICKET_ENDPOINT + "/#{id}")
|
102
|
+
end
|
111
103
|
|
112
|
-
|
113
|
-
|
114
|
-
|
104
|
+
def update_ticket(id,data)
|
105
|
+
response = update(TICKET_ENDPOINT + "/#{id}", data.to_json)
|
106
|
+
end
|
115
107
|
|
116
|
-
|
117
|
-
|
118
|
-
|
108
|
+
def add_note(id,data)
|
109
|
+
response = post(TICKET_ENDPOINT + "/#{id}/notes", data.to_json)
|
110
|
+
end
|
119
111
|
|
120
|
-
|
121
|
-
|
122
|
-
|
112
|
+
def add_reply(id,data)
|
113
|
+
response = post(TICKET_ENDPOINT + "/#{id}/reply", data.to_json)
|
114
|
+
end
|
123
115
|
|
124
|
-
|
125
|
-
|
126
|
-
|
116
|
+
def update_conversations(conversation_id,data)
|
117
|
+
response = update(TICKET_CONVERSATIONS + "/#{conversation_id}", data.to_json)
|
118
|
+
end
|
119
|
+
|
120
|
+
def delete_conversation(conversation_id)
|
121
|
+
response = delete(TICKET_CONVERSATIONS + "/#{conversation_id}")
|
122
|
+
end
|
123
|
+
|
124
|
+
def get_all_conversations(ticket_id)
|
125
|
+
response = get(TICKET_ENDPOINT + "/#{ticket_id}/conversations")
|
126
|
+
end
|
127
127
|
|
128
|
-
def get_all_conversations(ticket_id)
|
129
|
-
response = get(TICKET_ENDPOINT + "/#{ticket_id}/conversations")
|
130
128
|
end
|
131
129
|
|
132
130
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freshservice_apiv2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rishabh Aditya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|