Class: RubyRedtail::Activities

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-redtail/contact/activities.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_hash) ⇒ Activities

Returns a new instance of Activities.



4
5
6
# File 'lib/ruby-redtail/contact/activities.rb', line 4

def initialize api_hash
  @api_hash = api_hash
end

Instance Method Details

#create(params) ⇒ Object

Create new Activity



24
25
26
# File 'lib/ruby-redtail/contact/activities.rb', line 24

def create(params)
  update(0, params)
end

#fetch(activity_id) ⇒ Object

Fetch Activity By Activity Id



14
15
16
# File 'lib/ruby-redtail/contact/activities.rb', line 14

def fetch (activity_id)
  RubyRedtail::Query.run("calendar/activities/#{activity_id}", @api_hash, "GET")
end

#fetch_by_contact(contact_id, start_date, end_date, basic = true, page = 1) ⇒ Object

Fetch Activities By Contact Id



39
40
41
# File 'lib/ruby-redtail/contact/activities.rb', line 39

def fetch_by_contact (contact_id, start_date, end_date, basic = true, page = 1)
  RubyRedtail::Query.run("contacts/#{contact_id}/activities#{"/basic" if basic}?startdate=#{start_date}&enddate=#{end_date}&page=#{page}", @api_hash, "GET")
end

#fetch_by_user(user_id, start_date, end_date, basic = true, page = 1) ⇒ Object

Fetch Activity By User Id, Start Date and End Date



9
10
11
# File 'lib/ruby-redtail/contact/activities.rb', line 9

def fetch_by_user (user_id, start_date, end_date, basic = true, page = 1)
  RubyRedtail::Query.run("calendar/#{user_id}#{"/basic" if basic}?startdate=#{start_date}&enddate=#{end_date}&page=#{page}", @api_hash, "GET")
end

#mark_complete(activity_id) ⇒ Object

Mark Activity as Complete



29
30
31
# File 'lib/ruby-redtail/contact/activities.rb', line 29

def mark_complete(activity_id)
  RubyRedtail::Query.run("calendar/activities/#{activity_id}/complete", @api_hash, "PUT")
end

#recent(start_date, page = 1) ⇒ Object

Fetch List of Recent Activities



34
35
36
# File 'lib/ruby-redtail/contact/activities.rb', line 34

def recent(start_date, page = 1)
  RubyRedtail::Query.run("calendar/activities/recent?startdate=#{start_date}&page=#{page}", @api_hash, "GET")
end

#update(activity_id, params) ⇒ Object

Update Activity



19
20
21
# File 'lib/ruby-redtail/contact/activities.rb', line 19

def update(activity_id, params)
  RubyRedtail::Query.run("calendar/activities/#{activity_id}", @api_hash, 'PUT', params)
end