Class: Ubiquitously::Service::Post

Inherits:
Base show all
Includes:
Loggable::Post, Ownable::Post, Postable::Post, Restful::Post
Defined in:
lib/ubiquitously/models/service/post.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loggable::Post

included

Methods included from Restful::Post

included

Methods included from Postable::Post

included

Methods included from Ownable::Post

included

Methods inherited from Base

#apply, #debug?

Methods included from SubclassableCallbacks

included, override

Constructor Details

#initialize(attributes = {}) ⇒ Post

Returns a new instance of Post.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ubiquitously/models/service/post.rb', line 34

def initialize(attributes = {})
  apply attributes
  
  raise 'please give me a user' if self.user.blank?
  
  self.format ||= "text"
  self.privacy = 0 if self.privacy.nil?
  self.categories ||= []
  self.tags ||= []
  self.upvotes ||= 0
  self.downvotes ||= 0
  
  # for httparty
  @auth = {:username => username, :password => password}
end

Instance Attribute Details

#captchaObject

some sites check to see if you’re posting duplicate content! perhaps “vote” can mean “favorite” also



16
17
18
# File 'lib/ubiquitously/models/service/post.rb', line 16

def captcha
  @captcha
end

#categoriesObject

Returns the value of attribute categories.



13
14
15
# File 'lib/ubiquitously/models/service/post.rb', line 13

def categories
  @categories
end

#descriptionObject

Returns the value of attribute description.



13
14
15
# File 'lib/ubiquitously/models/service/post.rb', line 13

def description
  @description
end

#downvotesObject

Returns the value of attribute downvotes.



17
18
19
# File 'lib/ubiquitously/models/service/post.rb', line 17

def downvotes
  @downvotes
end

#extensionObject

plain, html, markdown



23
24
25
# File 'lib/ubiquitously/models/service/post.rb', line 23

def extension
  @extension
end

#formatObject

plain, html, markdown



23
24
25
# File 'lib/ubiquitously/models/service/post.rb', line 23

def format
  @format
end

#imageObject

some sites check to see if you’re posting duplicate content! perhaps “vote” can mean “favorite” also



16
17
18
# File 'lib/ubiquitously/models/service/post.rb', line 16

def image
  @image
end

#kindObject

kind == regular, link, quote, photo, conversation, video, audio, answer



21
22
23
# File 'lib/ubiquitously/models/service/post.rb', line 21

def kind
  @kind
end

#must_be_uniqueObject

some sites check to see if you’re posting duplicate content! perhaps “vote” can mean “favorite” also



16
17
18
# File 'lib/ubiquitously/models/service/post.rb', line 16

def must_be_unique
  @must_be_unique
end

#privacyObject

some sites check to see if you’re posting duplicate content! perhaps “vote” can mean “favorite” also



16
17
18
# File 'lib/ubiquitously/models/service/post.rb', line 16

def privacy
  @privacy
end

#ratingObject

some sites check to see if you’re posting duplicate content! perhaps “vote” can mean “favorite” also



16
17
18
# File 'lib/ubiquitously/models/service/post.rb', line 16

def rating
  @rating
end

#remoteObject

Returns the value of attribute remote.



13
14
15
# File 'lib/ubiquitously/models/service/post.rb', line 13

def remote
  @remote
end

#service_idObject

Returns the value of attribute service_id.



13
14
15
# File 'lib/ubiquitously/models/service/post.rb', line 13

def service_id
  @service_id
end

#service_urlObject

Returns the value of attribute service_url.



17
18
19
# File 'lib/ubiquitously/models/service/post.rb', line 17

def service_url
  @service_url
end

#slugObject

max 55 chars, for custom url if possible



25
26
27
# File 'lib/ubiquitously/models/service/post.rb', line 25

def slug
  @slug
end

#sourceObject

the application that automates! (“Posted by TweetMeme”)



19
20
21
# File 'lib/ubiquitously/models/service/post.rb', line 19

def source
  @source
end

#source_urlObject

the application that automates! (“Posted by TweetMeme”)



19
20
21
# File 'lib/ubiquitously/models/service/post.rb', line 19

def source_url
  @source_url
end

#stateObject

published, draft, submission, queue



27
28
29
# File 'lib/ubiquitously/models/service/post.rb', line 27

def state
  @state
end

#statusObject

some sites check to see if you’re posting duplicate content! perhaps “vote” can mean “favorite” also



16
17
18
# File 'lib/ubiquitously/models/service/post.rb', line 16

def status
  @status
end

#tagsObject

Returns the value of attribute tags.



13
14
15
# File 'lib/ubiquitously/models/service/post.rb', line 13

def tags
  @tags
end

#titleObject

Returns the value of attribute title.



13
14
15
# File 'lib/ubiquitously/models/service/post.rb', line 13

def title
  @title
end

#tokenObject

validates_presence_of :title, :description, :tags



12
13
14
# File 'lib/ubiquitously/models/service/post.rb', line 12

def token
  @token
end

#upvotesObject

Returns the value of attribute upvotes.



17
18
19
# File 'lib/ubiquitously/models/service/post.rb', line 17

def upvotes
  @upvotes
end

#urlObject

Returns the value of attribute url.



13
14
15
# File 'lib/ubiquitously/models/service/post.rb', line 13

def url
  @url
end

#userObject

Returns the value of attribute user.



17
18
19
# File 'lib/ubiquitously/models/service/post.rb', line 17

def user
  @user
end

#voteObject

some sites check to see if you’re posting duplicate content! perhaps “vote” can mean “favorite” also



16
17
18
# File 'lib/ubiquitously/models/service/post.rb', line 16

def vote
  @vote
end

Instance Method Details

#access_tokenObject



54
55
56
# File 'lib/ubiquitously/models/service/post.rb', line 54

def access_token
  user.(self).access_token
end