ruby-miradore 2.2.4 → 2.2.8

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: 76c58bc3692818bc8bcbb9bd67bd4a13fb5d5f2bd81d09bbb6cc6af547db532a
4
- data.tar.gz: 8233914b10e2a5b349f0e0ee78966e48da2d83b28a42da349f4a0eecd5415ca5
3
+ metadata.gz: efbcb64691baacb85437513ce026dcbe4d83b3780f80abab9aaaf3987d3ecd84
4
+ data.tar.gz: 4af8d25db40cae8541dc8f8c1cd8b1fa77fe7bf2ec8d77d640a5c88535ef1f11
5
5
  SHA512:
6
- metadata.gz: '09dbe42515b0cc45fe6b6d648b45e385f525d51173e81b0025944b148a48ad88ef87573e76463ddb478d9a0bef49a8270fb9c187822b9dd039ffc0abe676b50f'
7
- data.tar.gz: 5a91f7947287e92e247b4753e8a652b6e06c8f96a81ec532483fa4a823a3a39d5fe00a584c4afb402344b2ffb07d5bdab17df5e1122e1441968862ec3d14f0ca
6
+ metadata.gz: dd74589d9f523d2f0a8a2cdd2ed47a7154936271cc0657e321d6e959312efc0897e602f92b5ff618bcf51e9b0e081c8cf04ed947e69ea550b7907548ef120a91
7
+ data.tar.gz: 940ce07c57138b533c8daf938638ad241153ff86a6c5436142b766286fe05abc80eaf015c93e20a760d5bcff3978139805d9013cdf932dfa7c467fbea9b1a5ff
data/Gemfile.lock CHANGED
@@ -1,7 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-miradore (2.2.4)
4
+ ruby-miradore (2.2.8)
5
+ activesupport (~> 6.1)
6
+ builder (~> 3.1)
5
7
  crack (~> 0.4)
6
8
  finest-builder (~> 1.0)
7
9
  httparty (~> 0.18)
@@ -12,20 +14,31 @@ PATH
12
14
  GEM
13
15
  remote: https://rubygems.org/
14
16
  specs:
17
+ activesupport (6.1.4.1)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 1.6, < 2)
20
+ minitest (>= 5.1)
21
+ tzinfo (~> 2.0)
22
+ zeitwerk (~> 2.3)
15
23
  addressable (2.8.0)
16
24
  public_suffix (>= 2.0.2, < 5.0)
17
25
  ast (2.4.2)
26
+ builder (3.2.4)
27
+ concurrent-ruby (1.1.9)
18
28
  crack (0.4.5)
19
29
  rexml
20
30
  diff-lcs (1.4.4)
21
- finest-builder (1.0.1)
31
+ finest-builder (1.1.1)
22
32
  hashdiff (1.0.1)
23
33
  httparty (0.20.0)
24
34
  mime-types (~> 3.0)
25
35
  multi_xml (>= 0.5.2)
36
+ i18n (1.8.11)
37
+ concurrent-ruby (~> 1.0)
26
38
  mime-types (3.3.1)
27
39
  mime-types-data (~> 3.2015)
28
40
  mime-types-data (3.2021.0901)
41
+ minitest (5.14.4)
29
42
  multi_xml (0.6.0)
30
43
  parallel (1.21.0)
31
44
  parser (3.0.2.0)
@@ -57,15 +70,18 @@ GEM
57
70
  rubocop-ast (>= 1.12.0, < 2.0)
58
71
  ruby-progressbar (~> 1.7)
59
72
  unicode-display_width (>= 1.4.0, < 3.0)
60
- rubocop-ast (1.12.0)
73
+ rubocop-ast (1.13.0)
61
74
  parser (>= 3.0.1.1)
62
75
  ruby-progressbar (1.11.0)
76
+ tzinfo (2.0.4)
77
+ concurrent-ruby (~> 1.0)
63
78
  unicode-display_width (2.1.0)
64
79
  vcr (6.0.0)
65
80
  webmock (3.14.0)
66
81
  addressable (>= 2.8.0)
67
82
  crack (>= 0.3.2)
68
83
  hashdiff (>= 0.4.0, < 2.0.0)
84
+ zeitwerk (2.5.1)
69
85
 
70
86
  PLATFORMS
71
87
  x86_64-darwin-20
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ruby
4
4
  module Miradore
5
- VERSION = "2.2.4"
5
+ VERSION = "2.2.8"
6
6
  end
7
7
  end
data/lib/ruby/miradore.rb CHANGED
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "miradore/version"
4
+ require "active_support/core_ext/hash/conversions"
4
5
  require "httparty"
5
6
  require "json"
6
7
  require "crack/xml"
7
8
  require "finest/builder"
8
9
 
10
+
9
11
  module Ruby
10
12
  module Miradore
11
13
 
@@ -23,11 +25,13 @@ module Ruby
23
25
  format :json
24
26
 
25
27
  attr_writer :subdomain, :auth
28
+ attr_accessor :json
26
29
 
27
30
  def initialize(json = {})
28
31
  super json
29
32
  @subdomain ||= json[:subdomain]
30
33
  @auth ||= json[:auth]
34
+ @json ||= json.to_json
31
35
  remove_instance_variable(:@subdomain) if @subdomain.nil?
32
36
  remove_instance_variable(:@auth) if @auth.nil?
33
37
  end
@@ -47,10 +51,10 @@ module Ruby
47
51
  )
48
52
  end
49
53
 
50
- def add(**args)
54
+ def call(**args)
51
55
  transform(
52
56
  Crack::XML.parse(
53
- http_method(args.merge(method: :post, attribute: "ID")).body
57
+ http_method(args.merge( attribute: "ID")).body
54
58
  )["Content"]
55
59
  )
56
60
  end
@@ -64,7 +68,7 @@ module Ruby
64
68
  auth: args.fetch(:auth, nil),
65
69
  filter: args.fetch(:filter, nil)
66
70
  )
67
- method(args.fetch(:method, :get)).call(url, body: args.fetch(:body, nil))
71
+ method(args.fetch(:method, :get)).call(url, body: args.fetch(:body, nil)&.to_xml(root: "Content", skip_types: true))
68
72
  end
69
73
 
70
74
  private
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  # Uncomment to register a new dependency of your gem
33
33
  # spec.add_dependency "example-gem", "~> 1.0"
34
- #spec.add_dependency "activesupport", "~> 6.1"
35
- #spec.add_dependency 'builder', '~> 3.1'
34
+ spec.add_dependency "activesupport", "~> 6.1"
35
+ spec.add_dependency 'builder', '~> 3.1'
36
36
  spec.add_dependency "crack", "~> 0.4"
37
37
  spec.add_dependency "finest-builder", "~> 1.0"
38
38
  spec.add_dependency "httparty", "~> 0.18"
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-miradore
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduard Garcia Castelló
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-03 00:00:00.000000000 Z
11
+ date: 2021-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: builder
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.1'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: crack
15
43
  requirement: !ruby/object:Gem::Requirement