@@ -23,32 +23,32 @@ def get_update(id)
2323
2424 def get_pending_updates ( id , options = { } )
2525 return nil unless verify_token
26- get_get_response ( build_url ( " #{ PROFILE_PATH } / #{ id } / #{ PENDING_PATH } " , options ) )
26+ get_get_response ( build_profile_url ( id , PENDING_PATH , options ) )
2727 end
2828
2929 def get_sent_updates ( id , options = { } )
3030 return nil unless verify_token
31- get_get_response ( build_url ( " #{ PROFILE_PATH } / #{ id } / #{ SENT_PATH } " , options ) )
31+ get_get_response ( build_profile_url ( id , SENT_PATH , options ) )
3232 end
3333
3434 def get_interactions ( id , options = { } )
3535 return nil unless verify_token
36- get_get_response ( build_url ( " #{ UPDATE_PATH } / #{ id } / #{ INTERACTIONS_PATH } " , options ) )
36+ get_get_response ( build_update_url ( id , INTERACTIONS_PATH , options ) )
3737 end
3838
3939 def reorder_updates ( id , updates_array , options = { } )
4040 return nil unless verify_token
4141 post_data = "#{ build_options_string ( options ) } &"
4242 post_data += updates_array . map { |u | "order[]=#{ u } " } . join ( "&" )
4343
44- get_post_response ( build_url ( " #{ PROFILE_PATH } / #{ id } / #{ REORDER_PATH } " ) , post_data )
44+ get_post_response ( build_profile_url ( id , REORDER_PATH ) , post_data )
4545 end
4646
4747 def shuffle_updates ( id , options = { } )
4848 return nil unless verify_token
4949 post_data = build_options_string ( options )
5050
51- get_post_response ( build_url ( " #{ PROFILE_PATH } / #{ id } / #{ SHUFFLE_PATH } " ) , post_data )
51+ get_post_response ( build_profile_url ( id , SHUFFLE_PATH ) , post_data )
5252 end
5353
5454 def create_update ( profile_ids , options = { } )
@@ -63,21 +63,31 @@ def update_status(id, options = {})
6363 return nil unless verify_token
6464 post_data = build_options_string ( options )
6565
66- get_post_response ( build_url ( " #{ UPDATE_PATH } / #{ id } / #{ UPDATE_STATUS_PATH } " ) , post_data )
66+ get_post_response ( build_update_url ( id , UPDATE_STATUS_PATH ) , post_data )
6767 end
6868
6969 def share_update ( id )
7070 return nil unless verify_token
71- get_post_response ( build_url ( " #{ UPDATE_PATH } / #{ id } / #{ SHARE_PATH } " ) )
71+ get_post_response ( build_update_url ( id , SHARE_PATH ) )
7272 end
7373
7474 def destroy_update ( id )
7575 return nil unless verify_token
76- get_post_response ( build_url ( " #{ UPDATE_PATH } / #{ id } / #{ DESTROY_PATH } " ) )
76+ get_post_response ( build_update_url ( id , DESTROY_PATH ) )
7777 end
7878
7979 def move_to_top ( id )
8080 return nil unless verify_token
81- get_post_response ( build_url ( "#{ UPDATE_PATH } /#{ id } /#{ MOVE_TOP_PATH } " ) )
81+ get_post_response ( build_update_url ( id , MOVE_TOP_PATH ) )
82+ end
83+
84+ private
85+
86+ def build_update_url ( id , path , options = { } )
87+ build_url ( "#{ UPDATE_PATH } /#{ id } /#{ path } " , options )
88+ end
89+
90+ def build_profile_url ( id , path , options = { } )
91+ build_url ( "#{ PROFILE_PATH } /#{ id } /#{ path } " , options )
8292 end
8393end
0 commit comments