Class: PandocBinary::Release
- Inherits:
-
Struct
- Object
- Struct
- PandocBinary::Release
- Extended by:
- RawDataParsable, TimeAttributeParsable
- Defined in:
- lib/pandoc_binary.rb
Defined Under Namespace
Classes: Asset
Constant Summary collapse
- URI_BASE =
"https://api.github.com/repos/jgm/pandoc/releases/tags/%{version}"
Instance Attribute Summary collapse
-
#assets ⇒ Object
Returns the value of attribute assets.
-
#published_at ⇒ Object
Returns the value of attribute published_at.
-
#tag_name ⇒ Object
Returns the value of attribute tag_name.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from RawDataParsable
Methods included from TimeAttributeParsable
Instance Attribute Details
#assets ⇒ Object
Returns the value of attribute assets
57 58 59 |
# File 'lib/pandoc_binary.rb', line 57 def assets @assets end |
#published_at ⇒ Object
Returns the value of attribute published_at
57 58 59 |
# File 'lib/pandoc_binary.rb', line 57 def published_at @published_at end |
#tag_name ⇒ Object
Returns the value of attribute tag_name
57 58 59 |
# File 'lib/pandoc_binary.rb', line 57 def tag_name @tag_name end |
Class Method Details
.fetch_by_version(version) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/pandoc_binary.rb', line 75 def fetch_by_version(version) uri = URI(URI_BASE % {version: version}) json = Net::HTTP.get(uri) raw_release = JSON.parse(json, symbolize_names: true) return from_raw_data(raw_release) end |
.from_raw_data(raw_data) ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/pandoc_binary.rb', line 67 def from_raw_data(raw_data) result = super result.assets = raw_data[:assets].map { |raw_asset| Asset.from_raw_data(raw_asset) } return result end |
Instance Method Details
#asset_by_architecture(architecture) ⇒ Object
90 91 92 93 94 95 |
# File 'lib/pandoc_binary.rb', line 90 def asset_by_architecture(architecture) return assets.find { |asset| asset.name.end_with?(architecture.archive_suffix) && asset.name.index(architecture.name) } end |