Class: SparkApi::Models::SharedLink

Inherits:
Base
  • Object
show all
Extended by:
Finders
Defined in:
lib/spark_api/models/shared_link.rb

Constant Summary

Constants included from Paginate

Paginate::DEFAULT_PAGE_SIZE

Instance Attribute Summary collapse

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 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

Instance Attribute Details

#nameObject



17
18
19
20
21
22
23
24
25
# File 'lib/spark_api/models/shared_link.rb', line 17

def name
  if @name
    @name
  elsif respond_to?(:ListingCart) && self.ListingCart.respond_to?(:Name)
    self.ListingCart.Name
  elsif respond_to?(:SavedSearch) && self.SavedSearch.respond_to?(:Name)
    self.SavedSearch.Name
  end
end

#sort_idObject

Returns the value of attribute sort_id.



6
7
8
# File 'lib/spark_api/models/shared_link.rb', line 6

def sort_id
  @sort_id
end

Class Method Details

.create(data) ⇒ Object



11
12
13
14
15
# File 'lib/spark_api/models/shared_link.rb', line 11

def self.create(data)
  SharedLink.new SparkApi.client.post("#{path}/#{resource_type(data)}", data).first
rescue SparkApi::BadResourceRequest
  false
end

Instance Method Details

#filterObject



33
34
35
# File 'lib/spark_api/models/shared_link.rb', line 33

def filter
  "SharedLink Eq '#{id}'"
end

#listing_search_roleObject



37
38
39
# File 'lib/spark_api/models/shared_link.rb', line 37

def listing_search_role
  self.Mode.downcase.to_sym
end

#templateObject



27
28
29
30
31
# File 'lib/spark_api/models/shared_link.rb', line 27

def template
  if respond_to?(:SavedSearch) && self.SavedSearch.respond_to?(:template)
    self.SavedSearch.template
  end
end