shop.rb 514 B

12345678910111213141516171819202122232425
  1. module ShopifyAPI
  2. # Shop object. Use Shop.current to receive
  3. # the shop.
  4. class Shop < Base
  5. include ActiveResource::Singleton
  6. def self.current(options = {})
  7. find(options)
  8. end
  9. def metafields(**options)
  10. Metafield.find :all, params: options
  11. end
  12. def add_metafield(metafield)
  13. raise ArgumentError, "You can only add metafields to resource that has been saved" if new?
  14. metafield.save
  15. metafield
  16. end
  17. def events
  18. Event.find(:all)
  19. end
  20. end
  21. end