Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove logfile and verbose options #23

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions lib/supportbee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@
require "supportbee/tickets"
require 'httparty'
require 'json'
require 'supportbee/ticket'
require 'supportbee/agent'
require 'supportbee/label'

module Supportbee
class Base
include HTTParty
include Supportbee::Ticket
include Supportbee::Agent
include Supportbee::Label

#
# TODO : this initialize to be shifted to api.rb
Expand All @@ -28,14 +22,5 @@ def self.call(cmd, options)
self.new.send(cmd, options)
end

#It's takes ticket,agent,label get as parameter and call appropriate module
#TODO need to finalize parameters
def self.run cmd
supportbee = Supportbee::Base.new("josh", "4rP9QFdmxNUyyK-saK7H")

if cmd == "tickets"
supportbee.tickets
end
end
end
end
5 changes: 0 additions & 5 deletions lib/supportbee/agent.rb

This file was deleted.

5 changes: 0 additions & 5 deletions lib/supportbee/label.rb

This file was deleted.

18 changes: 0 additions & 18 deletions lib/supportbee/ticket.rb

This file was deleted.

15 changes: 15 additions & 0 deletions lib/supportbee/tickets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ class << self
def method_missing(method, argv)
puts 'Not Implemented yet.'
end

def tickets(options={})
valid_keys = [:group, :per_page, :page, :spam, :trash, :replies, :max_replies, :assigned_user, :assigned_group, :starred, :label, :since, :until]
invalid_keys = options.keys - valid_keys

raise "Invalid Options: #{invalid_keys.join(', ')}" unless invalid_keys.empty?

self.class.default_params.merge!(options)

response = self.class.get("/tickets.json")
result = JSON.parse(response.body)
result['tickets'].map do |ticket|
{ticket['id'] => ticket['subject']}
end
end
end

end
Expand Down
9 changes: 0 additions & 9 deletions supportbee.rb

This file was deleted.