Class: Lit::Source

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/lit/source.rb

Constant Summary collapse

LOCALES_PATH =
'/api/v1/locales.json'.freeze
LOCALIZATION_KEYS_PATH =
'/api/v1/localization_keys.json'.freeze
LOCALIZATIONS_PATH =
'/api/v1/localizations.json'.freeze
LAST_CHANGE_PATH =
'/api/v1/last_change.json'.freeze

Instance Method Summary collapse

Instance Method Details

#api_keyObject

VALIDATIONS



13
14
# File 'app/models/lit/source.rb', line 13

validates :api_key, :identifier, :url,
presence: true

#assign_last_updated_at(time = nil) ⇒ Object



37
38
39
# File 'app/models/lit/source.rb', line 37

def assign_last_updated_at(time = nil)
  self.last_updated_at = time || Time.now
end

#incomming_localizationsObject

ASSOCIATIONS



10
# File 'app/models/lit/source.rb', line 10

has_many :incomming_localizations

#last_changeObject



27
28
29
30
# File 'app/models/lit/source.rb', line 27

def last_change
  result = RemoteInteractorService.new(self).send_request(LAST_CHANGE_PATH)
  result['last_change'] unless result.nil?
end

#touch_last_updated_at!Object



32
33
34
35
# File 'app/models/lit/source.rb', line 32

def touch_last_updated_at!
  assign_last_updated_at
  save
end