Class: Chargify::ProductFamily::Component
- Defined in:
- lib/chargify_api_ares/resources/product_family.rb
Class Method Summary collapse
Instance Method Summary collapse
- #component_kind ⇒ Object
- #component_kind_plural ⇒ Object
-
#create ⇒ Object
Create uses a different path other than the collection_path.
- #create_path(options = nil) ⇒ Object
Methods inherited from Base
Class Method Details
.create_path(prefix_options = {}, query_options = nil) ⇒ Object
16 17 18 19 20 |
# File 'lib/chargify_api_ares/resources/product_family.rb', line 16 def self.create_path( = {}, = nil) () , = () if .nil? "#{prefix()}:component_kind_plural.#{format.extension}#{query_string()}" end |
Instance Method Details
#component_kind ⇒ Object
36 37 38 |
# File 'lib/chargify_api_ares/resources/product_family.rb', line 36 def component_kind @attributes['kind'] end |
#component_kind_plural ⇒ Object
40 41 42 |
# File 'lib/chargify_api_ares/resources/product_family.rb', line 40 def component_kind_plural "#{self.component_kind}s" end |
#create ⇒ Object
Create uses a different path other than the collection_path. It is expected to POST to /product_families/:product_family_id/:plural_kind.xml
29 30 31 32 33 34 |
# File 'lib/chargify_api_ares/resources/product_family.rb', line 29 def create connection.post(create_path, encode(:root => component_kind, :except => [:kind]), self.class.headers).tap do |response| self.id = id_from_response(response) load_attributes_from_response(response) end end |
#create_path(options = nil) ⇒ Object
22 23 24 25 |
# File 'lib/chargify_api_ares/resources/product_family.rb', line 22 def create_path( = nil) path = self.class.create_path( || ) path.gsub(/:component_kind_plural/, component_kind_plural) end |