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

Could zendesk2 create ticket comments? #34

Open
ivan-garanin opened this issue Jun 18, 2015 · 4 comments
Open

Could zendesk2 create ticket comments? #34

ivan-garanin opened this issue Jun 18, 2015 · 4 comments
Labels

Comments

@ivan-garanin
Copy link

I have got ticket:

<Zendesk2::Client::Ticket
    id=886,
    assignee_id=nil,
    collaborator_ids=[],
    created_at=2015-06-18 16:35:12 UTC,
    custom_fields=[],
    description="test",
    due_at=nil,
    external_id="",
    forum_topic_id=nil,
    group_id=25818508,
    has_incidents=false,
    organization_id=nil,
    priority="",
    problem_id=nil,
    recipient="",
    requester_id=1069516038,
    satisfaction_rating=nil,
    sharing_agreement_ids=[],
    status="new",
    subject="test",
    submitter_id=1069516038,
    tags=[],
    type="",
    updated_at=2015-06-18 16:35:12 UTC,
    url="https://ray1434039174.zendesk.com/api/v2/tickets/886.json",
    via={"channel"=>"api", "source"=>{"from"=>{}, "to"=>{}, "rel"=>nil}}

I would like to create one more comment to this ticket with this command:

ticket.comments.create({:body => 'test2', :html_body => '<p>test2</p>', :trusted => true, :public => true, :author_id => 1069516038})

and I got this error:

NotImplementedError: NotImplementedError
from /Users/ivangaranin/.rvm/gems/ruby-2.2.0-preview1/gems/zendesk2-1.5.17/lib/zendesk2/client/model.rb:7:in `save!'

Could you help me ?
Thank you,
Ivan

@ivan-garanin ivan-garanin changed the title Could zendesk2 create tickets? Could zendesk2 create new ticket comment? Jun 18, 2015
@ivan-garanin ivan-garanin changed the title Could zendesk2 create new ticket comment? Could zendesk2 create ticket comments? Jun 18, 2015
@lanej
Copy link
Owner

lanej commented Jun 18, 2015

@ivan-garanin i see why you think that should work and it's definitely a bug i will fix soon.

Easy workaround is to use ticket#comment @ https://github.com/lanej/zendesk2/blob/master/lib/zendesk2/client/models/ticket.rb#L97.

ticket.comment('test2', :html_body => '<p>test2</p>', :trusted => true, :public => true, :author_id => 1069516038})

@lanej lanej added the bug label Jun 18, 2015
@ivan-garanin
Copy link
Author

I tried to do somethig like this:

ticket.comments.create('test2', :html_body => '<p>test2</p>', :trusted => true, :public => true,  :author_id => 1069516038)

And got:

 ArgumentError: wrong number of arguments (2 for 0..1)
from /Users/ivangaranin/.rvm/gems/ruby-2.2.0-preview1/gems/zendesk2-1.5.17/lib/zendesk2/paged_collection.rb:76:in `create' 

I hope this will help you in your hunt:

~> ticket.comments.new(:body => 'test2', :html_body => '<p>test2</p>', :trusted => true, :public => true,
:author_id => 1069516038)
 =>   <Zendesk2::Client::TicketComment
    id=nil,
    body="test2",
    html_body="<p>test2</p>",
    public=true,
    trusted=nil,
    author_id=nil,
    attachments=nil `

~> ticket.save
NotImplementedError: NotImplementedError
from /Users/ivangaranin/.rvm/gems/ruby-2.2.0-preview1/gems/zendesk2-1.5.17/lib/zendesk2/client/model.rb:7:in `save!' 

as you see author_id is blank and trusted too

@lanej
Copy link
Owner

lanej commented Jun 18, 2015

@ivan-garanin found the issue. see my workaround in the comment above. specifically take note of the different method ticket.comment(body, options).

@ivan-garanin
Copy link
Author

Sorry for the carelessness.
This helped me!
Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants