Class: Mambu::ApiModel
- Inherits:
-
Object
show all
- Defined in:
- lib/mambu/api_model.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ ApiModel
Returns a new instance of ApiModel.
3
4
5
6
7
8
|
# File 'lib/mambu/api_model.rb', line 3
def initialize(data)
data.each do |method_name, value|
self.class.send(:attr_accessor, method_name) unless self.class.method_defined?(method_name)
send("#{method_name}=", value)
end
end
|
Class Method Details
.api_uri ⇒ Object
14
15
16
|
# File 'lib/mambu/api_model.rb', line 14
def self.api_uri
name.demodulize.downcase.pluralize
end
|
.endpoint(connection) ⇒ Object
10
11
12
|
# File 'lib/mambu/api_model.rb', line 10
def self.endpoint(connection)
"#{connection.api_url}/#{api_uri}"
end
|