social_web-activity_streams 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5f48241f7077ba89e8f60afaf199c48e7fc2aad8aee8297f167465438e5e5cbf
4
+ data.tar.gz: 5eb531f7ad7dd25b436281187b348f48165cb0c5ebfa62e521a816937af4edb8
5
+ SHA512:
6
+ metadata.gz: 297bc05e591ffcc2db9816ce554640ac807fe55b27cea84c499fa991380739f9f877e6bf85755a4549e8b069a84c66c79cbbb60ce0dcebea0879fb47fdcb5b50
7
+ data.tar.gz: e42bc806b63c49548bfaa55d3a91b7b3131240e98dfe5cc7dc45c289c9b40a3109202ff2bfd835184ad06de55c2964bb8353020c5d28f411cc2dd487503f7ad7
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Shane Cavanaugh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ module Concerns
5
+ module Serialization
6
+ attr_accessor :unsupported_context
7
+ attr_accessor :unsupported_properties
8
+
9
+ def to_json(*args)
10
+ JSON.dump(to_h)
11
+ end
12
+
13
+ def to_h
14
+ attrs = attributes.dup
15
+ if unsupported_properties
16
+ attrs.merge!(unsupported_properties)
17
+ end
18
+ attrs = self.is_a?(ActivityStreams::Activity::Update) ? attrs : attrs.compact
19
+ attrs.transform_values do |v|
20
+ case v
21
+ when ActivityStreams::Model then v.to_h
22
+ when Date, Time then v.iso8601
23
+ else v
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ module Extensions
5
+ class LinkedDataSignature < ::ActivityStreams::Model
6
+ %w[
7
+ created creator
8
+ domain
9
+ nonce
10
+ signatureValue
11
+ type
12
+ ].each(&method(:attribute))
13
+ SIGNATURE_SUITES = %w[RsaSignature2017].freeze
14
+
15
+ attribute :created, :time
16
+
17
+ validates :created, presence: true
18
+ validates :creator, presence: true
19
+ validates :signatureValue, presence: true
20
+ validates :type, presence: true, inclusion: { in: SIGNATURE_SUITES }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ module Extensions
5
+ module Sensitive
6
+ def self.included(base)
7
+ base.class_eval do
8
+ attribute :sensitive, :boolean
9
+ validates :sensitive,
10
+ inclusion: { in: [true, false], allow_nil: true }
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'extensions/linked_data_signature'
4
+
5
+ module ActivityStreams
6
+ class Factory
7
+ def initialize(json)
8
+ @json = json.freeze
9
+ end
10
+
11
+ def build
12
+ hash = JSON.parse(@json)
13
+ obj = deep_initialize(hash)
14
+ obj.original_json = @json
15
+ obj
16
+ end
17
+
18
+ private
19
+
20
+ def deep_initialize(object)
21
+ case object
22
+ when Hash then object['type'] ? transform_values(object) : object
23
+ when Array then object.map { |o| deep_initialize(o) }
24
+ else object
25
+ end
26
+ end
27
+
28
+ def find_klass(type)
29
+ case type
30
+ when 'Add' then Activity::Add
31
+ when 'Collection' then Collection
32
+ when 'CollectionPage' then Collection::CollectionPage
33
+ when 'Create' then Activity::Create
34
+ when 'Link' then Link
35
+ when 'Note' then Object::Note
36
+ when 'Image' then Object::Image
37
+ when 'Person' then Actor::Person
38
+ when 'RsaSignature2017' then Extensions::LinkedDataSignature
39
+ else raise UnsupportedType, type
40
+ end
41
+ end
42
+
43
+ def transform_values(hash)
44
+ attrs = hash.transform_values { |v| deep_initialize(v) }
45
+ klass = find_klass(hash['type'])
46
+
47
+ unsupported_properties = unsupported_properties(klass, attrs)
48
+
49
+ obj = klass.new(attrs)
50
+ obj.unsupported_properties = unsupported_properties
51
+ obj
52
+ end
53
+
54
+ def unsupported_properties(klass, attrs)
55
+ attrs.each.with_object({}) do |(k, _v), unsupported_props|
56
+ if !klass.attribute_names.include?(k)
57
+ unsupported_props[k] = attrs.delete(k)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Activity::Add < Activity; end
5
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ # {
5
+ # "@context": [
6
+ # "https://www.w3.org/ns/activitystreams",
7
+ # {
8
+ # "ostatus": "http://ostatus.org#",
9
+ # "atomUri": "ostatus:atomUri",
10
+ # "inReplyToAtomUri": "ostatus:inReplyToAtomUri",
11
+ # "conversation": "ostatus:conversation",
12
+ # "sensitive": "as:sensitive",
13
+ # "Hashtag": "as:Hashtag",
14
+ # "toot": "http://joinmastodon.org/ns#",
15
+ # "Emoji": "toot:Emoji",
16
+ # "focalPoint": {
17
+ # "@container": "@list",
18
+ # "@id": "toot:focalPoint"
19
+ # },
20
+ # "blurhash": "toot:blurhash"
21
+ # }
22
+ # ],
23
+ # "id": "https://ruby.social/users/shanecav/statuses/102570231917342996/activity",
24
+ # "type": "Create",
25
+ # "actor": "https://ruby.social/users/shanecav",
26
+ # "published": "2019-08-06T13:18:52Z",
27
+ # "to": [
28
+ # "https://www.w3.org/ns/activitystreams#Public"
29
+ # ],
30
+ # "cc": [
31
+ # "https://ruby.social/users/shanecav/followers"
32
+ # ],
33
+ # "object": {
34
+ # "id": "https://ruby.social/users/shanecav/statuses/102570231917342996",
35
+ # "type": "Note",
36
+ # "summary": null,
37
+ # "inReplyTo": null,
38
+ # "published": "2019-08-06T13:18:52Z",
39
+ # "url": "https://ruby.social/@shanecav/102570231917342996",
40
+ # "attributedTo": "https://ruby.social/users/shanecav",
41
+ # "to": [
42
+ # "https://www.w3.org/ns/activitystreams#Public"
43
+ # ],
44
+ # "cc": [
45
+ # "https://ruby.social/users/shanecav/followers"
46
+ # ],
47
+ # "sensitive": false,
48
+ # "atomUri": "https://ruby.social/users/shanecav/statuses/102570231917342996",
49
+ # "inReplyToAtomUri": null,
50
+ # "conversation": "tag:ruby.social_web,2019-08-06:objectId=1700199:objectType=Conversation",
51
+ # "content": "\u003cp\u003ebeep\u003c/p\u003e",
52
+ # "contentMap": {
53
+ # "en": "\u003cp\u003ebeep\u003c/p\u003e"
54
+ # },
55
+ # "attachment": [],
56
+ # "tag": [],
57
+ # "replies": {
58
+ # "id": "https://ruby.social/users/shanecav/statuses/102570231917342996/replies",
59
+ # "type": "Collection",
60
+ # "first": {
61
+ # "type": "CollectionPage",
62
+ # "partOf": "https://ruby.social/users/shanecav/statuses/102570231917342996/replies",
63
+ # "items": []
64
+ # }
65
+ # }
66
+ # },
67
+ # "signature": {
68
+ # "type": "RsaSignature2017",
69
+ # "creator": "https://ruby.social/users/shanecav#main-key",
70
+ # "created": "2019-08-06T13:18:53Z",
71
+ # "signatureValue": "Y6wqiUgqm/ykzKw/jCtsB5fQciGq9TMILNt57FanVg5N8UfLg4vG7Z9Xg6jIAMb++UzyDCW2oc3k9OzD/w0iCSsbMG3Mi+0OdVXNEK7DarDMWJHLgOTaUMW7C/hY8Z+OlhbSu+VvhRVuFUETgTxCDxnGSydZyFL8PTjNQ52hbEbkDqKyS+SwyQqr4T4niM5c631cwlVfX8cwSPWKdNjEpQGyqSp4nqxfw//Mtz4n6eK4X0FcZVoGA8ZddZXViZB/xw0SZfxj+ctKqz2BHRtn7f3MNMlkIBdhuqbIy46DfTODQFnnbHsuLykR8uXL7d1nf27sEdczxzcWRgnK8dG+aQ=="
72
+ # }
73
+ # }
74
+ class Activity::Create < Activity; end
75
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Activity::Delete < Activity
5
+ # {
6
+ # "@context": [
7
+ # "https://www.w3.org/ns/activitystreams",
8
+ # {
9
+ # "ostatus": "http://ostatus.org#",
10
+ # "atomUri": "ostatus:atomUri"
11
+ # }
12
+ # ],
13
+ # "id": "https://ruby.social/users/shanecav/statuses/102570231917342996#delete",
14
+ # "type": "Delete",
15
+ # "actor": "https://ruby.social/users/shanecav",
16
+ # "to": [
17
+ # "https://www.w3.org/ns/activitystreams#Public"
18
+ # ],
19
+ # "object": {
20
+ # "id": "https://ruby.social/users/shanecav/statuses/102570231917342996",
21
+ # "type": "Tombstone",
22
+ # "atomUri": "https://ruby.social/users/shanecav/statuses/102570231917342996"
23
+ # },
24
+ # "signature": {
25
+ # "type": "RsaSignature2017",
26
+ # "creator": "https://ruby.social/users/shanecav#main-key",
27
+ # "created": "2019-08-06T13:18:57Z",
28
+ # "signatureValue": "FwTuT1BG5zf10hl+YCUtP3uhTWhdwSUUTiXWv2yCXPCpy1EpK1ZDQuWvCSZJvWoNbc2A+51WHKcuUod/0/ln0IpDewS2dhgeMyQ7r2VVN0ky7WDSWzdoEkLueyXweNKGuIQNNAfcPAPTelSIqeREa06Ssbf3VnP3urOiFBLN55VUI5hFhF3uM18Pfx7pww6+E0/fDulNCqAkw7iWRouOyXDZZNEvTz5u+bBpR37DQCr7ZvePADBhpzYWLcjS8Jvv3wOrkAG9No1ZgcVpeWqOLK6zCQPShbaUCqV1MzdAVTb553riQ8fldzYmd4dT8U4nkM96GMJIUA9rv8i5C45NhA=="
29
+ # }
30
+ # }
31
+ end
32
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Activity::Update < Activity; end
5
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Activity < ActivityStreams::Object
5
+ %w[
6
+ actor
7
+ instrument
8
+ object origin
9
+ result
10
+ target
11
+ ].each(&method(:attribute))
12
+ end
13
+ end
14
+
15
+ Dir[File.join(__dir__, 'activity', '*.rb')].each { |f| require f }
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Actor::Person < Actor; end
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'object'
4
+
5
+ module ActivityStreams
6
+ class Actor < ActivityStreams::Object; end
7
+ end
8
+
9
+ Dir[File.join(__dir__, 'actor', '*.rb')].each { |f| require f }
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Collection::CollectionPage < Collection
5
+ %w[next partOf prev].each(&method(:attribute))
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'object'
4
+
5
+ module ActivityStreams
6
+ class Collection < ActivityStreams::Object
7
+ %w[current first items last totalItems].each(&method(:attribute))
8
+ end
9
+ end
10
+
11
+ Dir[File.join(__dir__, 'collection', '*.rb')].each { |f| require f }
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Link < ActivityStreams::Model; end
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Object::Image < Object; end
5
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ # {
5
+ # "object": {
6
+ # "id": "https://ruby.social/users/shanecav/statuses/102570231917342996",
7
+ # "type": "Note",
8
+ # "summary": null,
9
+ # "inReplyTo": null,
10
+ # "published": "2019-08-06T13:18:52Z",
11
+ # "url": "https://ruby.social/@shanecav/102570231917342996",
12
+ # "attributedTo": "https://ruby.social/users/shanecav",
13
+ # "to": [
14
+ # "https://www.w3.org/ns/activitystreams#Public"
15
+ # ],
16
+ # "cc": [
17
+ # "https://ruby.social/users/shanecav/followers"
18
+ # ],
19
+ # "sensitive": false,
20
+ # "atomUri": "https://ruby.social/users/shanecav/statuses/102570231917342996",
21
+ # "inReplyToAtomUri": null,
22
+ # "conversation": "tag:ruby.social_web,2019-08-06:objectId=1700199:objectType=Conversation",
23
+ # "content": "\u003cp\u003ebeep\u003c/p\u003e",
24
+ # "contentMap": {
25
+ # "en": "\u003cp\u003ebeep\u003c/p\u003e"
26
+ # },
27
+ # "attachment": [],
28
+ # "tag": [],
29
+ # "replies": {
30
+ # "id": "https://ruby.social/users/shanecav/statuses/102570231917342996/replies",
31
+ # "type": "Collection",
32
+ # "first": {
33
+ # "type": "CollectionPage",
34
+ # "partOf": "https://ruby.social/users/shanecav/statuses/102570231917342996/replies",
35
+ # "items": []
36
+ # }
37
+ # }
38
+ # }
39
+ # }
40
+ class Object::Note < Object
41
+ include ActivityStreams::Extensions::Sensitive
42
+ end
43
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ class Object < ActivityStreams::Model
5
+ %w[
6
+ attachment attributedTo audience
7
+ bcc bto
8
+ cc content context
9
+ duration
10
+ endTime
11
+ generator
12
+ icon id image inReplyTo
13
+ location
14
+ mediaType
15
+ name
16
+ preview published
17
+ replies
18
+ startTime summary
19
+ tag
20
+ updated url
21
+ to
22
+ ].each(&method(:attribute))
23
+
24
+ attribute :published, :datetime
25
+ attribute :startTime, :datetime
26
+ attribute :updated, :datetime
27
+ end
28
+ end
29
+
30
+ Dir[File.join(__dir__, 'object', '*.rb')].each { |f| require f }
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ Dir[File.join(__dir__, 'concerns', '*.rb')].each { |f| require f }
4
+ Dir[File.join(__dir__, 'validators', '*.rb')].each { |f| require f }
5
+
6
+ module ActivityStreams
7
+ class Model
8
+ include ActiveModel::Model
9
+ include ActiveModel::Attributes
10
+ include Concerns::Serialization
11
+
12
+ CONTEXT = 'https://www.w3.org/ns/activitystreams'
13
+
14
+ attr_accessor :original_json
15
+
16
+ attribute :'@context'
17
+ alias_attribute :_context, :'@context'
18
+ attribute :type, :string
19
+
20
+ validate Validators::ContextValidator
21
+ validates :type, inclusion: { in: ->(obj) { obj.class.name } }
22
+ end
23
+ end
24
+
25
+ Dir[File.join(__dir__, 'extensions', '*.rb')].each { |f| require f }
26
+ Dir[File.join(__dir__, 'model', '*.rb')].each { |f| require f }
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActivityStreams
4
+ module Validators
5
+ ContextValidator = lambda do |obj|
6
+ ctx = obj._context
7
+ return if ctx.nil? ||
8
+ (ctx.is_a?(Array) && ctx.include?(Model::CONTEXT)) ||
9
+ (ctx.is_a?(String) && ctx == Model::CONTEXT)
10
+
11
+ obj.errors.add(
12
+ :'@context',
13
+ "@context is unsupported. Must be #{Model::CONTEXT}, got #{ctx}"
14
+ )
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module ActivityStreams
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_model'
4
+ require 'json'
5
+
6
+ Dir[File.join(__dir__, 'activity_streams', '*.rb')].each { |f| require f }
7
+
8
+ module ActivityStreams
9
+ class Error < StandardError; end
10
+ class UnsupportedType < Error; end
11
+
12
+ class << self
13
+ def from_json(json)
14
+ Factory.new(json).build
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ module ActivityStreams
6
+ module Concerns
7
+ RSpec.describe Serialization do
8
+ let(:model) {
9
+ Class.new { include Serialization }
10
+ }
11
+
12
+ describe '#to_json' do
13
+ it 'deep serializes to JSON' do
14
+ json = File.read(
15
+ File.join(__dir__, '..', '..', 'fixtures/extended_activity.json')
16
+ )
17
+
18
+ obj = ActivityStreams.from_json(json)
19
+ expect(obj.original_json).to eq(json)
20
+ expect(JSON.parse(obj.original_json).hash).
21
+ to eq(JSON.parse(obj.to_json).hash)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ module ActivityStreams
6
+ RSpec.describe Factory do
7
+ it 'deeply inits' do
8
+ json = File.read(
9
+ File.join(__dir__, '..', 'fixtures/extended_activity.json')
10
+ )
11
+
12
+ collection = described_class.new(json).build
13
+ expect(collection.original_json).to eq(json)
14
+ expect(collection).to be_a(ActivityStreams::Collection)
15
+ expect(collection.valid?).to eq(true)
16
+ expect(collection.send(:'@context')).
17
+ to eq('https://www.w3.org/ns/activitystreams')
18
+ expect(collection._context).to eq('https://www.w3.org/ns/activitystreams')
19
+ expect(collection.type).to eq('Collection')
20
+
21
+ expect(collection.items).to be_a(Array)
22
+
23
+ add = collection.items.first
24
+ expect(add).to be_a(ActivityStreams::Activity::Add)
25
+ expect(add.published).to be_a(Time)
26
+
27
+ actor = add.actor
28
+ expect(actor).to be_a(ActivityStreams::Actor)
29
+ expect(actor.image).to be_a(ActivityStreams::Link)
30
+
31
+ object = add.object
32
+ expect(object).to be_a(ActivityStreams::Object::Image)
33
+
34
+ target = add.target
35
+ expect(target).to be_a(ActivityStreams::Collection)
36
+ end
37
+
38
+ it 'raise an error when it recieves an unsupported type' do
39
+ json = <<~JSON
40
+ {
41
+ "@context": "https://www.w3.org/ns/activitystreams",
42
+ "type": "Nope"
43
+ }
44
+ JSON
45
+
46
+ expect { described_class.new(json).build }.
47
+ to raise_error(ActivityStreams::UnsupportedType, 'Nope')
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ module ActivityStreams
6
+ RSpec.describe Model do
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+ RSpec.describe ActivityStreams do
2
+ it "has a version number" do
3
+ expect(ActivityStreams::VERSION).not_to be nil
4
+ end
5
+
6
+ describe '#from_json' do
7
+ it 'delegates to factory' do
8
+ json = '{}'
9
+ factory = instance_double('ActivityStreams::Factory', build: nil)
10
+
11
+ expect(ActivityStreams::Factory).
12
+ to receive(:new).
13
+ with(json).
14
+ and_return(factory)
15
+
16
+ described_class.from_json(json)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,65 @@
1
+ {
2
+ "@context": "https://www.w3.org/ns/activitystreams",
3
+ "summary": "Martin's recent activities",
4
+ "type": "Collection",
5
+ "totalItems": 1,
6
+ "items" : [
7
+ {
8
+ "type": "Add",
9
+ "published": "2011-02-10T15:04:55Z",
10
+ "generator": "http://example.org/activities-app",
11
+ "nameMap": {
12
+ "en": "Martin added a new image to his album.",
13
+ "ga": "Martin phost le fisean nua a albam."
14
+ },
15
+ "actor": {
16
+ "type": "Person",
17
+ "id": "http://www.test.example/martin",
18
+ "name": "Martin Smith",
19
+ "url": "http://example.org/martin",
20
+ "image": {
21
+ "type": "Link",
22
+ "href": "http://example.org/martin/image",
23
+ "mediaType": "image/jpeg",
24
+ "width": 250,
25
+ "height": 250
26
+ }
27
+ },
28
+ "object" : {
29
+ "name": "My fluffy cat",
30
+ "type": "Image",
31
+ "id": "http://example.org/album/máiréad.jpg",
32
+ "preview": {
33
+ "type": "Link",
34
+ "href": "http://example.org/album/máiréad.jpg",
35
+ "mediaType": "image/jpeg"
36
+ },
37
+ "url": [
38
+ {
39
+ "type": "Link",
40
+ "href": "http://example.org/album/máiréad.jpg",
41
+ "mediaType": "image/jpeg"
42
+ },
43
+ {
44
+ "type": "Link",
45
+ "href": "http://example.org/album/máiréad.png",
46
+ "mediaType": "image/png"
47
+ }
48
+ ]
49
+ },
50
+ "target": {
51
+ "type": "Collection",
52
+ "id": "http://example.org/album/",
53
+ "nameMap": {
54
+ "en": "Martin's Photo Album",
55
+ "ga": "Grianghraif Mairtin"
56
+ },
57
+ "image": {
58
+ "type": "Link",
59
+ "href": "http://example.org/album/thumbnail.jpg",
60
+ "mediaType": "image/jpeg"
61
+ }
62
+ }
63
+ }
64
+ ]
65
+ }
@@ -0,0 +1,14 @@
1
+ require "bundler/setup"
2
+ require "activity_streams"
3
+
4
+ RSpec.configure do |config|
5
+ # Enable flags like --only-failures and --next-failure
6
+ config.example_status_persistence_file_path = "tmp/.rspec_status"
7
+
8
+ # Disable RSpec exposing methods globally on `Module` and `main`
9
+ config.disable_monkey_patching!
10
+
11
+ config.expect_with :rspec do |c|
12
+ c.syntax = :expect
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: social_web-activity_streams
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Shane Cavanaugh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-08-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: roda
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack-test
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.1'
83
+ description: Models for ActivityStreams
84
+ email:
85
+ - shane@shanecav.net
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - LICENSE.txt
91
+ - lib/activity_streams.rb
92
+ - lib/activity_streams/concerns/serialization.rb
93
+ - lib/activity_streams/extensions/linked_data_signature.rb
94
+ - lib/activity_streams/extensions/sensistive.rb
95
+ - lib/activity_streams/factory.rb
96
+ - lib/activity_streams/model.rb
97
+ - lib/activity_streams/model/activity.rb
98
+ - lib/activity_streams/model/activity/add.rb
99
+ - lib/activity_streams/model/activity/create.rb
100
+ - lib/activity_streams/model/activity/delete.rb
101
+ - lib/activity_streams/model/activity/update.rb
102
+ - lib/activity_streams/model/actor.rb
103
+ - lib/activity_streams/model/actor/person.rb
104
+ - lib/activity_streams/model/collection.rb
105
+ - lib/activity_streams/model/collection/collection_page.rb
106
+ - lib/activity_streams/model/link.rb
107
+ - lib/activity_streams/model/object.rb
108
+ - lib/activity_streams/model/object/image.rb
109
+ - lib/activity_streams/model/object/note.rb
110
+ - lib/activity_streams/validators/context_validator.rb
111
+ - lib/activity_streams/version.rb
112
+ - spec/activity_streams/concerns/serialization_spec.rb
113
+ - spec/activity_streams/factory_spec.rb
114
+ - spec/activity_streams/model_spec.rb
115
+ - spec/activity_streams_spec.rb
116
+ - spec/fixtures/extended_activity.json
117
+ - spec/spec_helper.rb
118
+ homepage: https://github.com/social_web/activity_streams
119
+ licenses:
120
+ - MIT
121
+ metadata:
122
+ homepage_uri: https://github.com/social_web/activity_streams
123
+ source_code_uri: https://github.com/social_web/activity_streams
124
+ changelog_uri: https://github.com/social_web/activity_streams/tree/master/CHANGELOG.md
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: 1.9.2
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubygems_version: 3.0.4
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Models for ActivityStreams
144
+ test_files: []