freshservice_apiv2 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/freshservice_apiv2.rb +40 -42
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6673770e0dc2ab38c591a9a19cd9618ef24d409
4
- data.tar.gz: 8647ac16511b538befa39d336bfc1c7d6d845ef0
3
+ metadata.gz: 0c5d514bc5d9e497b19ce487cbd53b385d789da3
4
+ data.tar.gz: f5eeeb4bc7ae66eb4037678b989e086bef23a9e0
5
5
  SHA512:
6
- metadata.gz: a4cfb4f2647beb3ca6c2573180dc09b568d48ef12fd3602796a00e8b0065a7b5bea8e42e9e7c8659f4f1fce905b15598690fb77668927e8e25bebdcdf624868e
7
- data.tar.gz: 43d11f12fcfeb5c20d566bf2a06a1cb0bf620587bc01eaaaec00ed1420b004e4b43439657cc8572f4cb3a4cbeb41c8b52fb1b642ccd78762fb9e97dc54b016b7
6
+ metadata.gz: 154c20799285f03a3e564873dcf5f7fa5137721a0080178bbd4385bb1cad292d4b98e2f3773e55b336dec92b704dbcbd1d6d97c05bafbcaa41efd77337b69ab7
7
+ data.tar.gz: fa664b77967dfc9a40ec954dc8664e52f45e5ea1e574694cf945c12464104bef973e330ef85823cd152176b61f67b2650bf3cf78bc92a65e6bb0802bc3b6b0cd
@@ -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
- class Tickets < FreshServiceApiv2
76
+ module FreshService
83
77
 
84
- TICKET_ENDPOINT = "/api/v2/tickets"
85
- TICKET_FIELDS = "/api/v2/ticket_fields"
86
- TICKET_CONVERSATIONS = "/api/v2/conversations"
78
+ class Tickets < FreshServiceApiv2
87
79
 
88
- def initialize(uri)
89
- super(uri)
90
- end
80
+ TICKET_ENDPOINT = "/api/v2/tickets"
81
+ TICKET_FIELDS = "/api/v2/ticket_fields"
82
+ TICKET_CONVERSATIONS = "/api/v2/conversations"
91
83
 
92
- def create_ticket(data)
93
- response = post(TICKET_ENDPOINT,data.to_json)
94
- end
84
+ def initialize(uri)
85
+ super(uri)
86
+ end
95
87
 
96
- def view_ticket(id)
97
- response = get(TICKET_ENDPOINT + "/#{id}")
98
- end
88
+ def create_ticket(data)
89
+ response = post(TICKET_ENDPOINT,data.to_json)
90
+ end
99
91
 
100
- def view_all_ticket_fields
101
- response = get(TICKET_FIELDS)
102
- end
92
+ def view_ticket(id)
93
+ response = get(TICKET_ENDPOINT + "/#{id}")
94
+ end
103
95
 
104
- def delete_ticket(id)
105
- response = delete(TICKET_ENDPOINT + "/#{id}")
106
- end
96
+ def view_all_ticket_fields
97
+ response = get(TICKET_FIELDS)
98
+ end
107
99
 
108
- def update_ticket(id,data)
109
- response = update(TICKET_ENDPOINT + "/#{id}", data.to_json)
110
- end
100
+ def delete_ticket(id)
101
+ response = delete(TICKET_ENDPOINT + "/#{id}")
102
+ end
111
103
 
112
- def add_note(id,data)
113
- response = post(TICKET_ENDPOINT + "/#{id}/notes", data.to_json)
114
- end
104
+ def update_ticket(id,data)
105
+ response = update(TICKET_ENDPOINT + "/#{id}", data.to_json)
106
+ end
115
107
 
116
- def add_reply(id,data)
117
- response = post(TICKET_ENDPOINT + "/#{id}/reply", data.to_json)
118
- end
108
+ def add_note(id,data)
109
+ response = post(TICKET_ENDPOINT + "/#{id}/notes", data.to_json)
110
+ end
119
111
 
120
- def update_conversations(conversation_id,data)
121
- response = update(TICKET_CONVERSATIONS + "/#{conversation_id}", data.to_json)
122
- end
112
+ def add_reply(id,data)
113
+ response = post(TICKET_ENDPOINT + "/#{id}/reply", data.to_json)
114
+ end
123
115
 
124
- def delete_conversation(conversation_id)
125
- response = delete(TICKET_CONVERSATIONS + "/#{conversation_id}")
126
- end
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.0
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-10-31 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client