Class: Sirportly::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/sirportly/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token, secret, opts = {}) ⇒ Client

Returns a new instance of Client.



6
7
8
# File 'lib/sirportly/client.rb', line 6

def initialize(token, secret, opts={})
  @token, @secret, @opts = token, secret, opts
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



4
5
6
# File 'lib/sirportly/client.rb', line 4

def opts
  @opts
end

#secretObject (readonly)

Returns the value of attribute secret.



4
5
6
# File 'lib/sirportly/client.rb', line 4

def secret
  @secret
end

#tokenObject (readonly)

Returns the value of attribute token.



4
5
6
# File 'lib/sirportly/client.rb', line 4

def token
  @token
end

Instance Method Details

#api_tokensObject

Return all api token



121
122
123
# File 'lib/sirportly/client.rb', line 121

def api_tokens
  ApiToken.all(self)
end

#brandsObject

Return all brands



16
17
18
# File 'lib/sirportly/client.rb', line 16

def brands
  Brand.all(self)
end

#contact_tickets(params = {}) ⇒ Object



130
131
132
# File 'lib/sirportly/client.rb', line 130

def contact_tickets(params = {})
  Ticket.contact(self, params)
end

#create_api_token(params = {}) ⇒ Object

Creates a new api token



126
127
128
# File 'lib/sirportly/client.rb', line 126

def create_api_token(params = {})
  ApiToken.create(self, params)
end

#create_ticket(params = {}) ⇒ Object

Creates a new ticket



21
22
23
# File 'lib/sirportly/client.rb', line 21

def create_ticket(params = {})
  Ticket.create(self, params)
end

#create_user(params = {}) ⇒ Object

Create a user



116
117
118
# File 'lib/sirportly/client.rb', line 116

def create_user(params = {})
  User.create(self, params)
end

#custom_fieldsObject

Return all custom fields



71
72
73
# File 'lib/sirportly/client.rb', line 71

def custom_fields
  CustomField.all(self)
end

#customer(q) ⇒ Object

Return a specific customer



31
32
33
# File 'lib/sirportly/client.rb', line 31

def customer(q)
  Customer.find(self, q)
end

#customers(opts = {}) ⇒ Object

Return all customers



26
27
28
# File 'lib/sirportly/client.rb', line 26

def customers(opts = {})
  Customer.all(self, opts)
end

#departmentsObject

Return all departments



36
37
38
# File 'lib/sirportly/client.rb', line 36

def departments
  Department.all(self)
end

#escalation_pathsObject

Return all escalation paths



41
42
43
# File 'lib/sirportly/client.rb', line 41

def escalation_paths
  EscalationPath.all(self)
end

#facebook_pages(params = {}) ⇒ Object



138
139
140
# File 'lib/sirportly/client.rb', line 138

def facebook_pages(params = {})
  FacebookPage.all(self, params)
end

#filtersObject

Return all filters



46
47
48
# File 'lib/sirportly/client.rb', line 46

def filters
  Filter.all(self)
end

#import_mode(status = nil) ⇒ Object

Enable or disable ticket mode for the token’s account



143
144
145
146
147
148
# File 'lib/sirportly/client.rb', line 143

def import_mode(status = nil)
  hash = {}
  hash[:status] = (status ? 'enabled' : 'disabled') unless status.nil?
  response = Request.request(self, 'accounts/import_mode', hash)
  response.is_a?(Hash) ? response['status'] : nil
end

#knowledge_base(q) ⇒ Object

Return a specific knowledge base



56
57
58
# File 'lib/sirportly/client.rb', line 56

def knowledge_base(q)
  KnowledgeBase.find(self, q)
end

#knowledge_basesObject

Return all knowledge bases



51
52
53
# File 'lib/sirportly/client.rb', line 51

def knowledge_bases
  KnowledgeBase.all(self)
end

#prioritiesObject

Return all priorities



61
62
63
# File 'lib/sirportly/client.rb', line 61

def priorities
  Priority.all(self)
end

#request(*args) ⇒ Object

Make a request using this client’s authentication token and return the request.



11
12
13
# File 'lib/sirportly/client.rb', line 11

def request(*args)
  Request.request(self, *args)
end

#slasObject

Return all SLAs



66
67
68
# File 'lib/sirportly/client.rb', line 66

def slas
  SLA.all(self)
end

#spql(query) ⇒ Object

Execute an SPQL query and return the SPQLQuery instance



76
77
78
# File 'lib/sirportly/client.rb', line 76

def spql(query)
  SPQLQuery.new(self, query)
end

#statusesObject

Return all statuses



81
82
83
# File 'lib/sirportly/client.rb', line 81

def statuses
  Status.all(self)
end

#teamsObject

Return all teams



86
87
88
# File 'lib/sirportly/client.rb', line 86

def teams
  Team.all(self)
end

#ticket(q) ⇒ Object

Return a specific ticket



96
97
98
# File 'lib/sirportly/client.rb', line 96

def ticket(q)
  Ticket.find(self, q)
end

#ticket_search(query, page = 1) ⇒ Object

Return a set of tickets for given search term



101
102
103
# File 'lib/sirportly/client.rb', line 101

def ticket_search(query, page = 1)
  Ticket.search(self, query, page)
end

#tickets(opts = {}) ⇒ Object

Return all tickets



91
92
93
# File 'lib/sirportly/client.rb', line 91

def tickets(opts = {})
  Ticket.all(self, opts)
end

#twitter_accounts(params = {}) ⇒ Object



134
135
136
# File 'lib/sirportly/client.rb', line 134

def twitter_accounts(params = {})
  TwitterAccount.all(self, params)
end

#user(q) ⇒ Object

Return a specific user



111
112
113
# File 'lib/sirportly/client.rb', line 111

def user(q)
  User.find(self, q)
end

#users(opts = {}) ⇒ Object

Return all users



106
107
108
# File 'lib/sirportly/client.rb', line 106

def users(opts = {})
  User.all(self, opts)
end