Class: XxxRename::SiteClients::JulesJordanMedia

Inherits:
Base
  • Object
show all
Includes:
HTTParty, FileUtilities
Defined in:
lib/xxx_rename/site_clients/jules_jordan_media.rb

Direct Known Subclasses

JulesJordan, ManuelFerrara

Constant Summary collapse

SCENES_ENDPOINT_TRIAL =
"/trial/categories/movies_$page$_d.html"

Constants included from FileUtilities

FileUtilities::MAX_FILENAME_LEN

Constants included from Utils

Utils::RETRIABLE_ERRORS

Instance Attribute Summary

Attributes inherited from Base

#config, #source_format

Instance Method Summary collapse

Methods included from FileUtilities

#read_file!, #read_yaml, #read_yaml!, #valid_dir?, #valid_file?

Methods inherited from Base

#initialize, #search

Methods included from Configuration

included

Methods included from Utils

#adjust_apostrophe, #api_error, #handle_response!

Constructor Details

This class inherits a constructor from XxxRename::SiteClients::Base

Instance Method Details

#all_scenes_processed?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/xxx_rename/site_clients/jules_jordan_media.rb', line 42

def all_scenes_processed?
  all_scenes_processed
end

#datastore_refresh_required?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
# File 'lib/xxx_rename/site_clients/jules_jordan_media.rb', line 19

def datastore_refresh_required?
  if config.force_refresh_datastore
    XxxRename.logger.info "#{"[FORCE REFRESH]".colorize(:green)} #{self.class.name}"
    true
  else
    false
  end
end

#refresh_datastore(page = 1) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/xxx_rename/site_clients/jules_jordan_media.rb', line 28

def refresh_datastore(page = 1)
  return if all_scenes_processed?

  scenes = get_scenes_from_page(page)
  if scenes.empty?
    XxxRename.logger.info "#{"[DATASTORE REFRESH COMPLETE]".colorize(:green)} #{self.class.site_client_name}"
    @all_scenes_processed = true
    return true
  end

  scenes.map { |scene_data| site_client_datastore.create!(scene_data, force: true) }
  refresh_datastore(page + 1)
end