sirportly 1.1.0 → 1.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.
@@ -7,6 +7,7 @@ require 'sirportly/client'
7
7
  require 'sirportly/request'
8
8
  require 'sirportly/data_set'
9
9
  require 'sirportly/data_object'
10
+ require 'sirportly/spql_query'
10
11
 
11
12
  require 'sirportly/data_objects/brand'
12
13
  require 'sirportly/data_objects/customer'
@@ -17,6 +17,11 @@ module Sirportly
17
17
  Brand.all(self)
18
18
  end
19
19
 
20
+ ## Creates a new ticket
21
+ def create_ticket(params = {})
22
+ Ticket.create(self, params)
23
+ end
24
+
20
25
  ## Return all customers
21
26
  def customers(opts = {})
22
27
  Customer.all(self, opts)
@@ -52,6 +57,11 @@ module Sirportly
52
57
  SLA.all(self)
53
58
  end
54
59
 
60
+ ## Execute an SPQL query and return the SPQLQuery instance
61
+ def spql(query)
62
+ SPQLQuery.new(self, query)
63
+ end
64
+
55
65
  ## Return all statuses
56
66
  def statuses
57
67
  Status.all(self)
@@ -54,7 +54,7 @@ module Sirportly
54
54
  when Net::HTTPForbidden, Net::HTTPUnauthorized
55
55
  raise Sirportly::Errors::AccessDenied, "Access Denied for '#{Sirportly.token}'"
56
56
  when Net::HTTPNotFound
57
-
57
+ json = JSON.parse(http_result.body)
58
58
  raise Sirportly::Errors::NotFound, json['error']
59
59
  when Net::HTTPClientError
60
60
  json = JSON.parse(http_result.body)
@@ -0,0 +1,28 @@
1
+ module Sirportly
2
+ class SPQLQuery
3
+
4
+ attr_reader :query
5
+
6
+ def initialize(client, query)
7
+ @client, @query = client, query
8
+ execute
9
+ end
10
+
11
+ def fields
12
+ @result['fields']
13
+ end
14
+
15
+ def results
16
+ @result['results']
17
+ end
18
+
19
+ def execute
20
+ if req = @client.request('tickets/spql', :spql => @query)
21
+ @result = req
22
+ else
23
+ false
24
+ end
25
+ end
26
+
27
+ end
28
+ end
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.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-16 00:00:00.000000000Z
12
+ date: 2012-03-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: adam@atechmedia.com
@@ -22,6 +22,7 @@ files:
22
22
  - lib/sirportly/data_object.rb
23
23
  - lib/sirportly/data_set.rb
24
24
  - lib/sirportly/request.rb
25
+ - lib/sirportly/spql_query.rb
25
26
  homepage: http://www.sirportly.com
26
27
  licenses: []
27
28
  post_install_message:
@@ -42,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
43
  version: '0'
43
44
  requirements: []
44
45
  rubyforge_project:
45
- rubygems_version: 1.8.10
46
+ rubygems_version: 1.8.17
46
47
  signing_key:
47
48
  specification_version: 3
48
49
  summary: Easy to use client library for Sirportly