lib/trello_helper.rb
def dump_org_members_json()
    $stderr.puts("Backing up Organization Members for #{org.display_name} (#{org.name})...")
    api_call_uri = Addressable::URI.parse("https://trello.com/1/organizations/#{organization_id}/members")
    api_call_uri.query_values = { fields: 'all' }

    i = 0
    request_timeout = 30
    while true
      request = Trello::Request.new :get, api_call_uri, {}, nil
      begin
        response = long_request_execute(Trello.auth_policy.authorize(request), request_timeout)
        return response.body if response.code == 200
      rescue RestClient::RequestTimeout => e
        err_msg = "Error with dump_org_json backing up org '#{org.name}' using API call: " + (e.http_code.nil? ? "HTTP Timeout?" : "HTTP response code: #{e.http_code}, response body: #{e.http_body}")
      end
      if i >= DEFAULT_RETRIES
        raise err_msg
      end
      $stderr.puts err_msg
      retry_sleep i
      request_timeout += 15
      i += 1
    end
  end
##
# Return the JSON backup of the Trello org
Return the JSON backup of the Trello org
Return the JSON backup of the Trello org
def dump_org_members_json()
    $stderr.puts("Backing up Organization Members for #{org.display_name} (#{org.name})...")
    api_call_uri = Addressable::URI.parse("https://trello.com/1/organizations/#{organization_id}/members")
    api_call_uri.query_values = { fields: 'all' }
    i = 0
    request_timeout = 30
    while true
      request = Trello::Request.new :get, api_call_uri, {}, nil
      begin
        response = long_request_execute(Trello.auth_policy.authorize(request), request_timeout)
        return response.body if response.code == 200
      rescue RestClient::RequestTimeout => e
        err_msg = "Error with dump_org_json backing up org '#{org.name}' using API call: " + (e.http_code.nil? ? "HTTP Timeout?" : "HTTP response code: #{e.http_code}, response body: #{e.http_body}")
      end
      if i >= DEFAULT_RETRIES
        raise err_msg
      end
      $stderr.puts err_msg
      retry_sleep i
      request_timeout += 15
      i += 1
    end
  end
def dump_org_members_json ( ) $stderr . puts ( "Backing up Organization Members for #{org.display_name} (#{org.name})..." ) api_call_uri = Addressable :: URI . parse ( "https://trello.com/1/organizations/#{organization_id}/members" ) api_call_uri . query_values = { fields : 'all' } i = 0 request_timeout = 30 while true request = Trello :: Request . new :get , api_call_uri , { } , nil begin response = long_request_execute ( Trello . auth_policy . authorize ( request ) , request_timeout ) return response . body if response . code == 200 rescue RestClient :: RequestTimeout => e err_msg = "Error with dump_org_json backing up org '#{org.name}' using API call: " + ( e . http_code . nil? ? "HTTP Timeout?" : "HTTP response code: #{e.http_code}, response body: #{e.http_body}" ) end if i >= DEFAULT_RETRIES raise err_msg end $stderr . puts err_msg retry_sleep i request_timeout += 15 i += 1 end end
Return the JSON backup of the Trello org
Return the JSON backup of the Trello org