sirportly 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sirportly.rb +14 -1
- data/lib/sirportly/client.rb +3 -3
- data/lib/sirportly/request.rb +3 -3
- metadata +3 -3
data/lib/sirportly.rb
CHANGED
@@ -31,14 +31,27 @@ require 'sirportly/data_objects/ticket_update'
|
|
31
31
|
require 'sirportly/data_objects/user'
|
32
32
|
|
33
33
|
module Sirportly
|
34
|
-
VERSION = '1.3.
|
34
|
+
VERSION = '1.3.6'
|
35
35
|
|
36
36
|
class << self
|
37
37
|
|
38
|
+
## Stores the application token if one has been provided. This can be nil if no
|
39
|
+
## application token exists, however if nil, you cannot authenticate using user
|
40
|
+
## tokens.
|
41
|
+
attr_accessor :application
|
42
|
+
|
38
43
|
## Specifies whether or not to execute rules when running API calls. By default,
|
39
44
|
## all rules will be run. Set to false to stop execution.
|
40
45
|
attr_accessor :execute_rules
|
41
46
|
|
47
|
+
## Allow the domain to be changed
|
48
|
+
attr_writer :domain
|
49
|
+
|
50
|
+
## Returns the domain which should be used to query the API
|
51
|
+
def domain
|
52
|
+
@domain ||= 'https://api.sirportly.com'
|
53
|
+
end
|
54
|
+
|
42
55
|
end
|
43
56
|
|
44
57
|
## Various error classes to raise
|
data/lib/sirportly/client.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Sirportly
|
2
2
|
class Client
|
3
3
|
|
4
|
-
attr_reader :token, :secret
|
4
|
+
attr_reader :token, :secret
|
5
5
|
|
6
|
-
def initialize(token, secret
|
7
|
-
@token, @secret
|
6
|
+
def initialize(token, secret)
|
7
|
+
@token, @secret = token, secret
|
8
8
|
end
|
9
9
|
|
10
10
|
## Make a request using this client's authentication token and return the request.
|
data/lib/sirportly/request.rb
CHANGED
@@ -25,15 +25,15 @@ module Sirportly
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def make
|
28
|
-
uri = URI.parse([
|
28
|
+
uri = URI.parse([Sirportly.domain, "api/v1", @path].join('/'))
|
29
29
|
http_request = http_req(uri, @data.stringify_keys)
|
30
30
|
http_request.add_field("User-Agent", "SirportlyRubyClient/#{Sirportly::VERSION}")
|
31
31
|
http_request.add_field("X-Auth-Token", @client.token)
|
32
32
|
http_request.add_field("X-Auth-Secret", @client.secret)
|
33
33
|
http_request.add_field("X-Sirportly-Rules", "disabled") if Sirportly.execute_rules == false
|
34
34
|
|
35
|
-
if
|
36
|
-
http_request.add_field("X-Auth-Application",
|
35
|
+
if Sirportly.application
|
36
|
+
http_request.add_field("X-Auth-Application", Sirportly.application)
|
37
37
|
end
|
38
38
|
|
39
39
|
http = Net::HTTP.new(uri.host, uri.port)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sirportly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.
|
21
|
+
version: 2.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.
|
29
|
+
version: 2.0.0
|
30
30
|
description: A Ruby library for interacting with the Sirportly API.
|
31
31
|
email: adam@atechmedia.com
|
32
32
|
executables: []
|