Class: Faturando::Plan
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
element_name, #to_xml
#save
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# File 'lib/faturando_api.rb', line 97
def method_missing(method, *args, &block)
if method.to_s.match(/^unlimited_(.+)\?$/)
feature_value = feature_value_by_handle($1)
if feature_value
return feature_value.unlimited
end
end
begin
super
rescue NoMethodError => e
feature_value = feature_value_by_handle(method.to_s)
if feature_value
return feature_value.value
end
raise(e)
end
end
|
Class Method Details
.subscribible ⇒ Object
86
87
88
|
# File 'lib/faturando_api.rb', line 86
def self.subscribible
self.all.select(&:subscribible)
end
|
Instance Method Details
#feature_value_by_handle(handle) ⇒ Object
90
91
92
93
94
95
|
# File 'lib/faturando_api.rb', line 90
def feature_value_by_handle(handle)
found = feature_values.select do |feature_value|
feature_value.feature.handle == handle
end
found.first
end
|