diff --git a/lib/twilio-ruby/rest/instance_resource.rb b/lib/twilio-ruby/rest/instance_resource.rb index f2e3e3a72..d4faf8e3c 100644 --- a/lib/twilio-ruby/rest/instance_resource.rb +++ b/lib/twilio-ruby/rest/instance_resource.rb @@ -82,20 +82,6 @@ def set_up_properties_from(hash) end @updated = !hash.keys.empty? end - - def resource(*resources) - custom_resource_names = {:sms => 'SMS', :sip => 'SIP'} - resources.each do |r| - resource = twilify r - relative_path = custom_resource_names.fetch(r, resource) - path = "#{@path}/#{relative_path}" - enclosing_module = @submodule == nil ? (Twilio::REST) : (Twilio::REST.const_get(@submodule)) - resource_class = enclosing_module.const_get resource - instance_variable_set("@#{r}", resource_class.new(path, @client)) - end - self.class.instance_eval {attr_reader *resources} - end - end end end diff --git a/lib/twilio-ruby/rest/list_resource.rb b/lib/twilio-ruby/rest/list_resource.rb index 295046da1..b4a564954 100644 --- a/lib/twilio-ruby/rest/list_resource.rb +++ b/lib/twilio-ruby/rest/list_resource.rb @@ -95,22 +95,6 @@ def create(params={}) @instance_class.new "#{@path}/#{response[@instance_id_key]}", @client, response end - - def resource(*resources) - custom_resource_names = { - :sms => 'SMS', - :sip => 'SIP', - } - resources.each do |r| - resource = twilify r - relative_path = custom_resource_names.fetch(r, resource) - path = "#{@path}/#{relative_path}" - enclosing_module = @submodule == nil ? (Twilio::REST) : (Twilio::REST.const_get(@submodule)) - resource_class = enclosing_module.const_get resource - instance_variable_set("@#{r}", resource_class.new(path, @client)) - end - self.class.instance_eval {attr_reader *resources} - end end end end diff --git a/lib/twilio-ruby/rest/utils.rb b/lib/twilio-ruby/rest/utils.rb index fb6cdffd9..214619904 100644 --- a/lib/twilio-ruby/rest/utils.rb +++ b/lib/twilio-ruby/rest/utils.rb @@ -20,6 +20,23 @@ def detwilify(something) end end + protected + + def resource(*resources) + custom_resource_names = { + :sms => 'SMS', + :sip => 'SIP' + } + resources.each do |r| + resource = twilify r + relative_path = custom_resource_names.fetch(r, resource) + path = "#{@path}/#{relative_path}" + enclosing_module = @submodule == nil ? (Twilio::REST) : (Twilio::REST.const_get(@submodule)) + resource_class = enclosing_module.const_get resource + instance_variable_set("@#{r}", resource_class.new(path, @client)) + end + self.class.instance_eval {attr_reader *resources} + end end end end