Class: Flytrap::Client
- Inherits:
-
Object
- Object
- Flytrap::Client
- Defined in:
- lib/flytrap/client.rb
Instance Method Summary collapse
-
#initialize(username, password, wsdl) ⇒ Client
constructor
A new instance of Client.
- #mc_issue_add(project_id, project_name, category, summary, description) ⇒ Object
- #mc_issue_exists?(issue_id) ⇒ Boolean
- #mc_issue_get(issue_id) ⇒ Object
- #mc_issue_get_id_from_summary(summary) ⇒ Object
- #mc_issue_note_add(issue_id, note) ⇒ Object
Constructor Details
#initialize(username, password, wsdl) ⇒ Client
Returns a new instance of Client.
3 4 5 6 7 8 9 10 11 |
# File 'lib/flytrap/client.rb', line 3 def initialize(username, password, wsdl) Savon.configure do |config| config.log = false end @username = username @password = password @wsdl = wsdl end |
Instance Method Details
#mc_issue_add(project_id, project_name, category, summary, description) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/flytrap/client.rb', line 42 def mc_issue_add(project_id, project_name, category, summary, description) client = Savon.client(@wsdl) response = client.request(:mc_issue_add) do soap.body = { :username => username, :password => password, :issue => { :summary => summary, :project => { :id => project_id, :name => project_name }, :category => category, :description => description } } end response end |
#mc_issue_exists?(issue_id) ⇒ Boolean
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/flytrap/client.rb', line 13 def mc_issue_exists?(issue_id) client = Savon.client(@wsdl) response = client.request(:mc_issue_exists) do soap.body = { :username => username, :password => password, :issue_id => issue_id } end if response.success? return response.body[:mc_issue_exists_response][:return] end end |
#mc_issue_get(issue_id) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/flytrap/client.rb', line 59 def mc_issue_get(issue_id) client = Savon.client(@wsdl) response = client.request(:mc_issue_get) do soap.body = { :username => username, :password => password, :issue_id => issue_id } end if response.success? return response.body[:mc_issue_get_response][:return] end end |
#mc_issue_get_id_from_summary(summary) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/flytrap/client.rb', line 73 def mc_issue_get_id_from_summary(summary) client = Savon.client(@wsdl) response = client.request(:mc_issue_get_id_from_summary) do soap.body = { :username => username, :password => password, :summary => { text: summary[0..127] } } end if response.success? return response.body[:mc_issue_get_id_from_summary_response][:return] end end |
#mc_issue_note_add(issue_id, note) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/flytrap/client.rb', line 27 def mc_issue_note_add(issue_id, note) client = Savon.client(@wsdl) response = client.request(:mc_issue_note_add) do soap.body = { :username => username, :password => password, :issue_id => issue_id, :note => { text: note } } end if response.success? return note_id = response.body[:mc_issue_note_add_response][:return] end end |