Class: Flexite::Diff::GetService

Inherits:
Object
  • Object
show all
Defined in:
app/services/flexite/diff/get_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(stage, endpoint) ⇒ GetService

Returns a new instance of GetService.



6
7
8
9
10
# File 'app/services/flexite/diff/get_service.rb', line 6

def initialize(stage, endpoint)
  @stage = stage
  @token = Flexite.config.migration_token
  @endpoint = endpoint + api_configs_path(token: @token)
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
# File 'app/services/flexite/diff/get_service.rb', line 12

def call
  get_configs
  if File.exists?("#{Rails.root}/config/diffs/#{@file_name}")
    Diff::ShowService.new(@file_name).call
  else
    calculate_diff
    ActionService::Result.new(data: { file_name: @file_name })
  end
end