sirportly 1.3.3 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sirportly.rb +1 -14
- data/lib/sirportly/client.rb +3 -3
- data/lib/sirportly/request.rb +3 -3
- metadata +6 -6
data/lib/sirportly.rb
CHANGED
@@ -31,27 +31,14 @@ 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.5'
|
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
|
-
|
43
38
|
## Specifies whether or not to execute rules when running API calls. By default,
|
44
39
|
## all rules will be run. Set to false to stop execution.
|
45
40
|
attr_accessor :execute_rules
|
46
41
|
|
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
|
-
|
55
42
|
end
|
56
43
|
|
57
44
|
## 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, :domain, :application
|
5
5
|
|
6
|
-
def initialize(token, secret)
|
7
|
-
@token, @secret = token, secret
|
6
|
+
def initialize(token, secret, domain = 'https://api.sirportly.com', application = nil)
|
7
|
+
@token, @secret, @domain, @application = token, secret, domain, application
|
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([@client.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 @client.application
|
36
|
+
http_request.add_field("X-Auth-Application", @client.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.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multipart-post
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 2.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 2.2.0
|
30
30
|
description: A Ruby library for interacting with the Sirportly API.
|
31
31
|
email: adam@atechmedia.com
|
32
32
|
executables: []
|