Class: SparkApi::Models::Portal

Inherits:
Base
  • Object
show all
Extended by:
Finders
Includes:
Concerns::Savable
Defined in:
lib/spark_api/models/portal.rb

Constant Summary

Constants included from Paginate

Paginate::DEFAULT_PAGE_SIZE

Instance Attribute Summary

Attributes inherited from Base

#attributes, #errors, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Finders

find, find_one, first, last

Methods included from Concerns::Savable

#create!, #params_for_save, #save, #save!, #update!, #update_attributes

Methods inherited from Base

connection, #connection, count, element_name, element_name=, first, get, #id, #initialize, #load, #method_missing, #parse_id, path, #path, #persisted?, prefix, prefix=, #resource_pluralized, #resource_uri, #respond_to?, #to_param, #to_partial_path

Methods included from Paginate

#collect, #paginate, #per_page

Methods included from Dirty

#changed, #changed?, #changed_attributes, #changes, #dirty_attributes, #previous_changes

Constructor Details

This class inherits a constructor from SparkApi::Models::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SparkApi::Models::Base

Class Method Details

.my(arguments = {}) ⇒ Object



10
11
12
13
14
# File 'lib/spark_api/models/portal.rb', line 10

def self.my(arguments = {})
  portal = collect(connection.get("/portal", arguments)).first
  portal = Portal.new if portal.nil?
  portal
end

Instance Method Details

#disableObject



26
27
28
29
30
# File 'lib/spark_api/models/portal.rb', line 26

def disable
  attribute_will_change! "Enabled"
  @attributes['Enabled'] = false
  save
end

#enableObject



20
21
22
23
24
# File 'lib/spark_api/models/portal.rb', line 20

def enable
  attribute_will_change! "Enabled"
  @attributes['Enabled'] = true
  save
end

#enabled?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/spark_api/models/portal.rb', line 16

def enabled?
  @attributes['Enabled'] == true
end

#post_dataObject



32
# File 'lib/spark_api/models/portal.rb', line 32

def post_data; attributes end