Sha256: 8c2d8b255898ad1fc093d7f0d7004bf976dcca287098e3dbed3fe4791ca489c1

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

module Fir
  class Cli < Thor
    private
    def _fir_info(identifier, type = 'ios')
      _puts "> 正在获取 #{ identifier }@FIR.im 的应用信息..."
      _chk_login
      body = { :token => @token, :type => type }
      res = RestClient.get "http://fir.im/api/v2/app/info/#{ identifier }?#{ URI.encode_www_form body }"
      JSON.parse res.body, :symbolize_names => true
    end
    def _fir_put(id, body)
      _chk_login
      body[:token] = @token
      _puts '> 正在更新 fir 的应用信息...'
      RestClient.put "http://fir.im/api/v2/app/#{ id }?#{ URI.encode_www_form body }", body
      _puts '> 更新成功'
    end
    def _fir_vput(id, body)
      _chk_login
      body[:token] = @token
      _puts '> 正在更新 fir 的应用版本信息...'
      RestClient.put "http://fir.im/api/v2/appVersion/#{ id }/complete?#{ URI.encode_www_form body }", body
      _puts '> 更新成功'
    end
    def _user(token)
      RestClient.get "http://fir.im/api/v2/user/me?token=#{ token }" do |res|
        case res.code
        when 200
          JSON.parse res.body, :symbolize_names => true
        else
          nil
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fir-cli-0.1.3 lib/fir-cli.core.ext.rb
fir-cli-0.1.2 lib/fir-cli.core.ext.rb