tuneuptechnology 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tuneuptechnology.rb +5 -36
- data/lib/tuneuptechnology/client.rb +61 -0
- data/lib/tuneuptechnology/customers.rb +43 -0
- data/lib/tuneuptechnology/inventory.rb +25 -18
- data/lib/tuneuptechnology/locations.rb +43 -0
- data/lib/tuneuptechnology/tickets.rb +43 -0
- metadata +89 -18
- data/lib/tuneuptechnology/customer.rb +0 -36
- data/lib/tuneuptechnology/location.rb +0 -36
- data/lib/tuneuptechnology/ticket.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe3fcf0a838933bfff1df5e091c4b76fe66b2e46002c2916be492b094896f479
|
4
|
+
data.tar.gz: 3dcef4d3dddee741e18ed341ea7a8be45c3cd8ec9cf2a911daaa2903478ee9ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c5bc452b0cbec6e072e1d3c927e8f1e6f63815a92d1ccd5398228a2393a1a12da1e981edab27ebae6b662d541e7b0f80c2eb4d459fd378afbabaa4e99526a3b
|
7
|
+
data.tar.gz: 25500ffa02d4decac5fc39f04c9651881214da0af71ac2ca33ce3860185145b673e4dc43377518980b29f6293e9287c38a22f388ddc67d50f6221c03f312313c
|
data/lib/tuneuptechnology.rb
CHANGED
@@ -1,38 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
require 'tuneuptechnology/inventory'
|
9
|
-
require 'tuneuptechnology/location'
|
10
|
-
require 'tuneuptechnology/ticket'
|
11
|
-
|
12
|
-
module TuneupTechnology
|
13
|
-
# Build the HTTP client for the library
|
14
|
-
class Client
|
15
|
-
@base_url = 'https://app.tuneuptechnology.com/api/'
|
16
|
-
class << self
|
17
|
-
attr_reader :base_url
|
18
|
-
end
|
19
|
-
|
20
|
-
@version = '1.0.0'
|
21
|
-
class << self
|
22
|
-
attr_reader :version
|
23
|
-
end
|
24
|
-
|
25
|
-
@headers = {
|
26
|
-
'Content-Type' => 'application/json',
|
27
|
-
'User-Agent' => "TuneupTechnologyApp/RubyClient/#{Client.version}"
|
28
|
-
}
|
29
|
-
class << self
|
30
|
-
attr_reader :headers
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.post(data, endpoint)
|
34
|
-
response = RestClient.post(endpoint, data.to_json, headers)
|
35
|
-
JSON.pretty_generate(JSON.parse(response))
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
3
|
+
require_relative 'tuneuptechnology/client'
|
4
|
+
require_relative 'tuneuptechnology/customers'
|
5
|
+
require_relative 'tuneuptechnology/inventory'
|
6
|
+
require_relative 'tuneuptechnology/locations'
|
7
|
+
require_relative 'tuneuptechnology/tickets'
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module TuneupTechnology
|
7
|
+
# The Client initializes everything needed to use this client library
|
8
|
+
class Client
|
9
|
+
attr_reader :email, :api_key, :base_url, :timeout, :version, :headers
|
10
|
+
|
11
|
+
def initialize(email = nil, api_key = nil, base_url = 'https://app.tuneuptechnology.com/api', timeout = 10)
|
12
|
+
@@email = email
|
13
|
+
@@api_key = api_key
|
14
|
+
@base_url = base_url
|
15
|
+
@timeout = timeout
|
16
|
+
@version = '2.0.0'
|
17
|
+
|
18
|
+
raise NameError, 'email and api_key are required to create a Client.' if @@email.nil? || @@api_key.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
def customers
|
22
|
+
TuneupTechnology::Customers.new(@base_url, :make_http_request)
|
23
|
+
end
|
24
|
+
|
25
|
+
def inventory
|
26
|
+
TuneupTechnology::Inventory.new(@base_url, :make_http_request)
|
27
|
+
end
|
28
|
+
|
29
|
+
def locations
|
30
|
+
TuneupTechnology::Locations.new(@base_url, :make_http_request)
|
31
|
+
end
|
32
|
+
|
33
|
+
def tickets
|
34
|
+
TuneupTechnology::Tickets.new(@base_url, :make_http_request)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Build the HTTP client for the library
|
38
|
+
def self.make_http_request(method, endpoint, data = nil)
|
39
|
+
headers = {
|
40
|
+
'Accept' => 'application/json',
|
41
|
+
'User-Agent' => "TuneupTechnologyApp/RubyClient/#{@version}",
|
42
|
+
'Email' => @@email,
|
43
|
+
'Api-Key' => @@api_key
|
44
|
+
}
|
45
|
+
|
46
|
+
begin
|
47
|
+
response = RestClient::Request.execute(
|
48
|
+
method: method,
|
49
|
+
url: endpoint,
|
50
|
+
payload: data.to_json,
|
51
|
+
headers: headers,
|
52
|
+
timeout: @timeout
|
53
|
+
)
|
54
|
+
|
55
|
+
JSON.parse(response.body)
|
56
|
+
rescue RestClient::ExceptionWithResponse => e
|
57
|
+
e.response
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TuneupTechnology
|
4
|
+
# The Customers object
|
5
|
+
class Customers < Client
|
6
|
+
attr_reader :base_url, :make_http_request
|
7
|
+
|
8
|
+
def initialize(base_url, make_http_request)
|
9
|
+
@base_url = base_url
|
10
|
+
@make_http_request = make_http_request
|
11
|
+
end
|
12
|
+
|
13
|
+
# Create a customer
|
14
|
+
def create(data)
|
15
|
+
endpoint = "#{@base_url}/customers"
|
16
|
+
Client.make_http_request('post', endpoint, data)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Retrieve all customer records
|
20
|
+
def all
|
21
|
+
endpoint = "#{@base_url}/customers"
|
22
|
+
Client.make_http_request('get', endpoint)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Retrieve a single customer record
|
26
|
+
def retrieve(id)
|
27
|
+
endpoint = "#{@base_url}/customers/#{id}"
|
28
|
+
Client.make_http_request('get', endpoint)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Update a customer record
|
32
|
+
def update(id, data)
|
33
|
+
endpoint = "#{@base_url}/customers/#{id}"
|
34
|
+
Client.make_http_request('patch', endpoint, data)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Delete a customer record
|
38
|
+
def delete(id)
|
39
|
+
endpoint = "#{@base_url}/customers/#{id}"
|
40
|
+
Client.make_http_request('delete', endpoint)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -1,36 +1,43 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module TuneupTechnology
|
4
|
-
#
|
5
|
-
class Inventory
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
# The Inventory object
|
5
|
+
class Inventory < Client
|
6
|
+
attr_reader :base_url, :make_http_request
|
7
|
+
|
8
|
+
def initialize(base_url, make_http_request)
|
9
|
+
@base_url = base_url
|
10
|
+
@make_http_request = make_http_request
|
11
|
+
end
|
12
|
+
|
13
|
+
# Create an inventory record
|
14
|
+
def create(data)
|
15
|
+
endpoint = "#{@base_url}/inventory"
|
16
|
+
Client.make_http_request('post', endpoint, data)
|
10
17
|
end
|
11
18
|
|
12
19
|
# Retrieve all inventory records
|
13
|
-
def
|
14
|
-
endpoint =
|
15
|
-
Client.
|
20
|
+
def all
|
21
|
+
endpoint = "#{@base_url}/inventory"
|
22
|
+
Client.make_http_request('get', endpoint)
|
16
23
|
end
|
17
24
|
|
18
25
|
# Retrieve a single inventory record
|
19
|
-
def
|
20
|
-
endpoint =
|
21
|
-
Client.
|
26
|
+
def retrieve(id)
|
27
|
+
endpoint = "#{@base_url}/inventory/#{id}"
|
28
|
+
Client.make_http_request('get', endpoint)
|
22
29
|
end
|
23
30
|
|
24
31
|
# Update an inventory record
|
25
|
-
def
|
26
|
-
endpoint =
|
27
|
-
Client.
|
32
|
+
def update(id, data)
|
33
|
+
endpoint = "#{@base_url}/inventory/#{id}"
|
34
|
+
Client.make_http_request('patch', endpoint, data)
|
28
35
|
end
|
29
36
|
|
30
37
|
# Delete an inventory record
|
31
|
-
def
|
32
|
-
endpoint =
|
33
|
-
Client.
|
38
|
+
def delete(id)
|
39
|
+
endpoint = "#{@base_url}/inventory/#{id}"
|
40
|
+
Client.make_http_request('delete', endpoint)
|
34
41
|
end
|
35
42
|
end
|
36
43
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TuneupTechnology
|
4
|
+
# The Locations object
|
5
|
+
class Locations < Client
|
6
|
+
attr_reader :base_url, :make_http_request
|
7
|
+
|
8
|
+
def initialize(base_url, make_http_request)
|
9
|
+
@base_url = base_url
|
10
|
+
@make_http_request = make_http_request
|
11
|
+
end
|
12
|
+
|
13
|
+
# Create a location
|
14
|
+
def create(data)
|
15
|
+
endpoint = "#{@base_url}/locations"
|
16
|
+
Client.make_http_request('post', endpoint, data)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Retrieve all location records
|
20
|
+
def all
|
21
|
+
endpoint = "#{@base_url}/locations"
|
22
|
+
Client.make_http_request('get', endpoint)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Retrieve a single location record
|
26
|
+
def retrieve(id)
|
27
|
+
endpoint = "#{@base_url}/locations/#{id}"
|
28
|
+
Client.make_http_request('get', endpoint)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Update a location record
|
32
|
+
def update(id, data)
|
33
|
+
endpoint = "#{@base_url}/locations/#{id}"
|
34
|
+
Client.make_http_request('patch', endpoint, data)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Delete a location record
|
38
|
+
def delete(id)
|
39
|
+
endpoint = "#{@base_url}/locations/#{id}"
|
40
|
+
Client.make_http_request('delete', endpoint)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TuneupTechnology
|
4
|
+
# The tickets object
|
5
|
+
class Tickets < Client
|
6
|
+
attr_reader :base_url, :make_http_request
|
7
|
+
|
8
|
+
def initialize(base_url, make_http_request)
|
9
|
+
@base_url = base_url
|
10
|
+
@make_http_request = make_http_request
|
11
|
+
end
|
12
|
+
|
13
|
+
# Create a ticket
|
14
|
+
def create(data)
|
15
|
+
endpoint = "#{@base_url}/tickets"
|
16
|
+
Client.make_http_request('post', endpoint, data)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Retrieve all ticket records
|
20
|
+
def all
|
21
|
+
endpoint = "#{@base_url}/tickets"
|
22
|
+
Client.make_http_request('get', endpoint)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Retrieve a single ticket record
|
26
|
+
def retrieve(id)
|
27
|
+
endpoint = "#{@base_url}/tickets/#{id}"
|
28
|
+
Client.make_http_request('get', endpoint)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Update a ticket record
|
32
|
+
def update(id, data)
|
33
|
+
endpoint = "#{@base_url}/tickets/#{id}"
|
34
|
+
Client.make_http_request('patch', endpoint, data)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Delete a ticket record
|
38
|
+
def delete(id)
|
39
|
+
endpoint = "#{@base_url}/tickets/#{id}"
|
40
|
+
Client.make_http_request('delete', endpoint)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,60 +1,131 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tuneuptechnology
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Tuneup Technology
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2
|
19
|
+
version: '2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2
|
26
|
+
version: '2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rubocop
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.82'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.82'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.21'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.21'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov-lcov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
32
74
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
75
|
+
version: '0.8'
|
34
76
|
type: :development
|
35
77
|
prerelease: false
|
36
78
|
version_requirements: !ruby/object:Gem::Requirement
|
37
79
|
requirements:
|
38
|
-
- - "
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: vcr
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
39
88
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
89
|
+
version: '6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3'
|
41
111
|
description: |-
|
42
112
|
This library allows you to interact with the customers,
|
43
113
|
tickets, inventory, and locations objects without needing to do the hard
|
44
114
|
work of binding your calls and data to endpointspec. Simply call an action
|
45
115
|
such as `Customer.create` and pass some data and let the library do
|
46
116
|
the rest.
|
47
|
-
email:
|
117
|
+
email: tuneuptechnology@gmail.com
|
48
118
|
executables: []
|
49
119
|
extensions: []
|
50
120
|
extra_rdoc_files: []
|
51
121
|
files:
|
52
122
|
- lib/tuneuptechnology.rb
|
53
|
-
- lib/tuneuptechnology/
|
123
|
+
- lib/tuneuptechnology/client.rb
|
124
|
+
- lib/tuneuptechnology/customers.rb
|
54
125
|
- lib/tuneuptechnology/inventory.rb
|
55
|
-
- lib/tuneuptechnology/
|
56
|
-
- lib/tuneuptechnology/
|
57
|
-
homepage: https://github.com/
|
126
|
+
- lib/tuneuptechnology/locations.rb
|
127
|
+
- lib/tuneuptechnology/tickets.rb
|
128
|
+
homepage: https://github.com/tuneuptechnology/tuneuptechnology-ruby
|
58
129
|
licenses:
|
59
130
|
- MIT
|
60
131
|
metadata: {}
|
@@ -66,14 +137,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
137
|
requirements:
|
67
138
|
- - ">="
|
68
139
|
- !ruby/object:Gem::Version
|
69
|
-
version: '
|
140
|
+
version: '2.6'
|
70
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
142
|
requirements:
|
72
143
|
- - ">="
|
73
144
|
- !ruby/object:Gem::Version
|
74
145
|
version: '0'
|
75
146
|
requirements: []
|
76
|
-
rubygems_version: 3.
|
147
|
+
rubygems_version: 3.2.15
|
77
148
|
signing_key:
|
78
149
|
specification_version: 4
|
79
150
|
summary: The Ruby client library for the Tuneup Technology App.
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TuneupTechnology
|
4
|
-
# Methods for the Customer object
|
5
|
-
class Customer
|
6
|
-
# Create a customer
|
7
|
-
def self.create(data)
|
8
|
-
endpoint = Client.base_url + 'customers/create'
|
9
|
-
Client.post(data, endpoint)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Retrieve all customer records
|
13
|
-
def self.all(data)
|
14
|
-
endpoint = Client.base_url + 'customers'
|
15
|
-
Client.post(data, endpoint)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Retrieve a single customer record
|
19
|
-
def self.retrieve(data)
|
20
|
-
endpoint = Client.base_url + 'customers/' + data['id'].to_s
|
21
|
-
Client.post(data, endpoint)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Update a customer record
|
25
|
-
def self.update(data)
|
26
|
-
endpoint = Client.base_url + 'customers/' + data['id'].to_s + '/update'
|
27
|
-
Client.post(data, endpoint)
|
28
|
-
end
|
29
|
-
|
30
|
-
# Delete a customer record
|
31
|
-
def self.delete(data)
|
32
|
-
endpoint = Client.base_url + 'customers/' + data['id'].to_s + '/delete'
|
33
|
-
Client.post(data, endpoint)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TuneupTechnology
|
4
|
-
# Methods for the Location object
|
5
|
-
class Location
|
6
|
-
# Create a location
|
7
|
-
def self.create(data)
|
8
|
-
endpoint = Client.base_url + 'locations/create'
|
9
|
-
Client.post(data, endpoint)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Retrieve all location records
|
13
|
-
def self.all(data)
|
14
|
-
endpoint = Client.base_url + 'locations'
|
15
|
-
Client.post(data, endpoint)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Retrieve a single location record
|
19
|
-
def self.retrieve(data)
|
20
|
-
endpoint = Client.base_url + 'locations/' + data['id'].to_s
|
21
|
-
Client.post(data, endpoint)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Update a location record
|
25
|
-
def self.update(data)
|
26
|
-
endpoint = Client.base_url + 'locations/' + data['id'].to_s + '/update'
|
27
|
-
Client.post(data, endpoint)
|
28
|
-
end
|
29
|
-
|
30
|
-
# Delete a location record
|
31
|
-
def self.delete(data)
|
32
|
-
endpoint = Client.base_url + 'locations/' + data['id'].to_s + '/delete'
|
33
|
-
Client.post(data, endpoint)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TuneupTechnology
|
4
|
-
# Methods for the Ticket object
|
5
|
-
class Ticket
|
6
|
-
# Create a ticket
|
7
|
-
def self.create(data)
|
8
|
-
endpoint = Client.base_url + 'tickets/create'
|
9
|
-
Client.post(data, endpoint)
|
10
|
-
end
|
11
|
-
|
12
|
-
# Retrieve all ticket records
|
13
|
-
def self.all(data)
|
14
|
-
endpoint = Client.base_url + 'tickets'
|
15
|
-
Client.post(data, endpoint)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Retrieve a single ticket record
|
19
|
-
def self.retrieve(data)
|
20
|
-
endpoint = Client.base_url + 'tickets/' + data['id'].to_s
|
21
|
-
Client.post(data, endpoint)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Update a ticket record
|
25
|
-
def self.update(data)
|
26
|
-
endpoint = Client.base_url + 'tickets/' + data['id'].to_s + '/update'
|
27
|
-
Client.post(data, endpoint)
|
28
|
-
end
|
29
|
-
|
30
|
-
# Delete a ticket record
|
31
|
-
def self.delete(data)
|
32
|
-
endpoint = Client.base_url + 'tickets/' + data['id'].to_s + '/delete'
|
33
|
-
Client.post(data, endpoint)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|