Class: MambaNation::Base
- Inherits:
-
Object
- Object
- MambaNation::Base
- Extended by:
- Forwardable
- Defined in:
- lib/mambanation/base.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#fbs_cookies ⇒ Object
readonly
Returns the value of attribute fbs_cookies.
-
#signed_request ⇒ Object
readonly
Returns the value of attribute signed_request.
Class Method Summary collapse
-
.current_user(client, options = {}) ⇒ Object
Class method to fetch current user based on cookie.
Instance Method Summary collapse
- #activate_user(id) ⇒ Object
-
#announcements(id, query = {}) ⇒ Object
User Announcements.
- #anonymate_user(id) ⇒ Object
-
#badges(query = {}) ⇒ Object
Badges.
- #create_post(id, post, application_id, query = {}) ⇒ Object
- #current_user(query = {}) ⇒ Object
-
#facet(facet_id, query = {}) ⇒ Object
Facets.
- #facet_coms(facet_id, query = {}) ⇒ Object
- #facet_messages(facet_id, query = {}) ⇒ Object
-
#famous(query = {}) ⇒ Object
Famous.
- #famous_facets(query = {}) ⇒ Object
- #favorite_facet(id, facet_id, query = {}) ⇒ Object
-
#initialize(client, options = {}) ⇒ Base
constructor
A new instance of Base.
- #mission_start!(id, mission_id, query = {}) ⇒ Object
-
#mission_status(id, mission_id, query = {}) ⇒ Object
Mission Statuses.
- #mission_statuses(id, query = {}) ⇒ Object
- #missions_family_statuses(id, query = {}) ⇒ Object
-
#posts(id, query = {}) ⇒ Object
Posts.
- #publish_post(id, stream_id, query = {}) ⇒ Object
- #read_user_announcement(id, announcement_id, query = {}) ⇒ Object
- #read_user_message(id, message_id, query = {}) ⇒ Object
- #suspend_user(id) ⇒ Object
- #user(id, query = {}) ⇒ Object (also: #user_by_id)
- #user_actions(id, query = {}) ⇒ Object
- #user_badges(id, query = {}) ⇒ Object
- #user_by_email(email, query = {}) ⇒ Object
- #user_by_facebook_id(facebook_id, query = {}) ⇒ Object
- #user_chats(id, query = {}) ⇒ Object
- #user_coms(id, query = {}) ⇒ Object
-
#user_facets(id, query = {}) ⇒ Object
Options: user_id.
-
#user_friends(id, query = {}) ⇒ Object
Options: user_id, facebook_id.
-
#user_last_login(id, query = {}) ⇒ Object
User actions.
-
#user_media(id, query = {}) ⇒ Object
Options: user_id, :limit.
-
#user_posts(id, query = {}) ⇒ Object
options: application_id => Integer, Array.
-
#user_roles(id, query = {}) ⇒ Object
Roles.
- #user_set_websession(id, credentials, query = {}) ⇒ Object
-
#user_system_messages(id, query = {}) ⇒ Object
Users System Messages.
- #user_unread_system_messages(id, query = {}) ⇒ Object
Constructor Details
#initialize(client, options = {}) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 |
# File 'lib/mambanation/base.rb', line 9 def initialize(client, = {}) @client = client @fbs_cookies = .delete(:fbs_cookies) if .has_key? :fbs_cookies @signed_request = .delete(:signed_request) if .has_key? :signed_request end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'lib/mambanation/base.rb', line 7 def client @client end |
#fbs_cookies ⇒ Object (readonly)
Returns the value of attribute fbs_cookies.
7 8 9 |
# File 'lib/mambanation/base.rb', line 7 def @fbs_cookies end |
#signed_request ⇒ Object (readonly)
Returns the value of attribute signed_request.
7 8 9 |
# File 'lib/mambanation/base.rb', line 7 def signed_request @signed_request end |
Class Method Details
.current_user(client, options = {}) ⇒ Object
Class method to fetch current user based on cookie
16 17 18 |
# File 'lib/mambanation/base.rb', line 16 def self.current_user(client, = {}) MambaNation::Base.new(client, ).current_user end |
Instance Method Details
#activate_user(id) ⇒ Object
67 68 69 |
# File 'lib/mambanation/base.rb', line 67 def activate_user(id) perform_put("/users/#{id.to_i}/activate") end |
#announcements(id, query = {}) ⇒ Object
User Announcements
194 195 196 |
# File 'lib/mambanation/base.rb', line 194 def announcements(id, query = {}) perform_get("/users/#{id.to_i}/announcements.json", :query => query) end |
#anonymate_user(id) ⇒ Object
71 72 73 |
# File 'lib/mambanation/base.rb', line 71 def anonymate_user(id) perform_put("/users/#{id.to_i}/anonymate") end |
#badges(query = {}) ⇒ Object
Badges
121 122 123 |
# File 'lib/mambanation/base.rb', line 121 def badges(query = {}) perform_get("/badges.json", :query => query) end |
#create_post(id, post, application_id, query = {}) ⇒ Object
161 162 163 |
# File 'lib/mambanation/base.rb', line 161 def create_post(id, post, application_id, query = {}) perform_post("/posts", :body => { :user_id => id, :post => post, :application_id => application_id }.merge(query)) end |
#current_user(query = {}) ⇒ Object
27 28 29 |
# File 'lib/mambanation/base.rb', line 27 def current_user(query = {}) perform_get("/users/me", :query => query) end |
#facet(facet_id, query = {}) ⇒ Object
Facets
Options: facet_id
93 94 95 |
# File 'lib/mambanation/base.rb', line 93 def facet(facet_id, query = {}) perform_get("/facets/#{facet_id.to_i}.json", :query => query) end |
#facet_coms(facet_id, query = {}) ⇒ Object
110 111 112 |
# File 'lib/mambanation/base.rb', line 110 def facet_coms(facet_id, query = {}) perform_get("/facets/#{facet_id.to_i}/coms.json", :query => query) end |
#facet_messages(facet_id, query = {}) ⇒ Object
114 115 116 |
# File 'lib/mambanation/base.rb', line 114 def (facet_id, query = {}) perform_get("/facets/#{facet_id.to_i}/messages.json", :query => query) end |
#famous(query = {}) ⇒ Object
Famous
23 24 25 |
# File 'lib/mambanation/base.rb', line 23 def famous(query = {}) perform_get("/users/famous.json", :query => query) end |
#famous_facets(query = {}) ⇒ Object
97 98 99 |
# File 'lib/mambanation/base.rb', line 97 def famous_facets(query = {}) perform_get("/facets/famous.json", :query => query) end |
#favorite_facet(id, facet_id, query = {}) ⇒ Object
101 102 103 |
# File 'lib/mambanation/base.rb', line 101 def favorite_facet(id, facet_id, query = {}) perform_put("/facets/#{facet_id.to_i}/favorite.json", :query => query) end |
#mission_start!(id, mission_id, query = {}) ⇒ Object
144 145 146 |
# File 'lib/mambanation/base.rb', line 144 def mission_start!(id, mission_id, query = {}) perform_put("/users/#{id.to_i}/mission_statuses/#{mission_id.to_i}/start", :query => {}.merge(query)) end |
#mission_status(id, mission_id, query = {}) ⇒ Object
Mission Statuses
132 133 134 |
# File 'lib/mambanation/base.rb', line 132 def mission_status(id, mission_id, query = {}) perform_get("/users/#{id.to_i}/mission_status/#{mission_id}.json", :query => query) end |
#mission_statuses(id, query = {}) ⇒ Object
136 137 138 |
# File 'lib/mambanation/base.rb', line 136 def mission_statuses(id, query = {}) perform_get("/users/#{id.to_i}/mission_statuses.json", :query => query) end |
#missions_family_statuses(id, query = {}) ⇒ Object
140 141 142 |
# File 'lib/mambanation/base.rb', line 140 def missions_family_statuses(id, query = {}) perform_get("/users/#{id.to_i}/missions_family_statuses.json", :query => query) end |
#posts(id, query = {}) ⇒ Object
Posts
151 152 153 |
# File 'lib/mambanation/base.rb', line 151 def posts(id, query = {}) perform_get("/posts/#{id}.json", :query => query) end |
#publish_post(id, stream_id, query = {}) ⇒ Object
165 166 167 |
# File 'lib/mambanation/base.rb', line 165 def publish_post(id, stream_id, query = {}) perform_post("/posts/#{id}/publish.json", :body => { :post => { :stream_id => stream_id } }.merge(query)) end |
#read_user_announcement(id, announcement_id, query = {}) ⇒ Object
198 199 200 |
# File 'lib/mambanation/base.rb', line 198 def read_user_announcement(id, announcement_id, query = {}) perform_put("/users/#{id.to_i}/announcements/#{announcement_id.to_i}/read.json", :query => query) end |
#read_user_message(id, message_id, query = {}) ⇒ Object
187 188 189 |
# File 'lib/mambanation/base.rb', line 187 def (id, , query = {}) perform_post("/users/#{id.to_i}/messages/#{.to_i}/read.json", :body => {}.merge(query)) end |
#suspend_user(id) ⇒ Object
75 76 77 |
# File 'lib/mambanation/base.rb', line 75 def suspend_user(id) perform_put("/users/#{id.to_i}/suspend") end |
#user(id, query = {}) ⇒ Object Also known as: user_by_id
39 40 41 |
# File 'lib/mambanation/base.rb', line 39 def user(id, query = {}) perform_get("/users/#{id.to_i}.json", :query => query) end |
#user_actions(id, query = {}) ⇒ Object
63 64 65 |
# File 'lib/mambanation/base.rb', line 63 def user_actions(id, query = {}) perform_get("/users/#{id.to_i}/actions.json", :query => query) end |
#user_badges(id, query = {}) ⇒ Object
125 126 127 |
# File 'lib/mambanation/base.rb', line 125 def user_badges(id, query = {}) perform_get("/users/#{id.to_i}/badges.json", :query => query) end |
#user_by_email(email, query = {}) ⇒ Object
35 36 37 |
# File 'lib/mambanation/base.rb', line 35 def user_by_email(email, query = {}) perform_get("/users/find_by?facebook_id=#{email}", :query => query) end |
#user_by_facebook_id(facebook_id, query = {}) ⇒ Object
31 32 33 |
# File 'lib/mambanation/base.rb', line 31 def user_by_facebook_id(facebook_id, query = {}) perform_get("/users/find_by?facebook_id=#{facebook_id.to_i}", :query => query) end |
#user_chats(id, query = {}) ⇒ Object
55 56 57 |
# File 'lib/mambanation/base.rb', line 55 def user_chats(id, query = {}) perform_get("/users/#{id.to_i}/chats.json", :query => query) end |
#user_coms(id, query = {}) ⇒ Object
59 60 61 |
# File 'lib/mambanation/base.rb', line 59 def user_coms(id, query = {}) perform_get("/users/#{id.to_i}/coms.json", :query => query) end |
#user_facets(id, query = {}) ⇒ Object
Options: user_id
106 107 108 |
# File 'lib/mambanation/base.rb', line 106 def user_facets(id, query = {}) perform_get("/users/#{id.to_i}/facets.json", :query => query) end |
#user_friends(id, query = {}) ⇒ Object
Options: user_id, facebook_id
85 86 87 |
# File 'lib/mambanation/base.rb', line 85 def user_friends(id, query = {}) perform_get("/users/#{id.to_i}/friends.json", :query => query) end |
#user_last_login(id, query = {}) ⇒ Object
User actions
51 52 53 |
# File 'lib/mambanation/base.rb', line 51 def user_last_login(id, query = {}) perform_get("/users/#{id.to_i}/last_login.json", :query => query) end |
#user_media(id, query = {}) ⇒ Object
Options: user_id, :limit
80 81 82 |
# File 'lib/mambanation/base.rb', line 80 def user_media(id, query = {}) perform_get("/users/#{id.to_i}/media.json", :query => {}.merge(query)) end |
#user_posts(id, query = {}) ⇒ Object
options:
application_id => Integer, Array
157 158 159 |
# File 'lib/mambanation/base.rb', line 157 def user_posts(id, query = {}) perform_get("/users/#{id.to_i}/posts.json", :query => query) end |
#user_roles(id, query = {}) ⇒ Object
Roles
172 173 174 |
# File 'lib/mambanation/base.rb', line 172 def user_roles(id, query = {}) perform_get("/users/#{id.to_i}/roles.json", :query => query) end |
#user_set_websession(id, credentials, query = {}) ⇒ Object
44 45 46 |
# File 'lib/mambanation/base.rb', line 44 def user_set_websession(id, credentials, query = {}) perform_post("/users/#{id.to_i}/update_websession", :body => { :user => { :user_credentials => credentials } }.merge(query)) end |
#user_system_messages(id, query = {}) ⇒ Object
Users System Messages
179 180 181 |
# File 'lib/mambanation/base.rb', line 179 def (id, query = {}) perform_get("/users/#{id.to_i}/system_messages.json", :query => query) end |
#user_unread_system_messages(id, query = {}) ⇒ Object
183 184 185 |
# File 'lib/mambanation/base.rb', line 183 def (id, query = {}) perform_get("/users/#{id.to_i}/unread_system_messages.json", :query => query) end |