Class: Trubl::Base
- Inherits:
-
Hashie::Mash
- Object
- Hashie::Mash
- Trubl::Base
show all
- Defined in:
- lib/trubl/base.rb
Instance Method Summary
collapse
Instance Method Details
#from_response(response) ⇒ Object
6
7
8
9
|
# File 'lib/trubl/base.rb', line 6
def from_response(response)
return nil if missing_or_exception?(response)
initialize(parse(response))
end
|
#klass_name ⇒ Object
15
16
17
|
# File 'lib/trubl/base.rb', line 15
def klass_name
self.class.name.downcase.gsub('trubl::', '')
end
|
#parse(response) ⇒ Object
11
12
13
|
# File 'lib/trubl/base.rb', line 11
def parse(response)
JSON.parse(response.body)[klass_name]
end
|