Tabnine Logo
ArticleEditor$Factory.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.novoda.enews.ArticleEditor$Factory
constructor

Best Java code snippets using com.novoda.enews.ArticleEditor$Factory.<init> (Showing top 4 results out of 315)

origin: novoda/spikes

  /**
   * @param args https://api.slack.com/docs/oauth-test-tokens
   * @throws IOException
   */
  public static void main(String[] args) throws IOException {
    if (args.length == 0) {
      throw new IllegalStateException("You need to pass a Slack token as the first arg. See https://api.slack.com/web");
    }
    String slackToken = args[0];
    Scraper scraper = new Scraper.Factory().newInstance(slackToken);
    HtmlGenerator htmlGenerator = new HtmlGenerator.Factory().newInstance();
    ArticleEditor articleEditor = new ArticleEditor.Factory().newInstance();

    LocalDateTime start = LocalDateTime.now();
    LocalDateTime end = LocalDateTime.now().minusDays(6);
    Stream<ChannelHistory.Message> messageStream = scraper.scrape(start, end);
    Stream<Article> articleStream = articleEditor.generateArticle(messageStream);
    String html = htmlGenerator.generate(articleStream);

    System.out.println(html);
    Files.write(Paths.get("./build/enews-debug.html"), html.getBytes());
  }
}
origin: novoda/spikes

/**
 * @param args https://api.slack.com/docs/oauth-test-tokens
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
  if (args.length == 0) {
    throw new IllegalStateException("You need to pass a Slack token as the first arg. See https://api.slack.com/web");
  }
  String slackToken = args[0];
  Scraper scraper = new Scraper.Factory().newInstance(slackToken);
  ArticleEditor articleEditor = new ArticleEditor.Factory().newInstance();
  LocalDateTime start = LocalDateTime.now();
  LocalDateTime end = LocalDateTime.now().minusDays(6);
  Stream<ChannelHistory.Message> messageStream = scraper.scrape(start, end);
  Stream<Article> articleStream = articleEditor.generateArticle(messageStream);
  articleStream.forEach(System.out::println);
}
origin: novoda/spikes

  @Override
  public Response handleRequest(Request input, Context context) {
    String slackToken = input.getSlackToken();
    String mailChimpApiKey = input.getMailChimpApiKey();

    Scraper scraper = new Scraper.Factory().newInstance(slackToken);
    HtmlGenerator htmlGenerator = new HtmlGenerator.Factory().newInstance();
    NewsletterPublisher newsletterPublisher = new NewsletterPublisher.Factory().newInstance(mailChimpApiKey);
    ArticleEditor articleEditor = new ArticleEditor.Factory().newInstance();

    LocalDateTime start = LocalDateTime.now();
    LocalDateTime end = LocalDateTime.now().minusDays(6);
    Stream<ChannelHistory.Message> messageStream = scraper.scrape(start, end);
    Stream<Article> articleStream = articleEditor.generateArticle(messageStream);
    String html = htmlGenerator.generate(articleStream);
    LocalDateTime atLocalDateTime = LocalDateTime.now().plusDays(1).plusHours(1);
    newsletterPublisher.publish(html, atLocalDateTime);
    // Time warp campaigns have to be 24 hours in the future
    // The scheduling is completely hidden here and is a TODO
    // - because if someone set up a cron job they cannot *fully* control the time right now

    JsonObject jsonObject = new JsonObject();
    jsonObject.add("message", new JsonPrimitive("complete!"));
    return new Response(jsonObject.getAsJsonObject().toString());
  }
}
origin: novoda/spikes

  /**
   * @param args https://api.slack.com/docs/oauth-test-tokens, https://us5.admin.mailchimp.com/account/api/
   * @throws IOException
   */
  public static void main(String[] args) throws IOException {
    if (args.length == 0 || args.length < 2) {
      throw new IllegalStateException("You need to pass a Slack token as the first arg and MailChimp API token as the second.");
    }
    String slackToken = args[0];
    String mailChimpToken = args[1];
    Scraper scraper = new Scraper.Factory().newInstance(slackToken);
    HtmlGenerator htmlGenerator = new HtmlGenerator.Factory().newInstance();
    ArticleEditor articleEditor = new ArticleEditor.Factory().newInstance();
    NewsletterPublisher newsletterPublisher = new NewsletterPublisher.Factory().newInstance(mailChimpToken);

    LocalDateTime start = LocalDateTime.now();
    LocalDateTime end = LocalDateTime.now().minusDays(6);
    Stream<ChannelHistory.Message> messageStream = scraper.scrape(start, end);
    Stream<Article> articleStream = articleEditor.generateArticle(messageStream);
    String html = htmlGenerator.generate(articleStream);
    LocalDateTime atLocalDateTime = LocalDateTime.now().plusDays(1).plusHours(1);
    newsletterPublisher.publish(html, atLocalDateTime);
    // Time warp campaigns have to be 24 hours in the future
    // The scheduling is completely hidden here and is a TODO
    // - because if someone set up a cron job they cannot *fully* control the time right now
  }
}
com.novoda.enewsArticleEditor$Factory<init>

Popular methods of ArticleEditor$Factory

  • newInstance
  • newMockInstance

Popular in Java

  • Finding current android device location
  • getSharedPreferences (Context)
  • getSystemService (Context)
  • getContentResolver (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • JTable (javax.swing)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now