Class: PackUpdate

Inherits:
Object
  • Object
show all
Defined in:
lib/recorder.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pack_id, pack) ⇒ PackUpdate

Returns a new instance of PackUpdate.



152
153
154
155
# File 'lib/recorder.rb', line 152

def initialize(pack_id, pack)
  @pack_id = pack_id
  @pack = pack
end

Class Method Details

.is_std_license(license) ⇒ Object



174
175
176
177
178
# File 'lib/recorder.rb', line 174

def self.is_std_license(license)
  where = "where name = '#{license}'"
  std_licenses = api_get_std_license_name(where)
  return std_licenses.ntuples == 1
end

.judge_pack_status(packer) ⇒ Object



161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/recorder.rb', line 161

def self.judge_pack_status(packer)
  # TODO: @Micfan test it
  if is_std_license(packer[:license]) and ( packer[:license_url] or packer[:license_text])
    packer[:unclear_license] = nil
    packer[:status] = 40
  else
    packer[:unclear_license] = packer[:license]
    packer[:license] = nil
    packer[:status] = 30
  end
  return packer
end

Instance Method Details

#updateObject



157
158
159
# File 'lib/recorder.rb', line 157

def update()
  ok = api_update_pack_info(@pack_id, @pack)
end