Class: Flow

Inherits:
Flareshow::Base show all
Defined in:
lib/flow.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Flareshow::Base

all, api_endpoint, assimilate_resources, auth_endpoint, authenticate, #changes, commit, create, #destroy, #destroyed?, dispatch, find, first, get, #get, handle_response, http_get, #id, #initialize, list, #method_missing, #method_name, post, process_response, query, #refresh, #save, server_defined?, #set, store, #update

Constructor Details

This class inherits a constructor from Flareshow::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Flareshow::Base

Class Method Details

.find_by_name(name) ⇒ Object

find a flow by name



8
9
10
# File 'lib/flow.rb', line 8

def find_by_name(name)
  self.find({:name => name})
end

Instance Method Details

#build_post(attributes) ⇒ Object

build a new post but don’t persist it immediatel



43
44
45
46
47
48
# File 'lib/flow.rb', line 43

def build_post(attributes)
  post = Post.new
  post.update(attributes)
  post.flow_id = id
  post
end

#create_post(attributes) ⇒ Object

create a new post in this flow



51
52
53
54
# File 'lib/flow.rb', line 51

def create_post(attributes)
  p=build_post(attributes)
  p.save
end

permalink for this flow



14
15
16
17
18
19
20
# File 'lib/flow.rb', line 14

def permalink(mobile=false)
  if mobile
    "http://#{Flareshow::Base.server.host}/#{Flareshow::Base.server.domain}/shareflow/mobile/flows/#{id}"
  else
    "http://#{Flareshow::Base.server.host}/#{Flareshow::Base.server.domain}/shareflow/c/#{id}"
  end
end

#remove_members(member_ids) ⇒ Object

remove a user from a flow you must be the owner of the flow to perform this action



37
38
39
40
# File 'lib/flow.rb', line 37

def remove_members(member_ids)
  self.remove_members = [email_addresses].flatten
  self.save
end

#revoke_invitations(email_addresses) ⇒ Object

uninvite an invited user from a flow by email address



29
30
31
32
# File 'lib/flow.rb', line 29

def revoke_invitations(email_addresses)
  self.uninvite = [email_addresses].flatten
  self.save
end

#send_invitions(email_addresses) ⇒ Object

invite/reinvite a user to a flow by email address



23
24
25
26
# File 'lib/flow.rb', line 23

def send_invitions(email_addresses)
  self.invite = [email_addresses].flatten
  self.save
end