Class: Sirportly::Client
- Inherits:
-
Object
- Object
- Sirportly::Client
- Defined in:
- lib/sirportly/client.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#api_tokens ⇒ Object
Return all api token.
-
#brands ⇒ Object
Return all brands.
- #contact_tickets(params = {}) ⇒ Object
-
#create_api_token(params = {}) ⇒ Object
Creates a new api token.
-
#create_ticket(params = {}) ⇒ Object
Creates a new ticket.
-
#create_user(params = {}) ⇒ Object
Create a user.
-
#custom_fields ⇒ Object
Return all custom fields.
-
#customer(q) ⇒ Object
Return a specific customer.
-
#customers(opts = {}) ⇒ Object
Return all customers.
-
#departments ⇒ Object
Return all departments.
-
#escalation_paths ⇒ Object
Return all escalation paths.
- #facebook_pages(params = {}) ⇒ Object
-
#filters ⇒ Object
Return all filters.
-
#import_mode(status = nil) ⇒ Object
Enable or disable ticket mode for the token’s account.
-
#initialize(token, secret, opts = {}) ⇒ Client
constructor
A new instance of Client.
-
#knowledge_base(q) ⇒ Object
Return a specific knowledge base.
-
#knowledge_bases ⇒ Object
Return all knowledge bases.
-
#priorities ⇒ Object
Return all priorities.
-
#request(*args) ⇒ Object
Make a request using this client’s authentication token and return the request.
-
#slas ⇒ Object
Return all SLAs.
-
#spql(query) ⇒ Object
Execute an SPQL query and return the SPQLQuery instance.
-
#statuses ⇒ Object
Return all statuses.
-
#teams ⇒ Object
Return all teams.
-
#ticket(q) ⇒ Object
Return a specific ticket.
-
#ticket_search(query, page = 1) ⇒ Object
Return a set of tickets for given search term.
-
#tickets(opts = {}) ⇒ Object
Return all tickets.
- #twitter_accounts(params = {}) ⇒ Object
-
#user(q) ⇒ Object
Return a specific user.
-
#users(opts = {}) ⇒ Object
Return all users.
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
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
4 5 6 |
# File 'lib/sirportly/client.rb', line 4 def opts @opts end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
4 5 6 |
# File 'lib/sirportly/client.rb', line 4 def secret @secret end |
#token ⇒ Object (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_tokens ⇒ Object
Return all api token
121 122 123 |
# File 'lib/sirportly/client.rb', line 121 def api_tokens ApiToken.all(self) end |
#brands ⇒ Object
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_fields ⇒ Object
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 |
#departments ⇒ Object
Return all departments
36 37 38 |
# File 'lib/sirportly/client.rb', line 36 def departments Department.all(self) end |
#escalation_paths ⇒ Object
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 |
#filters ⇒ Object
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_bases ⇒ Object
Return all knowledge bases
51 52 53 |
# File 'lib/sirportly/client.rb', line 51 def knowledge_bases KnowledgeBase.all(self) end |
#priorities ⇒ Object
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 |
#slas ⇒ Object
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 |
#statuses ⇒ Object
Return all statuses
81 82 83 |
# File 'lib/sirportly/client.rb', line 81 def statuses Status.all(self) end |
#teams ⇒ Object
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 |