media_controller 1.0.5 → 1.1.2
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 +5 -5
- data/lib/media_controller/media.rb +24 -5
- metadata +3 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: '082feb9fe0c587ca3eb0d68d8de19717ab99ee381e70c5d1243477a70afe9b6b'
         | 
| 4 | 
            +
              data.tar.gz: f3c1f3ed79166655c86d427f8222e559d40fa5220b35e8f7806f8aec510cc7ab
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d96cf8eabc77522311af11c749dc0c644160951ff193dc5a5e39a068378e5a44c71d8989adb7b17d12235b54d83f4e5c6df764aaacaf2e60e856f81f3855220b
         | 
| 7 | 
            +
              data.tar.gz: fb5a458eb8119a0e24141610ee1417034f6bb83b7cd002c55157d29e13ff5e6e9550a3dcaf4d97b99ab2fced1022812f0d84d70e36827a0f3b6203183715f8c6
         | 
| @@ -4,12 +4,31 @@ module MediaController | |
| 4 4 |  | 
| 5 5 | 
             
                attr :page, :id
         | 
| 6 6 |  | 
| 7 | 
            -
                def  | 
| 8 | 
            -
                   | 
| 9 | 
            -
             | 
| 7 | 
            +
                def Media.random_id
         | 
| 8 | 
            +
                  rand(10000..99999)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def initialize(capybara_page, options={})
         | 
| 12 | 
            +
                  raise "Please supply a valid ID" if options[:id] == ""
         | 
| 10 13 | 
             
                  @page = capybara_page
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                   | 
| 14 | 
            +
             | 
| 15 | 
            +
                  if options[:id]
         | 
| 16 | 
            +
                    @id = options[:id]
         | 
| 17 | 
            +
                    @ref = "window['media-#{@id}']"
         | 
| 18 | 
            +
                    @page.execute_script("#{@ref} = document.getElementById('#{@id}')")
         | 
| 19 | 
            +
                  elsif options[:reference]
         | 
| 20 | 
            +
                    @id = Media.random_id
         | 
| 21 | 
            +
                    @ref = "window['media-#{@id}']"
         | 
| 22 | 
            +
                    @page.execute_script("#{@ref} = document.evaluate('#{options[:reference].path}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue")
         | 
| 23 | 
            +
                  else
         | 
| 24 | 
            +
                    @id = Media.random_id
         | 
| 25 | 
            +
                    @ref = "window['media-#{@id}']"
         | 
| 26 | 
            +
                    @page.execute_script("#{@ref} = document.getElementsByTagName('#{self.class.name.split('::').last.downcase}')[0]")
         | 
| 27 | 
            +
                  end
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                def current_src
         | 
| 31 | 
            +
                  @page.evaluate_script "#{@ref}.currentSrc;"
         | 
| 13 32 | 
             
                end
         | 
| 14 33 |  | 
| 15 34 | 
             
                def play
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: media_controller
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.1.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Aimee Rivers
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-02-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: capybara
         | 
| @@ -67,8 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 67 67 | 
             
                - !ruby/object:Gem::Version
         | 
| 68 68 | 
             
                  version: '0'
         | 
| 69 69 | 
             
            requirements: []
         | 
| 70 | 
            -
             | 
| 71 | 
            -
            rubygems_version: 2.5.2.3
         | 
| 70 | 
            +
            rubygems_version: 3.0.1
         | 
| 72 71 | 
             
            signing_key: 
         | 
| 73 72 | 
             
            specification_version: 4
         | 
| 74 73 | 
             
            summary: Media Cotroller
         |