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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# File 'lib/faturando_api.rb', line 115
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
104
105
106
|
# File 'lib/faturando_api.rb', line 104
def self.subscribible
self.all.select(&:subscribible)
end
|
Instance Method Details
#feature_value_by_handle(handle) ⇒ Object
108
109
110
111
112
113
|
# File 'lib/faturando_api.rb', line 108
def feature_value_by_handle(handle)
found = feature_values.select do |feature_value|
feature_value.feature.handle == handle
end
found.first
end
|