Sha256: 57121bc4bf3495f06f4f055bf7e8b8654f3615fc253f42bdc5f469bfaf114b09

Contents?: true

Size: 827 Bytes

Versions: 6

Compression:

Stored size: 827 Bytes

Contents

module Mrkt
  module CrudActivities
    def get_activity_types
      get('/rest/v1/activities/types.json')
    end

    def get_paging_token(since_datetime)
      get('/rest/v1/activities/pagingtoken.json', sinceDatetime: since_datetime.iso8601)
    end

    def get_activities(next_page_token, activity_type_ids: [], lead_ids: [])
      params = {
        nextPageToken: next_page_token
      }

      params[:activityTypeIds] = activity_type_ids unless blank?(activity_type_ids)
      params[:leadIds] = lead_ids unless blank?(lead_ids)

      get('/rest/v1/activities.json', params)
    end

    def get_deleted_leads(next_page_token)
      get('/rest/v1/activities/deletedleads.json', nextPageToken: next_page_token)
    end

    private

    def blank?(value)
      !value || value == '' || value.empty?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mrkt-1.2.2 lib/mrkt/concerns/crud_activities.rb
mrkt-1.2.1 lib/mrkt/concerns/crud_activities.rb
mrkt-1.2.0 lib/mrkt/concerns/crud_activities.rb
mrkt-1.1.1 lib/mrkt/concerns/crud_activities.rb
mrkt-1.1.0 lib/mrkt/concerns/crud_activities.rb
mrkt-1.0.1 lib/mrkt/concerns/crud_activities.rb