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

Add contact to freshdesk sdk #3

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
4 changes: 2 additions & 2 deletions freshdesk.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require 'freshdesk/version'
Gem::Specification.new do |s|
s.name = "freshdesk-ruby"
s.version = Freshdesk::VERSION
s.authors = ["Akira Narita"]
s.email = ["[email protected]"]
s.authors = ["Akira Narita", "Graham Novak"]
s.email = ["[email protected]", "[email protected]"]
s.required_ruby_version = ">= 2.2.2"
s.required_rubygems_version = ">= 1.8.11"

Expand Down
1 change: 1 addition & 0 deletions lib/freshdesk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "freshdesk/freshdesk_object"
require "freshdesk/resource"
require "freshdesk/ticket"
require "freshdesk/contact"

module Freshdesk
end
32 changes: 32 additions & 0 deletions lib/freshdesk/contact.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module Freshdesk
class Contact < FreshdeskObject
class << self
def create_a_contact(params: {})
response = new("/contacts").resource(params: params).post
set_attrs_from_response(response)
end

def view_a_contact(id:, query: "")
response = new("/contacts/#{id}#{query}").resource(id: id).get
set_attrs_from_response(response)
end

def list_all_contacts(query: "")
new("/contacts#{query}").resource.get
end

def update_a_contact(id:, params: {})
new("/contacts/#{id}").resource(id: id, params: params).put
end

def delete_a_contact(id:)
new("/contacts/#{id}").resource(id: id).delete
end

def list_all_contact_fields
new("/contacts_fields").resource.get
end

end
end
end
2 changes: 1 addition & 1 deletion lib/freshdesk/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Freshdesk
VERSION = "0.1.0"
VERSION = "0.1.1"
end