cmis-ruby 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/cmis-ruby.rb +2 -0
 - data/lib/cmis/children.rb +0 -2
 - data/lib/cmis/connection.rb +15 -10
 - data/lib/cmis/connection/request_modifier.rb +1 -2
 - data/lib/cmis/document.rb +0 -2
 - data/lib/cmis/folder.rb +4 -0
 - data/lib/cmis/helpers.rb +0 -2
 - data/lib/cmis/property_definition.rb +0 -3
 - data/lib/cmis/query.rb +0 -2
 - data/lib/cmis/relationships.rb +0 -2
 - data/lib/cmis/repository.rb +0 -1
 - data/lib/cmis/type.rb +0 -2
 - data/lib/cmis/version.rb +1 -1
 - data/lib/ext/all.rb +6 -0
 - data/lib/{core_ext → ext}/hash/keys.rb +0 -0
 - data/lib/{core_ext → ext}/hash/slice.rb +0 -0
 - data/lib/{core_ext → ext}/string/as_ruby_property.rb +0 -0
 - data/spec/cmis-ruby/folder_spec.rb +25 -7
 - metadata +6 -6
 - data/lib/core_ext/hash/compact.rb +0 -20
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bc1ea1cc077ed4b4c93cd43fa9a70057739c8e72
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9e2fedaca4470a343789aba8f881c6d5145ac640
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 614d6bfa3c3b4f9bfcd8022d652e42c4dc7cd554c9bb786f88cfcdc12089db2bd5cd99e462163645d47f3adeea56d1b544041f9e4beb03dddd5d62e8d17e7580
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9931cd84d1a5918f094f11fb270fe4538d8a81809885b149f0eca92aa953f0744b49b6727ba651e0e722eaf44558f78e485d7651ac3dbdd5c1967a776a45e6e9
         
     | 
    
        data/lib/cmis-ruby.rb
    CHANGED
    
    
    
        data/lib/cmis/children.rb
    CHANGED
    
    
    
        data/lib/cmis/connection.rb
    CHANGED
    
    | 
         @@ -2,8 +2,6 @@ require 'cmis/connection/request_modifier' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'cmis/connection/response_parser'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'cmis/connection/url_resolver'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'cmis/version'
         
     | 
| 
       5 
     | 
    
         
            -
            require 'core_ext/hash/compact'
         
     | 
| 
       6 
     | 
    
         
            -
            require 'core_ext/hash/keys'
         
     | 
| 
       7 
5 
     | 
    
         
             
            require 'faraday'
         
     | 
| 
       8 
6 
     | 
    
         | 
| 
       9 
7 
     | 
    
         
             
            module CMIS
         
     | 
| 
         @@ -14,14 +12,9 @@ module CMIS 
     | 
|
| 
       14 
12 
     | 
    
         
             
                  message = "option `service_url` must be set"
         
     | 
| 
       15 
13 
     | 
    
         
             
                  service_url = options[:service_url] or raise message
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                   
     | 
| 
      
 15 
     | 
    
         
            +
                  options[:adapter] ||= :net_http
         
     | 
| 
       18 
16 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                   
     | 
| 
       20 
     | 
    
         
            -
                    user_agent: "cmis-ruby/#{VERSION} [#{adapter}]"
         
     | 
| 
       21 
     | 
    
         
            -
                  }.merge(options[:headers] || {})
         
     | 
| 
       22 
     | 
    
         
            -
                  conn_opts = { headers: headers, ssl: options[:ssl] }.compact
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                  @http = Faraday.new(conn_opts) do |builder|
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @http = Faraday.new(connection_options(options)) do |builder|
         
     | 
| 
       25 
18 
     | 
    
         
             
                    builder.use RequestModifier
         
     | 
| 
       26 
19 
     | 
    
         
             
                    builder.request :multipart
         
     | 
| 
       27 
20 
     | 
    
         
             
                    builder.request :url_encoded
         
     | 
| 
         @@ -30,7 +23,7 @@ module CMIS 
     | 
|
| 
       30 
23 
     | 
    
         
             
                      builder.basic_auth(options[:username], options[:password])
         
     | 
| 
       31 
24 
     | 
    
         
             
                    end
         
     | 
| 
       32 
25 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
                    builder.adapter adapter
         
     | 
| 
      
 26 
     | 
    
         
            +
                    builder.adapter options[:adapter].to_sym
         
     | 
| 
       34 
27 
     | 
    
         
             
                    builder.response :logger if options[:log_requests]
         
     | 
| 
       35 
28 
     | 
    
         
             
                    builder.use ResponseParser
         
     | 
| 
       36 
29 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -54,5 +47,17 @@ module CMIS 
     | 
|
| 
       54 
47 
     | 
    
         | 
| 
       55 
48 
     | 
    
         
             
                  response.body
         
     | 
| 
       56 
49 
     | 
    
         
             
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                private
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                def connection_options(options)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  headers = { user_agent: "cmis-ruby/#{VERSION} [#{options[:adapter]}]" }
         
     | 
| 
      
 55 
     | 
    
         
            +
                  headers.merge!(options[:headers]) if options[:headers]
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  conn_opts = { headers: headers }
         
     | 
| 
      
 58 
     | 
    
         
            +
                  conn_opts[:ssl] = options[:ssl] if options[:ssl]
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  conn_opts
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
       57 
62 
     | 
    
         
             
              end
         
     | 
| 
       58 
63 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,4 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'core_ext/hash/compact'
         
     | 
| 
       2 
1 
     | 
    
         
             
            require 'faraday'
         
     | 
| 
       3 
2 
     | 
    
         | 
| 
       4 
3 
     | 
    
         
             
            module CMIS
         
     | 
| 
         @@ -6,7 +5,7 @@ module CMIS 
     | 
|
| 
       6 
5 
     | 
    
         
             
                class RequestModifier < Faraday::Middleware
         
     | 
| 
       7 
6 
     | 
    
         
             
                  def call(env)
         
     | 
| 
       8 
7 
     | 
    
         
             
                    if env[:body]
         
     | 
| 
       9 
     | 
    
         
            -
                      env[:body]. 
     | 
| 
      
 8 
     | 
    
         
            +
                      env[:body].reject! { |_, v| v.nil? }
         
     | 
| 
       10 
9 
     | 
    
         
             
                      wrap_content(env)
         
     | 
| 
       11 
10 
     | 
    
         
             
                      massage_properties(env)
         
     | 
| 
       12 
11 
     | 
    
         
             
                    end
         
     | 
    
        data/lib/cmis/document.rb
    CHANGED
    
    
    
        data/lib/cmis/folder.rb
    CHANGED
    
    
    
        data/lib/cmis/helpers.rb
    CHANGED
    
    
    
        data/lib/cmis/query.rb
    CHANGED
    
    
    
        data/lib/cmis/relationships.rb
    CHANGED
    
    
    
        data/lib/cmis/repository.rb
    CHANGED
    
    
    
        data/lib/cmis/type.rb
    CHANGED
    
    
    
        data/lib/cmis/version.rb
    CHANGED
    
    
    
        data/lib/ext/all.rb
    ADDED
    
    
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -2,6 +2,24 @@ require 'spec_helper' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            module CMIS
         
     | 
| 
       4 
4 
     | 
    
         
             
              describe Folder do
         
     | 
| 
      
 5 
     | 
    
         
            +
                describe '#root?' do
         
     | 
| 
      
 6 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @folder = create_folder
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  after do
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @folder.delete
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  it 'returns true for the root folder' do
         
     | 
| 
      
 15 
     | 
    
         
            +
                    expect(repository.root.root?).to be_true
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  it 'returns false for another folder' do
         
     | 
| 
      
 19 
     | 
    
         
            +
                    expect(@folder.root?).to be_false
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       5 
23 
     | 
    
         
             
                describe '#parent' do
         
     | 
| 
       6 
24 
     | 
    
         
             
                  before do
         
     | 
| 
       7 
25 
     | 
    
         
             
                    @folder = create_folder
         
     | 
| 
         @@ -18,13 +36,6 @@ module CMIS 
     | 
|
| 
       18 
36 
     | 
    
         
             
                  it 'is the root folder for its child' do
         
     | 
| 
       19 
37 
     | 
    
         
             
                    expect(@folder.parent.cmis_object_id).to eq(repository.root_folder_id)
         
     | 
| 
       20 
38 
     | 
    
         
             
                  end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
                  def create_folder
         
     | 
| 
       23 
     | 
    
         
            -
                    folder = repository.new_folder
         
     | 
| 
       24 
     | 
    
         
            -
                    folder.name = 'test_folder'
         
     | 
| 
       25 
     | 
    
         
            -
                    folder.object_type_id = 'cmis:folder'
         
     | 
| 
       26 
     | 
    
         
            -
                    repository.root.create(folder)
         
     | 
| 
       27 
     | 
    
         
            -
                  end
         
     | 
| 
       28 
39 
     | 
    
         
             
                end
         
     | 
| 
       29 
40 
     | 
    
         | 
| 
       30 
41 
     | 
    
         
             
                describe '#create' do
         
     | 
| 
         @@ -62,5 +73,12 @@ module CMIS 
     | 
|
| 
       62 
73 
     | 
    
         
             
                    end
         
     | 
| 
       63 
74 
     | 
    
         
             
                  end
         
     | 
| 
       64 
75 
     | 
    
         
             
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                def create_folder
         
     | 
| 
      
 78 
     | 
    
         
            +
                  folder = repository.new_folder
         
     | 
| 
      
 79 
     | 
    
         
            +
                  folder.name = 'test_folder'
         
     | 
| 
      
 80 
     | 
    
         
            +
                  folder.object_type_id = 'cmis:folder'
         
     | 
| 
      
 81 
     | 
    
         
            +
                  repository.root.create(folder)
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
       65 
83 
     | 
    
         
             
              end
         
     | 
| 
       66 
84 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: cmis-ruby
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.6
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kenneth Geerts
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2014-04- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2014-04-03 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: faraday
         
     | 
| 
         @@ -68,10 +68,10 @@ files: 
     | 
|
| 
       68 
68 
     | 
    
         
             
            - lib/cmis/server.rb
         
     | 
| 
       69 
69 
     | 
    
         
             
            - lib/cmis/type.rb
         
     | 
| 
       70 
70 
     | 
    
         
             
            - lib/cmis/version.rb
         
     | 
| 
       71 
     | 
    
         
            -
            - lib/ 
     | 
| 
       72 
     | 
    
         
            -
            - lib/ 
     | 
| 
       73 
     | 
    
         
            -
            - lib/ 
     | 
| 
       74 
     | 
    
         
            -
            - lib/ 
     | 
| 
      
 71 
     | 
    
         
            +
            - lib/ext/all.rb
         
     | 
| 
      
 72 
     | 
    
         
            +
            - lib/ext/hash/keys.rb
         
     | 
| 
      
 73 
     | 
    
         
            +
            - lib/ext/hash/slice.rb
         
     | 
| 
      
 74 
     | 
    
         
            +
            - lib/ext/string/as_ruby_property.rb
         
     | 
| 
       75 
75 
     | 
    
         
             
            - readme.md
         
     | 
| 
       76 
76 
     | 
    
         
             
            - spec/cmis-ruby/document_spec.rb
         
     | 
| 
       77 
77 
     | 
    
         
             
            - spec/cmis-ruby/folder_spec.rb
         
     | 
| 
         @@ -1,20 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            class Hash
         
     | 
| 
       2 
     | 
    
         
            -
              # Returns a hash with non +nil+ values.
         
     | 
| 
       3 
     | 
    
         
            -
              #
         
     | 
| 
       4 
     | 
    
         
            -
              #   hash = { a: true, b: false, c: nil}
         
     | 
| 
       5 
     | 
    
         
            -
              #   hash.compact # => { a: true, b: false}
         
     | 
| 
       6 
     | 
    
         
            -
              #   hash # => { a: true, b: false, c: nil}
         
     | 
| 
       7 
     | 
    
         
            -
              #   { c: nil }.compact # => {}
         
     | 
| 
       8 
     | 
    
         
            -
              def compact
         
     | 
| 
       9 
     | 
    
         
            -
                self.select { |_, value| !value.nil? }
         
     | 
| 
       10 
     | 
    
         
            -
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              # Replaces current hash with non +nil+ values.
         
     | 
| 
       13 
     | 
    
         
            -
              #
         
     | 
| 
       14 
     | 
    
         
            -
              #   hash = { a: true, b: false, c: nil}
         
     | 
| 
       15 
     | 
    
         
            -
              #   hash.compact! # => { a: true, b: false}
         
     | 
| 
       16 
     | 
    
         
            -
              #   hash # => { a: true, b: false}
         
     | 
| 
       17 
     | 
    
         
            -
              def compact!
         
     | 
| 
       18 
     | 
    
         
            -
                self.reject! { |_, value| value.nil? }
         
     | 
| 
       19 
     | 
    
         
            -
              end
         
     | 
| 
       20 
     | 
    
         
            -
            end
         
     |