lib/aigu/pusher.rb in aigu-0.4.5 vs lib/aigu/pusher.rb in aigu-0.5

- old
+ new

@@ -1,9 +1,13 @@ module Aigu class Pusher PUSH_PATH = '/public_api/revisions' + HTTP_ALREADY_UP_TO_DATE = '200'.freeze + HTTP_UPDATED = '201'.freeze + HTTP_SUCCESS_CODES = [HTTP_ALREADY_UP_TO_DATE, HTTP_UPDATED].freeze + def initialize(opts = {}) @input_file = opts[:'input-file'] @accent_api_key = opts[:'accent-api-key'] @accent_url = opts[:'accent-url'] end @@ -38,10 +42,10 @@ response = http.request(request) puts 'Response: ' + response.code - if response.code != '201' + unless HTTP_SUCCESS_CODES.include? response.code puts 'Error pushing string update to Accent' exit 1 end end end