Class: SimplyAuth::Application
- Defined in:
- app/models/simply_auth/application.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Model
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Model
#attributes=, collection_path, #collection_path, create, #data, #data=, find, #initialize, instance_path, #instance_path, owner_class, owner_class_name, #owner_id, path_component, #persisted=, #persisted?, #save
Constructor Details
This class inherits a constructor from SimplyAuth::Model
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'app/models/simply_auth/application.rb', line 4 def name @name end |
Class Method Details
.all ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/simply_auth/application.rb', line 13 def self.all response = RestClient.get( "https://api.simplyauth.com#{collection_path}", accept: :json ) body = JSON.parse(response.body)[model_name.element.pluralize.camelize(:lower)] body.map do |data| data = data.deep_transform_keys { |key| key.to_s.underscore } new(data).tap{|a| a.persisted = true} end end |
Instance Method Details
#attributes ⇒ Object
5 6 7 |
# File 'app/models/simply_auth/application.rb', line 5 def attributes super.merge(name: name) end |
#signup_forms ⇒ Object
9 10 11 |
# File 'app/models/simply_auth/application.rb', line 9 def signup_forms @signup_forms ||= SignupForm.all(id) end |