diaspora_federation 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 202b522935a3c394944b6578a45868370beff4748994f9bf8fa5cded6dd436b0
4
- data.tar.gz: 761667ad6330ccb2088751a0bde704e914b0e590f347938577c19002d0aaf4a4
3
+ metadata.gz: 55951778511742a4269e05b406ef43ca976410c07e91364896138e3df1cf7019
4
+ data.tar.gz: 3fed9b6d22ec275798e45a1df2c593835d1750fdac9c68158192a06640b4bcb5
5
5
  SHA512:
6
- metadata.gz: 1adda0e8a5d0f789a31a589b24775ea2b09e06d3d24116ea29f0a8057680783a8dd79094c7f4c0047c1c064b18d92c2d40b6c9506ab813284c826589f714b9c3
7
- data.tar.gz: dcd14ec61c90371f4153094b02d0341838b92d37401cb1354c1845d81cbeaf6b3d32fc883809a88ad35dc6974a5b4d2d6a5f3ed844ab2ddb658c292ca070c6be
6
+ metadata.gz: 33b62f247e32f32874930b71f907540ae7f0dbf88182d1bd8e5a4c4590dd21eee9c2f9b691d54ed96d5688b9eca5c7523780fbd1b1a89ad7e2ae4ad9ca77c371
7
+ data.tar.gz: 581f0595fbd988aa146aea231bf80c2f81063c0719c671a83f685b162364922941bc8f68bd55b9a22385f520e0f7e162c66f71802e99703ccd54f03426d79731
data/Changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 1.0.0
2
+
3
+ * Add rails 7 support [#126](https://github.com/diaspora/diaspora_federation/pull/126)
4
+ * Add faraday 2 support [#126](https://github.com/diaspora/diaspora_federation/pull/126)
5
+
1
6
  # 0.3.0
2
7
 
3
8
  ## Breaking changes
@@ -14,6 +19,10 @@
14
19
  * Add faraday 1.x support [#116](https://github.com/diaspora/diaspora_federation/pull/116)
15
20
  * Add support for up to ruby 3.1 [#121](https://github.com/diaspora/diaspora_federation/pull/121)
16
21
 
22
+ # 0.2.8
23
+
24
+ * Re-release which allows rails 6 to be used
25
+
17
26
  # 0.2.7
18
27
 
19
28
  ## Features
@@ -38,8 +38,8 @@ module DiasporaFederation
38
38
  # Validates if the diaspora* ID matches the diaspora* ID in the webfinger response
39
39
  return if diaspora_id == clean_diaspora_id(webfinger.acct_uri)
40
40
 
41
- raise DiscoveryError, "diaspora* ID does not match: Wanted #{diaspora_id} but got" \
42
- " #{clean_diaspora_id(webfinger.acct_uri)}"
41
+ raise DiscoveryError, "diaspora* ID does not match: Wanted #{diaspora_id} but got " \
42
+ "#{clean_diaspora_id(webfinger.acct_uri)}"
43
43
  end
44
44
 
45
45
  def clean_diaspora_id(diaspora_id)
@@ -136,10 +136,7 @@ module DiasporaFederation
136
136
 
137
137
  private
138
138
 
139
- # rubocop:disable Layout/EmptyLinesAroundAttributeAccessor Style/AccessorGrouping
140
- attr_reader :expires
141
- attr_reader :subject
142
- # rubocop:enable Layout/EmptyLinesAroundAttributeAccessor Style/AccessorGrouping
139
+ attr_reader :expires, :subject
143
140
 
144
141
  NS = {xrd: XMLNS}.freeze
145
142
 
@@ -131,7 +131,7 @@ module DiasporaFederation
131
131
  data = super
132
132
  order = signature_order
133
133
  order += %i[author_signature] unless author == parent.root.author
134
- order.map {|element| [element, data[element].to_s] }.to_h
134
+ order.to_h {|element| [element, data[element].to_s] }
135
135
  end
136
136
 
137
137
  def signature_order=(order)
@@ -77,7 +77,7 @@ module DiasporaFederation
77
77
  # Nested entities are also converted to a Hash.
78
78
  # @return [Hash] entity data (mostly equal to the hash used for initialization).
79
79
  def to_h
80
- enriched_properties.map {|key, value|
80
+ enriched_properties.to_h {|key, value|
81
81
  type = self.class.class_props[key]
82
82
 
83
83
  if type.instance_of?(Symbol) || value.nil?
@@ -87,7 +87,7 @@ module DiasporaFederation
87
87
  elsif type.instance_of?(Array)
88
88
  [key, value.map(&:to_h)]
89
89
  end
90
- }.to_h
90
+ }
91
91
  end
92
92
 
93
93
  # Returns the XML representation for this entity constructed out of
@@ -273,7 +273,7 @@ module DiasporaFederation
273
273
  end
274
274
 
275
275
  def normalized_properties
276
- properties.map {|name, value| [name, normalize_property(name, value)] }.to_h
276
+ properties.to_h {|name, value| [name, normalize_property(name, value)] }
277
277
  end
278
278
 
279
279
  def normalize_property(name, value)
@@ -26,7 +26,7 @@ module DiasporaFederation
26
26
  def self.private(sender_id, obj_str, targets)
27
27
  hydra = HydraWrapper.new(sender_id, obj_str)
28
28
  targets.each {|url, json| hydra.insert_enc_magic_env_request(url, json) }
29
- hydra.send.map {|url| [url, targets[url]] }.to_h
29
+ hydra.send.to_h {|url| [url, targets[url]] }
30
30
  end
31
31
  end
32
32
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "faraday"
4
- require "faraday_middleware"
4
+ require "faraday/follow_redirects"
5
5
 
6
6
  module DiasporaFederation
7
7
  # A wrapper for {https://github.com/lostisland/faraday Faraday}
@@ -32,7 +32,8 @@ module DiasporaFederation
32
32
  }
33
33
 
34
34
  @connection = Faraday::Connection.new(options) do |builder|
35
- builder.response :follow_redirects, limit: DiasporaFederation.http_redirect_limit
35
+ builder.use Faraday::FollowRedirects::Middleware, limit: DiasporaFederation.http_redirect_limit
36
+
36
37
  builder.adapter Faraday.default_adapter
37
38
  end
38
39
 
@@ -17,7 +17,7 @@ module DiasporaFederation
17
17
  private
18
18
 
19
19
  def parse_entity_data(entity_data)
20
- hash = entity_data.map {|key, value|
20
+ hash = entity_data.to_h {|key, value|
21
21
  property = entity_type.class_props.keys.find {|name| name.to_s == key }
22
22
  if property
23
23
  type = entity_type.class_props[property]
@@ -25,7 +25,7 @@ module DiasporaFederation
25
25
  else
26
26
  [key, value]
27
27
  end
28
- }.to_h
28
+ }
29
29
 
30
30
  [hash]
31
31
  end
@@ -49,9 +49,7 @@ module DiasporaFederation
49
49
  end
50
50
 
51
51
  def from_json_sanity_validation(json_hash)
52
- missing = %w[entity_type entity_data].map {|prop|
53
- prop if json_hash[prop].nil?
54
- }.compact.join(", ")
52
+ missing = %w[entity_type entity_data].select {|prop| json_hash[prop].nil? }.join(", ")
55
53
  raise DeserializationError, "Required properties are missing in JSON object: #{missing}" unless missing.empty?
56
54
 
57
55
  assert_parsability_of(json_hash["entity_type"])
@@ -14,7 +14,7 @@ module DiasporaFederation
14
14
  def parse(root_node)
15
15
  from_xml_sanity_validation(root_node)
16
16
 
17
- hash = root_node.element_children.uniq(&:name).map {|child|
17
+ hash = root_node.element_children.uniq(&:name).to_h {|child|
18
18
  property, type = find_property_for(child.name)
19
19
  if property
20
20
  value = parse_element_from_node(child.name, type, root_node)
@@ -22,7 +22,7 @@ module DiasporaFederation
22
22
  else
23
23
  [child.name, child.text]
24
24
  end
25
- }.to_h
25
+ }
26
26
 
27
27
  [hash]
28
28
  end
@@ -57,7 +57,7 @@ module DiasporaFederation
57
57
  # resolved on each call
58
58
  # @return [Hash] default values
59
59
  def default_values
60
- optional_props.map {|name| [name, nil] }.to_h.merge(default_props).transform_values {|prop|
60
+ optional_props.to_h {|name| [name, nil] }.merge(default_props).transform_values {|prop|
61
61
  prop.respond_to?(:call) ? prop.call : prop
62
62
  }
63
63
  end
@@ -65,7 +65,7 @@ module DiasporaFederation
65
65
  # @param [Hash] data entity data
66
66
  # @return [Hash] hash with resolved aliases
67
67
  def resolv_aliases(data)
68
- data.map {|name, value|
68
+ data.to_h {|name, value|
69
69
  if class_prop_aliases.has_key? name
70
70
  prop_name = class_prop_aliases[name]
71
71
  raise InvalidData, "only use '#{name}' OR '#{prop_name}'" if data.has_key? prop_name
@@ -74,7 +74,7 @@ module DiasporaFederation
74
74
  else
75
75
  [name, value]
76
76
  end
77
- }.to_h
77
+ }
78
78
  end
79
79
 
80
80
  private
@@ -2,5 +2,5 @@
2
2
 
3
3
  module DiasporaFederation
4
4
  # the gem version
5
- VERSION = "0.3.0"
5
+ VERSION = "1.0.0"
6
6
  end
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diaspora_federation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Neff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-13 00:00:00.000000000 Z
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
34
+ name: faraday-follow_redirects
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '1.0'
39
+ version: '0.3'
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '1.0'
46
+ version: '0.3'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: nokogiri
43
49
  requirement: !ruby/object:Gem::Requirement