-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from fahrenq/master
User repos caching improvements
- Loading branch information
Showing
7 changed files
with
99 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'json' | ||
|
||
module Github | ||
class Repo | ||
attr_reader :name, :link | ||
|
||
def initialize(name, link) | ||
@name = name | ||
@link = link | ||
end | ||
|
||
def to_storage_string | ||
"#{@name},#{@link}" | ||
end | ||
|
||
def to_alfred_hash | ||
{ | ||
title: @name, | ||
subtitle: @link, | ||
arg: @link, | ||
text: { | ||
copy: @link, | ||
largetype: @link | ||
} | ||
} | ||
end | ||
|
||
class << self | ||
def from_storage_string(storage_string) | ||
name, link = storage_string.split(',') | ||
new(name, link) | ||
end | ||
|
||
def from_api_response(api_response) | ||
new(api_response[:full_name], api_response[:html_url]) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters