Sha256: b74907c52b8289ee2098251319e82aad1dfdac182490db74f69ef620c8679854
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
module Octobat class UsageItem < APIResource extend Octobat::APIOperations::List include Octobat::APIOperations::Create include Octobat::APIOperations::Delete def url !parent_obj.nil? ? parentize_url : super end def save_url if self[:id] == nil && self.class.respond_to?(:create) self.relative_save_url else url end end def parentize_url if parent_obj.include?(:subscription) "#{Subscription.url}/#{CGI.escape(parent_obj[:subscription])}/usage_items/#{CGI.escape(id)}" else url end end def relative_save_url if self[:subscription] "#{Subscription.url}/#{CGI.escape(self[:subscription])}/usage_items" end end def self.url if @parent_resource.include?(:subscription) "#{Subscription.url}/#{CGI.escape(@parent_resource[:subscription])}/usage_items" end end def self.set_parent_resource(filters) @parent_resource = filters.select{|k, v| [:subscription].include?(k)} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
octobat-2.0.27 | lib/octobat/usage_item.rb |
octobat-2.0.26 | lib/octobat/usage_item.rb |
octobat-2.0.25 | lib/octobat/usage_item.rb |