Class: HermesAPI::JsonBase
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- HermesAPI::JsonBase
show all
- Defined in:
- lib/hermes_api/resources/json_base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.inherited(subclass) ⇒ Object
6
7
8
|
# File 'lib/hermes_api/resources/json_base.rb', line 6
def self.inherited(subclass)
subclass.extend(BearerAuth)
end
|
Instance Method Details
#load(attributes, remove_root = false, persisted = false) ⇒ Object
10
11
12
13
|
# File 'lib/hermes_api/resources/json_base.rb', line 10
def load(attributes, remove_root = false, persisted = false)
attributes.deep_transform_keys! { |k| k.to_s.underscore }
super
end
|
#to_json(options = {}) ⇒ Object
15
16
17
18
|
# File 'lib/hermes_api/resources/json_base.rb', line 15
def to_json(options = {})
attributes.as_json.deep_transform_keys { |k| k.to_s.camelize(:lower) }
.to_json(include_root_in_json ? {root: self.class.element_name}.merge(options) : options)
end
|