Module: ShopifyClient::Resource::Base::ClassMethods
- Defined in:
- lib/shopify-client/resource/base.rb
Instance Method Summary collapse
-
#resource(name_plural, name_singular = nil) ⇒ Object
Set the remote API resource name for the subclass.
Instance Method Details
#resource(name_plural, name_singular = nil) ⇒ Object
Set the remote API resource name for the subclass. If a singular is not provided, the plural will be used, without any trailing āsā.
18 19 20 21 22 23 |
# File 'lib/shopify-client/resource/base.rb', line 18 def resource(name_plural, name_singular = nil) define_method(:resource_name) { name_plural.to_s } define_method(:resource_name_singular) do name_singular ? name_singular.to_s : name_plural.to_s.sub(/s$/, '') end end |