Module: Intercom::ApiOperations::Find
- Included in:
- Service::Admin, Service::Article, Service::Collection, Service::Company, Service::Contact, Service::Conversation, Service::Counts, Service::ExportContent, Service::Job, Service::Lead, Service::Note, Service::Section, Service::Segment, Service::Subscription, Service::SubscriptionType, Service::Tag, Service::Team, Service::User, Service::Visitor
- Defined in:
- lib/intercom/api_operations/find.rb
Instance Method Summary collapse
Instance Method Details
#find(params) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/intercom/api_operations/find.rb', line 8 def find(params) raise BadRequestError, "#{self}#find takes a hash as its parameter but you supplied #{params.inspect}" unless params.is_a? Hash if params[:id] id = params.delete(:id) response = @client.get("/#{collection_name}/#{id}", params) else response = @client.get("/#{collection_name}", params) end raise Intercom::HttpError, 'Http Error - No response entity returned' unless response from_api(response) end |