Class: SparkApi::Models::NewsFeedMeta

Inherits:
Base
  • Object
show all
Defined in:
lib/spark_api/models/news_feed_meta.rb

Constant Summary

Constants included from Paginate

Paginate::DEFAULT_PAGE_SIZE

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #errors, #parent

Instance Method Summary collapse

Methods inherited from Base

#connection, connection, count, element_name, element_name=, first, get, #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

#initializeNewsFeedMeta

Returns a new instance of NewsFeedMeta.



9
10
11
12
# File 'lib/spark_api/models/news_feed_meta.rb', line 9

def initialize
  super
  @data = connection.get(self.path).first
end

Dynamic Method Handling

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

Instance Attribute Details

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/spark_api/models/news_feed_meta.rb', line 5

def data
  @data
end

Instance Method Details

#core_field_namesObject



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

def core_field_names
  fields = @data['Subscriptions']['SavedSearches']['CoreSearchFields']

  @data['Subscriptions']['SavedSearches']['CoreStandardFields'].each do |field|
    fields << field[1]['Label']
  end

  fields
end

#core_fieldsObject



28
29
30
31
32
33
34
35
36
# File 'lib/spark_api/models/news_feed_meta.rb', line 28

def core_fields
  fields = @data['Subscriptions']['SavedSearches']['CoreSearchFields']

  @data['Subscriptions']['SavedSearches']['CoreStandardFields'].each do |field|
    fields << field.first
  end

  fields
end

#minimum_core_fieldsObject



14
15
16
# File 'lib/spark_api/models/news_feed_meta.rb', line 14

def minimum_core_fields
  @data['Subscriptions']['SavedSearches']['MinimumCoreFields']
end