Class: FreshdeskApiclient::REST::Resources
- Inherits:
-
Object
- Object
- FreshdeskApiclient::REST::Resources
- Defined in:
- lib/freshdesk_apiclient/rest/resources.rb
Direct Known Subclasses
Constant Summary collapse
- ACCEPT_HEADER =
{Accept: 'application/json'}.freeze
- ACCEPT_AND_CONTENT_HEADERS =
ACCEPT_HEADER.merge('Content-Type': 'application/json')
Instance Method Summary collapse
- #create(json_payload) ⇒ Object
-
#initialize(base_url, options = {}) ⇒ Resources
constructor
A new instance of Resources.
- #list(path = nil) ⇒ Object
Constructor Details
#initialize(base_url, options = {}) ⇒ Resources
Returns a new instance of Resources.
14 15 16 17 18 |
# File 'lib/freshdesk_apiclient/rest/resources.rb', line 14 def initialize(base_url, ={}) @base_url = base_url @credentials = [:credentials] RestClient.log = [:logger] end |
Instance Method Details
#create(json_payload) ⇒ Object
25 26 27 28 |
# File 'lib/freshdesk_apiclient/rest/resources.rb', line 25 def create(json_payload) url = full_url execute(url: url, method: :post, headers: ACCEPT_AND_CONTENT_HEADERS, payload: json_payload) end |
#list(path = nil) ⇒ Object
20 21 22 23 |
# File 'lib/freshdesk_apiclient/rest/resources.rb', line 20 def list(path=nil) url = full_url path execute(url: url, method: :get, headers: ACCEPT_HEADER) end |