소스 검색

Move #only_id to Base

Denis Odorcic 13 년 전
부모
커밋
6712ee3974
3개의 변경된 파일5개의 추가작업 그리고 8개의 파일을 삭제
  1. 5 0
      lib/shopify_api/resources/base.rb
  2. 0 4
      lib/shopify_api/resources/comment.rb
  3. 0 4
      lib/shopify_api/resources/order.rb

+ 5 - 0
lib/shopify_api/resources/base.rb

@@ -2,5 +2,10 @@ module ShopifyAPI
   class Base < ActiveResource::Base
     extend Countable
     self.include_root_in_json = false
+
+    private
+    def only_id
+      encode(:only => :id, :include => [], :methods => [])
+    end
   end
 end

+ 0 - 4
lib/shopify_api/resources/comment.rb

@@ -5,9 +5,5 @@ module ShopifyAPI
     def approve;  load_attributes_from_response(post(:approve, {}, only_id)); end
     def restore;  load_attributes_from_response(post(:restore, {}, only_id)); end
     def not_spam; load_attributes_from_response(post(:not_spam, {}, only_id)); end
-
-    def only_id
-      encode(:only => :id)
-    end
   end
 end

+ 0 - 4
lib/shopify_api/resources/order.rb

@@ -17,9 +17,5 @@ module ShopifyAPI
     def capture(amount = "")
       Transaction.create(:amount => amount, :kind => "capture", :order_id => id)
     end
-
-    def only_id
-      encode(:only => :id, :include => [], :methods => [], :fields => [])
-    end
   end
 end