Module: Riaction::Riaction::Profile::InstanceMethods
- Defined in:
- lib/riaction/riaction.rb
Instance Method Summary collapse
- #riaction_profile_achievements(filter_type = nil) ⇒ Object
- #riaction_profile_challenges(filter_type = nil) ⇒ Object
- #riaction_profile_display_name ⇒ Object
- #riaction_profile_goals(filter_type = nil) ⇒ Object
- #riaction_profile_keys ⇒ Object
- #riaction_profile_notifications ⇒ Object
- #riaction_profile_points(point_type) ⇒ Object
-
#riaction_profile_summary(achievement_count = nil) ⇒ Object
API wrappers #.
- #riaction_raw_data ⇒ Object
- #riaction_set_profile(type) ⇒ Object
- #riaction_update_profile_points(point_type, amount, reason = "") ⇒ Object
- #riaction_wrap_data ⇒ Object
- #riaction_wrap_response_data(bool) ⇒ Object
- #riaction_wrap_response_data? ⇒ Boolean
Instance Method Details
#riaction_profile_achievements(filter_type = nil) ⇒ Object
277 278 279 280 281 282 283 284 285 |
# File 'lib/riaction/riaction.rb', line 277 def riaction_profile_achievements(filter_type=nil) @iactionable_api ||= IActionable::Api.new keys = riaction_profile_keys.fetch(riaction_use_profile) @iactionable_api.set_object_wrapping(riaction_wrap_response).get_profile_achievements(riaction_use_profile.to_s, keys.first[0].to_s, keys.first[1].to_s, filter_type) rescue KeyError => e raise RuntimeError.new("#{self.to_s} does not define a profile type #{riaction_use_profile}") rescue IActionable::Error::BadRequest => e nil end |
#riaction_profile_challenges(filter_type = nil) ⇒ Object
287 288 289 290 291 292 293 294 295 |
# File 'lib/riaction/riaction.rb', line 287 def riaction_profile_challenges(filter_type=nil) @iactionable_api ||= IActionable::Api.new keys = riaction_profile_keys.fetch(riaction_use_profile) @iactionable_api.set_object_wrapping(riaction_wrap_response).get_profile_challenges(riaction_use_profile.to_s, keys.first[0].to_s, keys.first[1].to_s, filter_type) rescue KeyError => e raise RuntimeError.new("#{self.to_s} does not define a profile type #{riaction_use_profile}") rescue IActionable::Error::BadRequest => e nil end |
#riaction_profile_display_name ⇒ Object
240 241 242 243 244 |
# File 'lib/riaction/riaction.rb', line 240 def riaction_profile_display_name riaction_resolve_param self.class.riaction_profile_keys.fetch(riaction_use_profile)[:display_name] rescue KeyError => e raise RuntimeError.new("#{self.to_s} does not define a profile type #{riaction_use_profile}") end |
#riaction_profile_goals(filter_type = nil) ⇒ Object
297 298 299 300 301 302 303 304 305 |
# File 'lib/riaction/riaction.rb', line 297 def riaction_profile_goals(filter_type=nil) @iactionable_api ||= IActionable::Api.new keys = riaction_profile_keys.fetch(riaction_use_profile) @iactionable_api.set_object_wrapping(riaction_wrap_response).get_profile_goals(riaction_use_profile.to_s, keys.first[0].to_s, keys.first[1].to_s, filter_type) rescue KeyError => e raise RuntimeError.new("#{self.to_s} does not define a profile type #{riaction_use_profile}") rescue IActionable::Error::BadRequest => e nil end |
#riaction_profile_keys ⇒ Object
223 224 225 226 227 228 229 230 231 232 |
# File 'lib/riaction/riaction.rb', line 223 def riaction_profile_keys resolved_hash = {} self.class.riaction_profile_keys.each_pair do |profile_type, opts| resolved_hash[profile_type] = {} opts.fetch(:identifiers, {}).each_pair do |identifier_type, value| resolved_hash[profile_type][identifier_type] = riaction_resolve_param(value) end end resolved_hash end |
#riaction_profile_notifications ⇒ Object
307 308 309 310 311 312 313 314 315 |
# File 'lib/riaction/riaction.rb', line 307 def riaction_profile_notifications @iactionable_api ||= IActionable::Api.new keys = riaction_profile_keys.fetch(riaction_use_profile) @iactionable_api.set_object_wrapping(riaction_wrap_response).get_profile_notifications(riaction_use_profile.to_s, keys.first[0].to_s, keys.first[1].to_s) rescue KeyError => e raise RuntimeError.new("#{self.to_s} does not define a profile type #{riaction_use_profile}") rescue IActionable::Error::BadRequest => e nil end |
#riaction_profile_points(point_type) ⇒ Object
317 318 319 320 321 322 323 324 325 |
# File 'lib/riaction/riaction.rb', line 317 def riaction_profile_points(point_type) @iactionable_api ||= IActionable::Api.new keys = riaction_profile_keys.fetch(riaction_use_profile) @iactionable_api.set_object_wrapping(riaction_wrap_response).get_profile_points(riaction_use_profile.to_s, keys.first[0].to_s, keys.first[1].to_s, point_type) rescue KeyError => e raise RuntimeError.new("#{self.to_s} does not define a profile type #{riaction_use_profile}") rescue IActionable::Error::BadRequest => e nil end |
#riaction_profile_summary(achievement_count = nil) ⇒ Object
API wrappers #
267 268 269 270 271 272 273 274 275 |
# File 'lib/riaction/riaction.rb', line 267 def riaction_profile_summary(achievement_count=nil) @iactionable_api ||= IActionable::Api.new keys = riaction_profile_keys.fetch(riaction_use_profile) @iactionable_api.set_object_wrapping(riaction_wrap_response).get_profile_summary(riaction_use_profile.to_s, keys.first[0].to_s, keys.first[1].to_s, achievement_count) rescue KeyError => e raise RuntimeError.new("#{self.to_s} does not define a profile type #{riaction_use_profile}") rescue IActionable::Error::BadRequest => e nil end |
#riaction_raw_data ⇒ Object
259 260 261 |
# File 'lib/riaction/riaction.rb', line 259 def riaction_raw_data riaction_wrap_response_data(false) end |
#riaction_set_profile(type) ⇒ Object
234 235 236 237 238 |
# File 'lib/riaction/riaction.rb', line 234 def riaction_set_profile(type) raise RuntimeError.new("#{self.to_s} does not define a profile type #{type}") unless riaction_profile_keys.has_key?(type) @riaction_use_profile = type self end |
#riaction_update_profile_points(point_type, amount, reason = "") ⇒ Object
327 328 329 330 331 332 333 334 335 |
# File 'lib/riaction/riaction.rb', line 327 def riaction_update_profile_points(point_type, amount, reason="") @iactionable_api ||= IActionable::Api.new keys = riaction_profile_keys.fetch(riaction_use_profile) @iactionable_api.update_profile_points(riaction_use_profile.to_s, keys.first[0].to_s, keys.first[1].to_s, point_type, amount, reason) rescue KeyError => e raise RuntimeError.new("#{self.to_s} does not define a profile type #{riaction_use_profile}") rescue IActionable::Error::BadRequest => e nil end |
#riaction_wrap_data ⇒ Object
255 256 257 |
# File 'lib/riaction/riaction.rb', line 255 def riaction_wrap_data riaction_wrap_response_data(true) end |
#riaction_wrap_response_data(bool) ⇒ Object
246 247 248 249 |
# File 'lib/riaction/riaction.rb', line 246 def riaction_wrap_response_data(bool) @riaction_wrap_response = !!bool self end |
#riaction_wrap_response_data? ⇒ Boolean
251 252 253 |
# File 'lib/riaction/riaction.rb', line 251 def riaction_wrap_response_data? riaction_wrap_response end |