~srushe/indieweb-post_types

2b1cd9c538bfb4032657b15caee1f834c776dc37 — Stephen Rushe 2 years ago e61eb84
Fix identification of phot from micropub.rocks example (#8)

M CHANGELOG.md => CHANGELOG.md +5 -0
@@ 6,6 6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.3.1] - 2018-07-25

### Fixed
- Fix identification of photo entry from micropub.rocks examples.

## [0.3.0] - 2018-06-16

### Changed

M lib/indieweb/post_types/identifier/photo.rb => lib/indieweb/post_types/identifier/photo.rb +6 -1
@@ 9,10 9,15 @@ module Indieweb

          def identifier_from(data)
            return unless data.key?('photo')
            return unless valid_url?(data['photo'])
            return unless valid_url?(url_from(data['photo']))

            'photo'
          end

          def url_from(data)
            photo = data.is_a?(Array) ? data[0] : data
            photo.is_a?(String) ? photo : photo['value']
          end
        end
      end
    end

M lib/indieweb/post_types/version.rb => lib/indieweb/post_types/version.rb +1 -1
@@ 1,5 1,5 @@
module Indieweb
  module PostTypes
    VERSION = '0.3.0'.freeze
    VERSION = '0.3.1'.freeze
  end
end

A spec/examples/entry/photo-micropub-rocks.json => spec/examples/entry/photo-micropub-rocks.json +16 -0
@@ 0,0 1,16 @@
{
    "type": [
        "h-entry"
    ],
    "properties": {
        "content": [
            "Micropub test of creating a photo referenced by URL with alt text. This post should include a photo of a sunset."
        ],
        "photo": [
            {
                "value": "https://micropub.rocks/media/sunset.jpg",
                "alt": "Photo of a sunset"
            }
        ]
    }
}
\ No newline at end of file

M spec/support/example_data.rb => spec/support/example_data.rb +1 -0
@@ 70,6 70,7 @@ module ExampleData
  def photo_examples
    %w[
      entry/photo-aaron.json
      entry/photo-micropub-rocks.json
      entry/photo-tantek.json
      items/photo-aaron.json
      items/photo-tantek.json