Tabnine Logo
com.novoda.enews
Code IndexAdd Tabnine to your IDE (free)

How to use com.novoda.enews

Best Java code snippets using com.novoda.enews (Showing top 20 results out of 315)

origin: novoda/spikes

private Article generateArticle(ChannelHistory.Message message) {
  String imageUrl = generateImageUrl(message);
  String pageTitle = generateTitle(message);
  String text = generateText(message);
  String pageLink = generatePageLink(message);
  return new Article(imageUrl, pageTitle, text, pageLink);
}
origin: novoda/spikes

public HtmlGenerator newInstance() {
  return new HtmlGenerator(
      getAsString("./mailchimp-template-head.html"),
      getAsString("./mailchimp-template-style.css"),
      getAsString("./mailchimp-template-pre-articles.html"),
      getAsString("./mailchimp-template-article.html"),
      getAsString("./mailchimp-template-post-articles.html"));
}
origin: novoda/spikes

private List<ApiPagedChannelHistory> getApiChannelHistory(LocalDateTime start, LocalDateTime end) {
  ApiPagedResponse apiPagedResponse = new ApiPagedResponse(start);
  do {
    appendChannelHistory(apiPagedResponse);
  } while (apiPagedResponse.responsesAreAfter(end) && apiPagedResponse.hasMoreResponses());
  return apiPagedResponse.getResponses();
}
origin: novoda/spikes

public ArticleEditor newInstance(boolean mock) {
  if (mock) {
    return newMockInstance();
  } else {
    return newInstance();
  }
}
origin: novoda/spikes

private String generateImageUrl(ChannelHistory.Message message) {
  if (message.hasImage()) {
    return message.getImageUrl();
  } else {
    return missingImageFetcher.getMissingImageUrl();
  }
}
origin: novoda/spikes

private String generateTitle(ChannelHistory.Message message) {
  try {
    String pageLink = message.getPageLink();
    if (pageLink.startsWith("www")) {
      pageLink = "http:// " + pageLink;
    }
    return linkUnfurler.unfurl(pageLink).getTitle();
  } catch (IOException | UnsupportedUrlTypeException e) {
    return "#eNews link";
  }
}
origin: novoda/spikes

  public NewsletterPublisher newInstance(String mailChimpToken) {
    OkHttpClient okHttpClient = new OkHttpClient.Builder()
        .addInterceptor(new AuthHeaderInterceptor(mailChimpToken))
        .build();
    Retrofit retrofit = new Retrofit.Builder()
        .client(okHttpClient)
        .baseUrl("https://us5.api.mailchimp.com/3.0/")
        .addConverterFactory(new ConverterFactory())
        .build();
    MailChimpWebService webService = retrofit.create(MailChimpWebService.class);
    NewsletterScheduler newsletterScheduler = new NewsletterScheduler(webService);
    return new NewsletterPublisher(webService, "187645ff44", newsletterScheduler);
  }
}
origin: novoda/spikes

private void appendChannelHistory(ApiPagedResponse apiPagedResponse) {
  Response<ApiPagedChannelHistory> response = fetchApiChannelHistoryResponse(apiPagedResponse.getLastResponseEpochTime());
  if (response.isSuccessful()) {
    ApiPagedChannelHistory apiPagedChannelHistory = response.body();
    apiPagedResponse.addResponse(apiPagedChannelHistory);
  } else {
    throw new IllegalStateException("No internet or server down or something."
        + " code: " + response.code()
        + " error: " + response.body());
  }
}
origin: novoda/spikes

  private ApiPagedChannelHistory createApiPagedChannelHistoryWithLastResponseDate(String timestamp) {
    ApiPagedChannelHistory apiPagedChannelHistory = new ApiPagedChannelHistory();
    apiPagedChannelHistory.apiMessages = new ArrayList<>();
    ApiPagedChannelHistory.ApiMessage apiMessage = new ApiPagedChannelHistory.ApiMessage();
    apiMessage.timeStamp = timestamp;
    apiPagedChannelHistory.apiMessages.add(apiMessage);
    return apiPagedChannelHistory;
  }
}
origin: novoda/spikes

@NotNull
private Scraper newMockServiceInsstance(String slackToken) {
  SlackWebService slackWebService = new MockSlackWebService();
  SlackHistoryFetcher slackHistoryFetcher = SlackHistoryFetcher.from(slackWebService, slackToken);
  return new Scraper(slackHistoryFetcher);
}
origin: novoda/spikes

public ArticleEditor newInstance() {
  return new ArticleEditor(new LinkUnfurler.Http(), new MissingImageFetcher(new Random()));
}
origin: novoda/spikes

private ArticleEditor newMockInstance() {
  return new ArticleEditor(new LinkUnfurler.Mock(), new MissingImageFetcher(new Random()));
}
origin: novoda/spikes

public static SlackHistoryFetcher from(SlackWebService slackWebService, String slackToken) {
  HistoryConverter historyConverter = new HistoryConverter();
  return new SlackHistoryFetcher(slackWebService, slackToken, CHANNEL_GENERAL, historyConverter);
}
origin: novoda/spikes

public ChannelHistory getChannelHistory(LocalDateTime start, LocalDateTime end) {
  return historyConverter.convert(getApiChannelHistory(start, end));
}
origin: novoda/spikes

/**
 * Expected to be called inside <head> here </head>
 */
void injectCssInto(Html html) {
  this.html = html;
  addFontAwesomeCss();
  addShareFooterCss();
}
origin: novoda/spikes

public void schedule(String id, LocalDateTime localDateTime) {
  Call<Void> postSchedule = webService.postCampaignSchedule(id, new CampaignSchedule(localDateTime, true));
  try {
    postSchedule.execute();
  } catch (IOException e) {
    throw new IllegalStateException("FooBar ", e);
  }
}
origin: novoda/spikes

  @Override
  public Information unfurl(String url) {
    return new Information("Mock Title", url);
  }
}
origin: novoda/spikes

void injectHtmlInto(Html html) {
  this.html = html;
  makeShareFooter();
}
origin: novoda/spikes

  private void scheduleNewsletter(String id, LocalDateTime atLocalDateTime) {
    newsletterScheduler.schedule(id, atLocalDateTime);
  }
}
origin: novoda/spikes

private void addEnewsMessage(List<ApiPagedChannelHistory.ApiMessage> apiMessages, String text) {
  addStandardMessage(apiMessages, text + " <#C1V389HGB|enews>" + " http://novoda.com");
}
com.novoda.enews

Most used classes

  • Scraper$Factory
  • Scraper
  • ArticleEditor$Factory
  • ArticleEditor
  • HtmlGenerator$Factory
  • ApiPagedChannelHistory$ApiMessage,
  • ApiPagedChannelHistory,
  • ApiPagedResponse,
  • Article,
  • ChannelHistory$Message,
  • NewsletterPublisher$Factory,
  • NewsletterPublisher,
  • ApiPagedChannelHistory$ApiAttachment,
  • ApiPagedResponseTest,
  • AuthHeaderInterceptor,
  • CampaignContent,
  • CampaignSchedule,
  • CampaignSettings,
  • ChannelHistory
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