Class: GridCLI::Post::PostBase
- Inherits:
-
BaseResource
- Object
- ActiveResource::Base
- BaseResource
- GridCLI::Post::PostBase
- Defined in:
- lib/gridcli/resources/post.rb
Class Method Summary collapse
-
.create(attributes) ⇒ Object
before we create, resolve names from subgrid and call hooks.
Instance Method Summary collapse
-
#to_post_json ⇒ Object
if we just call post.to_json, the root attribute will be “post” for prettyprint, the root attribute needs to be one of: like,dislike,status,message.
Methods inherited from BaseResource
Class Method Details
.create(attributes) ⇒ Object
before we create, resolve names from subgrid and call hooks
6 7 8 9 10 11 12 |
# File 'lib/gridcli/resources/post.rb', line 6 def self.create(attributes) subgrids = SubGrids.new users = attributes[:recipients].split(",") attributes[:recipients] = subgrids.resolve(users).join(",") attributes = GridCLI.hooker.invoke :before_post_creation, attributes super attributes end |
Instance Method Details
#to_post_json ⇒ Object
if we just call post.to_json, the root attribute will be “post” for prettyprint, the root attribute needs to be one of: like,dislike,status,message
16 17 18 19 |
# File 'lib/gridcli/resources/post.rb', line 16 def to_post_json type = self.class.name.split("::").last.downcase to_json(:root => type) end |