Class: SimplyAuth::SignupForm

Inherits:
Model
  • Object
show all
Defined in:
app/models/simply_auth/signup_form.rb

Instance Attribute Summary collapse

Attributes inherited from Model

#id

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, path_component, #persisted=, #persisted?, #save

Constructor Details

This class inherits a constructor from SimplyAuth::Model

Instance Attribute Details

#application_idObject

Returns the value of attribute application_id.



3
4
5
# File 'app/models/simply_auth/signup_form.rb', line 3

def application_id
  @application_id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'app/models/simply_auth/signup_form.rb', line 3

def name
  @name
end

#stepsObject

Returns the value of attribute steps.



3
4
5
# File 'app/models/simply_auth/signup_form.rb', line 3

def steps
  @steps
end

Class Method Details

.all(ids) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/simply_auth/signup_form.rb', line 25

def self.all(ids)
  response = RestClient.get(
    "https://api.simplyauth.com#{collection_path(ids)}",
    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)
  end
end

.owner_class_nameObject



14
15
16
# File 'app/models/simply_auth/signup_form.rb', line 14

def self.owner_class_name
  "Application"
end

Instance Method Details

#attributesObject



6
7
8
# File 'app/models/simply_auth/signup_form.rb', line 6

def attributes
  super.merge(name: name, steps: steps)
end

#destroyObject



18
19
20
21
22
23
# File 'app/models/simply_auth/signup_form.rb', line 18

def destroy
  response = RestClient.delete(
    "https://api.simplyauth.com#{instance_path}",
    accept: :json
  )
end

#owner_idObject



10
11
12
# File 'app/models/simply_auth/signup_form.rb', line 10

def owner_id
  self.application_id
end