use of com.meisolsson.githubsdk.model.Gist in project PocketHub by pockethub.
the class NewsEventTextTest method testGist.
/**
* Verify text of Gist event
*/
@UiThreadTest
public void testGist() {
Gist gist = Gist.builder().id("1").build();
GistPayload payload = GistPayload.builder().action(GistPayload.Action.Created).gist(gist).build();
GitHubEvent event = createEvent(GitHubEventType.GistEvent, payload);
updateView(event);
verify("user created Gist 1");
}
use of com.meisolsson.githubsdk.model.Gist in project PocketHub by pockethub.
the class GistsViewActivity method onPageSelected.
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
String gistId = gists[position];
Gist gist = store.getGist(gistId);
updateActionBar(gist, gistId);
}
use of com.meisolsson.githubsdk.model.Gist in project PocketHub by pockethub.
the class CreateCommentActivityTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
User user = User.builder().login("abc").build();
Gist gist = Gist.builder().user(user).id("123").build();
setActivityIntent(CreateCommentActivity.createIntent(gist));
}
use of com.meisolsson.githubsdk.model.Gist in project PocketHub by pockethub.
the class GistStore method addGist.
/**
* Add gist to store
*
* @param gist
* @return gist
*/
public Gist addGist(Gist gist) {
Gist current = getGist(gist.id());
if (current != null && current.equals(gist)) {
return current;
}
gist = gist.toBuilder().files(sortFiles(gist)).build();
gists.put(gist.id(), gist);
return gist;
}
use of com.meisolsson.githubsdk.model.Gist in project PocketHub by pockethub.
the class GistUriMatcher method getGist.
/**
* Parse a {@link Gist} from a non-null {@link Uri}
*
* @param uri
* @return {@link Gist} or null if none found in given {@link Uri}
*/
public static Gist getGist(final Uri uri) {
List<String> segments = uri.getPathSegments();
if (segments.size() != 1) {
return null;
}
String gistId = segments.get(0);
if (TextUtils.isEmpty(gistId)) {
return null;
}
Gist gist = Gist.builder().id(gistId).build();
if (TextUtils.isDigitsOnly(gistId)) {
return gist;
}
if (PATTERN.matcher(gistId).matches()) {
return gist;
}
return null;
}
Aggregations