ZReviewTender 1.0.6 → 1.1.0
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/bin/ZReviewTender +33 -11
- data/lib/Models/Review.rb +10 -10
- data/lib/Processors/SlackProcessor.rb +1 -0
- metadata +4 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1e9e037f81e2be753fca051c97fa20514158cfed242e861c245b7ad587f88a18
         | 
| 4 | 
            +
              data.tar.gz: 8cc90c6342e98a67e72108d016019bb3235e6e56abc00471fcf3a112ada459a5
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: eced3db85ab6268c9c34fac6b58be74617f9c164a4e83a7c77ce20092ba01d08f37d4b402e3f873a15747bdae15dafe971ad42692058d1ead2376c0e48eda020
         | 
| 7 | 
            +
              data.tar.gz: c4366c5c78a5d116bcc18ae15eb0b65637c7a1d464e7cd854e00b2a6ffcecc5394c3acd594abc4b9e93eb7e59a7196b08eb9062236d0f68a0f6bcc55c7875439
         | 
    
        data/bin/ZReviewTender
    CHANGED
    
    | @@ -8,6 +8,7 @@ require "Models/AppleConfig" | |
| 8 8 | 
             
            require "Models/AndroidConfig"
         | 
| 9 9 | 
             
            require "Models/Processor"
         | 
| 10 10 | 
             
            require "Helper"
         | 
| 11 | 
            +
            require "ZLogger"
         | 
| 11 12 | 
             
            require "AppleFetcher"
         | 
| 12 13 | 
             
            require "AndroidFetcher"
         | 
| 13 14 | 
             
            require "optparse"
         | 
| @@ -22,10 +23,13 @@ class Main | |
| 22 23 | 
             
                        opts.banner = "Usage: ZReviewTender [options]"
         | 
| 23 24 |  | 
| 24 25 | 
             
                        basePath = ENV['PWD'] || ::Dir.pwd
         | 
| 26 | 
            +
                        defaultConfigDirName = "config"
         | 
| 27 | 
            +
                        defaultAppleConfigFileName = "apple.yml"
         | 
| 28 | 
            +
                        defaultAndroidConfigFileName = "android.yml"
         | 
| 25 29 |  | 
| 26 30 | 
             
                        opts.on('-a', '--apple[=CONFIGYMLFILEPATH]', 'execute apple platform with config yml file') do |configYMLFilePath|
         | 
| 27 31 | 
             
                            if configYMLFilePath.nil?
         | 
| 28 | 
            -
                                configYMLFilePath = "#{basePath} | 
| 32 | 
            +
                                configYMLFilePath = "#{basePath}/#{defaultConfigDirName}/#{defaultAppleConfigFileName}"
         | 
| 29 33 | 
             
                            end
         | 
| 30 34 | 
             
                            configFileCheck(configYMLFilePath, "--apple=CONFIG_YML_FILE_PATH")
         | 
| 31 35 |  | 
| @@ -33,9 +37,9 @@ class Main | |
| 33 37 | 
             
                            fetcher.execute()
         | 
| 34 38 | 
             
                        end 
         | 
| 35 39 |  | 
| 36 | 
            -
                        opts.on('-g', '--googleAndroid[=CONFIGYMLFILEPATH]', 'execute  | 
| 40 | 
            +
                        opts.on('-g', '--googleAndroid[=CONFIGYMLFILEPATH]', 'execute android platform with config yml file') do |configYMLFilePath|
         | 
| 37 41 | 
             
                            if configYMLFilePath.nil?
         | 
| 38 | 
            -
                                configYMLFilePath = "#{basePath} | 
| 42 | 
            +
                                configYMLFilePath = "#{basePath}/#{defaultConfigDirName}/#{defaultAndroidConfigFileName}"
         | 
| 39 43 | 
             
                            end
         | 
| 40 44 | 
             
                            configFileCheck(configYMLFilePath, "--googleAndroid=CONFIG_YML_FILE_PATH")
         | 
| 41 45 |  | 
| @@ -43,8 +47,11 @@ class Main | |
| 43 47 | 
             
                            fetcher.execute()
         | 
| 44 48 | 
             
                        end 
         | 
| 45 49 |  | 
| 46 | 
            -
                        opts.on('-r', '--run', 'execute  | 
| 47 | 
            -
                             | 
| 50 | 
            +
                        opts.on('-r', '--run=[=CONFIGFOLDERNAME]', 'execute both android and apple, specify an /config folder name') do |configFolderName|
         | 
| 51 | 
            +
                            if configFolderName.nil?
         | 
| 52 | 
            +
                                configFolderName = defaultConfigDirName
         | 
| 53 | 
            +
                            end
         | 
| 54 | 
            +
                            androidConfigFilePath = "#{basePath}/#{configFolderName}/#{defaultAndroidConfigFileName}"
         | 
| 48 55 | 
             
                            configFileCheck(androidConfigFilePath, "--googleAndroid=CONFIG_YML_FILE_PATH")
         | 
| 49 56 |  | 
| 50 57 | 
             
                            fetcher = parseConfigYMLFile(androidConfigFilePath)
         | 
| @@ -52,7 +59,7 @@ class Main | |
| 52 59 |  | 
| 53 60 | 
             
                            #
         | 
| 54 61 |  | 
| 55 | 
            -
                            appleConfigFilePath = "#{basePath} | 
| 62 | 
            +
                            appleConfigFilePath = "#{basePath}/#{configFolderName}/#{defaultAppleConfigFileName}"
         | 
| 56 63 | 
             
                            configFileCheck(appleConfigFilePath, "--apple=CONFIG_YML_FILE_PATH")
         | 
| 57 64 |  | 
| 58 65 | 
             
                            fetcher = parseConfigYMLFile(appleConfigFilePath)
         | 
| @@ -86,13 +93,19 @@ class Main | |
| 86 93 | 
             
                        end
         | 
| 87 94 |  | 
| 88 95 | 
             
                        processors = Helper.unwrapRequiredParameter(configYMLObj, 'processors')
         | 
| 89 | 
            -
                        
         | 
| 96 | 
            +
                        if processors.nil?
         | 
| 97 | 
            +
                            processors = []
         | 
| 98 | 
            +
                        end
         | 
| 99 | 
            +
             | 
| 90 100 | 
             
                        if processors.length < 1
         | 
| 91 | 
            -
                            raise "must specify at least one processor."
         | 
| 101 | 
            +
                            raise "must specify/enable at least one processor."
         | 
| 92 102 | 
             
                        end
         | 
| 93 103 |  | 
| 94 104 | 
             
                        processors.each do |processor|
         | 
| 95 105 | 
             
                            processor.each do |key, value|
         | 
| 106 | 
            +
                                if value["enable"] != true
         | 
| 107 | 
            +
                                    next
         | 
| 108 | 
            +
                                end
         | 
| 96 109 | 
             
                                processorClass = Helper.unwrapRequiredParameter(value, "class")
         | 
| 97 110 | 
             
                                require "Processors/#{processorClass}"
         | 
| 98 111 | 
             
                                fetcher.registerProcessor(eval("#{processorClass}.new(#{value}, '#{configFilePath}', '#{ENV['PWD'] || ::Dir.pwd}')"))
         | 
| @@ -110,6 +123,15 @@ end | |
| 110 123 | 
             
            begin 
         | 
| 111 124 | 
             
                Main.new()
         | 
| 112 125 | 
             
            rescue => e
         | 
| 113 | 
            -
                 | 
| 114 | 
            -
                 | 
| 115 | 
            -
             | 
| 126 | 
            +
                logger = ZLogger.new(ENV['PWD'] || ::Dir.pwd)
         | 
| 127 | 
            +
                title = "#Error: #{e.class} #{e.message}"
         | 
| 128 | 
            +
                body = e.backtrace
         | 
| 129 | 
            +
                
         | 
| 130 | 
            +
                logger.logError("===RUNTIME EXCEPTION START===")
         | 
| 131 | 
            +
                logger.logError(title)
         | 
| 132 | 
            +
                logger.logError(body)
         | 
| 133 | 
            +
                logger.logError("===RUNTIME EXCEPTION END===")
         | 
| 134 | 
            +
                    
         | 
| 135 | 
            +
                puts title
         | 
| 136 | 
            +
                puts body
         | 
| 137 | 
            +
            end
         | 
    
        data/lib/Models/Review.rb
    CHANGED
    
    | @@ -3,15 +3,15 @@ $lib = File.expand_path('../', File.dirname(__FILE__)) | |
| 3 3 | 
             
            class Review
         | 
| 4 4 | 
             
                attr_accessor :platform, :id, :userName, :rating, :title, :body, :createdDateTimestamp, :url, :appVersion, :territory
         | 
| 5 5 | 
             
                def initialize(platform, id, userName, rating, title, body, createdDateTimestamp, url, appVersion, territory)
         | 
| 6 | 
            -
                    @platform = platform
         | 
| 7 | 
            -
                    @id = id
         | 
| 8 | 
            -
                    @userName = userName
         | 
| 9 | 
            -
                    @rating = rating
         | 
| 10 | 
            -
                    @title = title
         | 
| 11 | 
            -
                    @body = body
         | 
| 12 | 
            -
                    @createdDateTimestamp = createdDateTimestamp
         | 
| 13 | 
            -
                    @url = url
         | 
| 14 | 
            -
                    @appVersion = appVersion
         | 
| 15 | 
            -
                    @territory = territory
         | 
| 6 | 
            +
                    @platform = platform # 來源平台 android or apple
         | 
| 7 | 
            +
                    @id = id # review id
         | 
| 8 | 
            +
                    @userName = userName # reviewer
         | 
| 9 | 
            +
                    @rating = rating # 給予的 rating, 1~5
         | 
| 10 | 
            +
                    @title = title # review 標題 (android 無此資料)
         | 
| 11 | 
            +
                    @body = body # review 內容
         | 
| 12 | 
            +
                    @createdDateTimestamp = createdDateTimestamp # review 建立時間
         | 
| 13 | 
            +
                    @url = url # 前往 review 的連結 (apple 不提供後台指定到某個 review 的連結)
         | 
| 14 | 
            +
                    @appVersion = appVersion # app 版本號
         | 
| 15 | 
            +
                    @territory = territory # apple: 地區(TWN/JPN...), android: 語系(zh-tw/en...)
         | 
| 16 16 | 
             
                end
         | 
| 17 17 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ZReviewTender
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0 | 
| 4 | 
            +
              version: 1.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - ZhgChgLi
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022-08- | 
| 11 | 
            +
            date: 2022-08-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: net-http
         | 
| @@ -109,6 +109,6 @@ requirements: [] | |
| 109 109 | 
             
            rubygems_version: 3.0.3
         | 
| 110 110 | 
             
            signing_key: 
         | 
| 111 111 | 
             
            specification_version: 4
         | 
| 112 | 
            -
            summary: ZReviewTender uses brand new App Store & Google Play API to  | 
| 113 | 
            -
               | 
| 112 | 
            +
            summary: ZReviewTender uses brand new App Store & Google Play API to fetch App reviews
         | 
| 113 | 
            +
              and integration your workflow.
         | 
| 114 114 | 
             
            test_files: []
         |