popbill 1.8.0 → 1.9.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/lib/popbill/fax.rb +32 -1
- data/lib/popbill/kakaotalk.rb +40 -0
- data/lib/popbill/message.rb +22 -2
- data/lib/popbill/taxinvoice.rb +44 -8
- data/lib/popbill.rb +56 -28
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 22aaca1fbeef9ff839f2fee226c159df24fb0225
         | 
| 4 | 
            +
              data.tar.gz: c87d6c44bd560f4c70c74e6163c62cdbe4d8691b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: fba033edd5a0c00bafab71b4bb115b8922ad9d31254f9a073b5bec3bcc73577d83ef47dc441d2baee2a04dd9e3047f61ace73a0d5b4f46983fd87674f09a949a
         | 
| 7 | 
            +
              data.tar.gz: 11f78dca7e9845dc3769054965494b9585155edb7c134a22011a5fb0ee89fb1f62036b26a16cb46c10f658f964054c96b9b60d99f51b240888443424f54fe364
         | 
    
        data/lib/popbill/fax.rb
    CHANGED
    
    | @@ -35,6 +35,26 @@ class FaxService < BaseService | |
| 35 35 | 
             
                httpget("/FAX/?TG=#{togo}", corpNum, userID)['url']
         | 
| 36 36 | 
             
              end
         | 
| 37 37 |  | 
| 38 | 
            +
              # 팩스 전송내역 팝업 URL
         | 
| 39 | 
            +
              def getSentListURL(corpNum, userID)
         | 
| 40 | 
            +
                if corpNum.length != 10
         | 
| 41 | 
            +
                  raise PopbillException.new(-99999999, '사업자등록번호가 올바르지 않습니다.')
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                response = httpget("/FAX/?TG=BOX", corpNum, userID)
         | 
| 45 | 
            +
                response['url']
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              # 발신번호 관리 팝업 URL
         | 
| 49 | 
            +
              def getSenderNumberMgtURL(corpNum, userID)
         | 
| 50 | 
            +
                if corpNum.length != 10
         | 
| 51 | 
            +
                  raise PopbillException.new(-99999999, '사업자등록번호가 올바르지 않습니다.')
         | 
| 52 | 
            +
                end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
                response = httpget("/FAX/?TG=SENDER", corpNum, userID)
         | 
| 55 | 
            +
                response['url']
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
             | 
| 38 58 | 
             
              def getUnitCost(corpNum, userID = '')
         | 
| 39 59 | 
             
                if corpNum.length != 10
         | 
| 40 60 | 
             
                  raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
         | 
| @@ -43,7 +63,7 @@ class FaxService < BaseService | |
| 43 63 | 
             
              end
         | 
| 44 64 |  | 
| 45 65 | 
             
              def search(corpNum, sDate, eDate, state, reserveYN, senderOnly, page, perPage,
         | 
| 46 | 
            -
                         order, userID = '', queryString ='')
         | 
| 66 | 
            +
                         order, userID = '', queryString = '')
         | 
| 47 67 | 
             
                if corpNum.length != 10
         | 
| 48 68 | 
             
                  raise PopbillException.new(-99999999, '사업자등록번호가 올바르지 않습니다.')
         | 
| 49 69 | 
             
                end
         | 
| @@ -231,4 +251,15 @@ class FaxService < BaseService | |
| 231 251 | 
             
                httpget("/FAX/Cancel/#{requestNum}", corpNum, userID)
         | 
| 232 252 | 
             
              end
         | 
| 233 253 |  | 
| 254 | 
            +
              def getPreviewURL(corpNum, receiptNum, userID = '')
         | 
| 255 | 
            +
                if corpNum.length != 10
         | 
| 256 | 
            +
                  raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
         | 
| 257 | 
            +
                end
         | 
| 258 | 
            +
                if receiptNum.to_s == ''
         | 
| 259 | 
            +
                  raise PopbillException.new(-99999999, "접수번호(receiptNum)가 입력되지 않았습니다.")
         | 
| 260 | 
            +
                end
         | 
| 261 | 
            +
             | 
| 262 | 
            +
                httpget("/FAX/Preview/#{receiptNum}", corpNum, userID)['url']
         | 
| 263 | 
            +
              end
         | 
| 264 | 
            +
             | 
| 234 265 | 
             
            end # end of FaxService
         | 
    
        data/lib/popbill/kakaotalk.rb
    CHANGED
    
    | @@ -24,6 +24,46 @@ class KakaoService < BaseService | |
| 24 24 | 
             
                    httpget("/KakaoTalk/?TG=#{togo}", corpNum, userID)['url']
         | 
| 25 25 | 
             
              end
         | 
| 26 26 |  | 
| 27 | 
            +
              # 플러스친구 계정관리 팝업 URL
         | 
| 28 | 
            +
              def getPlusFriendMgtURL(corpNum, userID)
         | 
| 29 | 
            +
                if corpNum.length != 10
         | 
| 30 | 
            +
                  raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                response = httpget("/KakaoTalk/?TG=PLUSFRIEND", corpNum, userID)
         | 
| 34 | 
            +
                response['url']
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
              # 발신번호 관리 팝업 URL
         | 
| 38 | 
            +
              def getSenderNumberMgtURL(corpNum, userID)
         | 
| 39 | 
            +
                if corpNum.length != 10
         | 
| 40 | 
            +
                  raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                response = httpget("/Message/?TG=SENDER", corpNum, userID)
         | 
| 44 | 
            +
                response['url']
         | 
| 45 | 
            +
              end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
              # 알림톡 템플릿관리 팝업 URL
         | 
| 48 | 
            +
              def getATSTemplateMgtURL(corpNum, userID)
         | 
| 49 | 
            +
                if corpNum.length != 10
         | 
| 50 | 
            +
                  raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                response = httpget("/KakaoTalk/?TG=TEMPLATE", corpNum, userID)
         | 
| 54 | 
            +
                response['url']
         | 
| 55 | 
            +
              end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
              # 카카오톡 전송내역 팝업 URL
         | 
| 58 | 
            +
              def getSentListURL(corpNum, userID)
         | 
| 59 | 
            +
                if corpNum.length != 10
         | 
| 60 | 
            +
                  raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.")
         | 
| 61 | 
            +
                end
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                response = httpget("/KakaoTalk/?TG=BOX", corpNum, userID)
         | 
| 64 | 
            +
                response['url']
         | 
| 65 | 
            +
              end
         | 
| 66 | 
            +
             | 
| 27 67 | 
             
              def listPlusFriendID(corpNum, userID = '')
         | 
| 28 68 | 
             
                raise PopbillException.new(-99999999, "사업자등록번호가 올바르지 않습니다.") if corpNum.length != 10
         | 
| 29 69 |  | 
    
        data/lib/popbill/message.rb
    CHANGED
    
    | @@ -276,8 +276,29 @@ class MessageService < BaseService | |
| 276 276 | 
             
                httpget("/Message/?TG=#{togo}", corpNum, userID)['url']
         | 
| 277 277 | 
             
              end
         | 
| 278 278 |  | 
| 279 | 
            +
              # 문자 전송내역 팝업 URL
         | 
| 280 | 
            +
              def getSentListURL(corpNum, userID)
         | 
| 281 | 
            +
                if corpNum.length != 10
         | 
| 282 | 
            +
                  raise PopbillException.new(-99999999, '사업자등록번호가 올바르지 않습니다.')
         | 
| 283 | 
            +
                end
         | 
| 284 | 
            +
             | 
| 285 | 
            +
                response = httpget("/Message/?TG=BOX", corpNum, userID)
         | 
| 286 | 
            +
                response['url']
         | 
| 287 | 
            +
              end
         | 
| 288 | 
            +
             | 
| 289 | 
            +
              # 발신번호 관리 팝업 URL
         | 
| 290 | 
            +
              def getSenderNumberMgtURL(corpNum, userID)
         | 
| 291 | 
            +
                if corpNum.length != 10
         | 
| 292 | 
            +
                  raise PopbillException.new(-99999999, '사업자등록번호가 올바르지 않습니다.')
         | 
| 293 | 
            +
                end
         | 
| 294 | 
            +
             | 
| 295 | 
            +
                response = httpget("/Message/?TG=SENDER", corpNum, userID)
         | 
| 296 | 
            +
                response['url']
         | 
| 297 | 
            +
              end
         | 
| 298 | 
            +
             | 
| 299 | 
            +
             | 
| 279 300 | 
             
              def search(corpNum, sDate, eDate, state, item, reserveYN, senderYN, page, perPage,
         | 
| 280 | 
            -
                         order, userID = '', queryString ='')
         | 
| 301 | 
            +
                         order, userID = '', queryString = '')
         | 
| 281 302 | 
             
                if corpNum.length != 10
         | 
| 282 303 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 283 304 | 
             
                end
         | 
| @@ -315,7 +336,6 @@ class MessageService < BaseService | |
| 315 336 | 
             
                postData = reciptNumList.to_json
         | 
| 316 337 |  | 
| 317 338 | 
             
                httppost("/Message/States", corpNum, postData, "", userID)
         | 
| 318 | 
            -
             | 
| 319 339 | 
             
              end
         | 
| 320 340 |  | 
| 321 341 | 
             
            end # end of MessageService
         | 
    
        data/lib/popbill/taxinvoice.rb
    CHANGED
    
    | @@ -10,6 +10,7 @@ class TaxinvoiceService < BaseService | |
| 10 10 | 
             
                  @instance.addScope("110")
         | 
| 11 11 | 
             
                  return @instance
         | 
| 12 12 | 
             
                end
         | 
| 13 | 
            +
             | 
| 13 14 | 
             
                private :new
         | 
| 14 15 | 
             
              end
         | 
| 15 16 |  | 
| @@ -144,7 +145,7 @@ class TaxinvoiceService < BaseService | |
| 144 145 |  | 
| 145 146 | 
             
                postData = mgtKeyList.to_json
         | 
| 146 147 |  | 
| 147 | 
            -
                httppost("/Taxinvoice/#{mgtKeyType}", corpNum, postData, "", | 
| 148 | 
            +
                httppost("/Taxinvoice/#{mgtKeyType}", corpNum, postData, "", userID)
         | 
| 148 149 | 
             
              end
         | 
| 149 150 |  | 
| 150 151 |  | 
| @@ -172,7 +173,7 @@ class TaxinvoiceService < BaseService | |
| 172 173 | 
             
              end
         | 
| 173 174 |  | 
| 174 175 |  | 
| 175 | 
            -
              def send(corpNum, mgtKeyType, mgtKey, memo = '', emailSubject = '', userID ='')
         | 
| 176 | 
            +
              def send(corpNum, mgtKeyType, mgtKey, memo = '', emailSubject = '', userID = '')
         | 
| 176 177 | 
             
                if corpNum.length != 10
         | 
| 177 178 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 178 179 | 
             
                end
         | 
| @@ -214,7 +215,7 @@ class TaxinvoiceService < BaseService | |
| 214 215 | 
             
                httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "CANCELSEND", userID)
         | 
| 215 216 | 
             
              end
         | 
| 216 217 |  | 
| 217 | 
            -
              def accept(corpNum, mgtKeyType, mgtKey, memo = '', userID ='')
         | 
| 218 | 
            +
              def accept(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
         | 
| 218 219 | 
             
                if corpNum.length != 10
         | 
| 219 220 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 220 221 | 
             
                end
         | 
| @@ -252,7 +253,7 @@ class TaxinvoiceService < BaseService | |
| 252 253 | 
             
                httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "DENY", userID)
         | 
| 253 254 | 
             
              end
         | 
| 254 255 |  | 
| 255 | 
            -
              def issue(corpNum, mgtKeyType, mgtKey, forceIssue = false, memo = '', emailSubject ='', userID)
         | 
| 256 | 
            +
              def issue(corpNum, mgtKeyType, mgtKey, forceIssue = false, memo = '', emailSubject = '', userID)
         | 
| 256 257 | 
             
                if corpNum.length != 10
         | 
| 257 258 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 258 259 | 
             
                end
         | 
| @@ -299,6 +300,20 @@ class TaxinvoiceService < BaseService | |
| 299 300 | 
             
                httppost("/Taxinvoice/#{mgtKeyType}/#{mgtKey}", corpNum, postData, "CANCELISSUE", userID)
         | 
| 300 301 | 
             
              end
         | 
| 301 302 |  | 
| 303 | 
            +
              def registRequest(corpNum, taxinvoice, memo = '', userID = '')
         | 
| 304 | 
            +
                if corpNum.length != 10
         | 
| 305 | 
            +
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 306 | 
            +
                end
         | 
| 307 | 
            +
             | 
| 308 | 
            +
                if memo.to_s != ''
         | 
| 309 | 
            +
                  taxinvoice["memo"] = memo
         | 
| 310 | 
            +
                end
         | 
| 311 | 
            +
             | 
| 312 | 
            +
                postData = taxinvoice.to_json
         | 
| 313 | 
            +
             | 
| 314 | 
            +
                httppost("/Taxinvoice", corpNum, postData, "REQUEST", userID)
         | 
| 315 | 
            +
              end
         | 
| 316 | 
            +
             | 
| 302 317 | 
             
              def request(corpNum, mgtKeyType, mgtKey, memo = '', userID = '')
         | 
| 303 318 | 
             
                if corpNum.length != 10
         | 
| 304 319 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| @@ -457,7 +472,7 @@ class TaxinvoiceService < BaseService | |
| 457 472 | 
             
              end
         | 
| 458 473 |  | 
| 459 474 |  | 
| 460 | 
            -
              def attachFile(corpNum, mgtKeyType, mgtKey, filePath, userID ='')
         | 
| 475 | 
            +
              def attachFile(corpNum, mgtKeyType, mgtKey, filePath, userID = '')
         | 
| 461 476 | 
             
                if corpNum.length != 10
         | 
| 462 477 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 463 478 | 
             
                end
         | 
| @@ -553,7 +568,7 @@ class TaxinvoiceService < BaseService | |
| 553 568 |  | 
| 554 569 |  | 
| 555 570 | 
             
              def search(corpNum, mgtKeyType, dType, sDate, eDate, state, type, taxType, lateOnly,
         | 
| 556 | 
            -
             | 
| 571 | 
            +
                         taxRegIDYN, taxRegIDType, taxRegID, page, perPage, order, queryString, userID = '', interOPYN = '', issueType = [])
         | 
| 557 572 | 
             
                if corpNum.length != 10
         | 
| 558 573 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 559 574 | 
             
                end
         | 
| @@ -653,12 +668,12 @@ class TaxinvoiceService < BaseService | |
| 653 668 | 
             
                  raise PopbillException.new('-99999999', '해당문서의 아이템키가 입력되지 않았습니다.')
         | 
| 654 669 | 
             
                end
         | 
| 655 670 |  | 
| 656 | 
            -
                String postDate = "MgtKey="+mgtKey
         | 
| 671 | 
            +
                String postDate = "MgtKey=" + mgtKey
         | 
| 657 672 |  | 
| 658 673 | 
             
                httppost("/Taxinvoice/#{itemKey}/#{mgtKeyType}", corpNum, postDate, "", userID, "application/x-www-form-urlencoded; charset=utf-8")
         | 
| 659 674 | 
             
              end
         | 
| 660 675 |  | 
| 661 | 
            -
              def listEmailConfig(corpNum, userID ='')
         | 
| 676 | 
            +
              def listEmailConfig(corpNum, userID = '')
         | 
| 662 677 | 
             
                if corpNum.length != 10
         | 
| 663 678 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 664 679 | 
             
                end
         | 
| @@ -690,6 +705,27 @@ class TaxinvoiceService < BaseService | |
| 690 705 | 
             
                httpget("/Taxinvoice/CertCheck", corpNum, userID)
         | 
| 691 706 | 
             
              end
         | 
| 692 707 |  | 
| 708 | 
            +
              # 팝빌 인감 및 첨부문서 등록 URL
         | 
| 709 | 
            +
              def getSealURL(corpNum, userID)
         | 
| 710 | 
            +
                if corpNum.length != 10
         | 
| 711 | 
            +
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 712 | 
            +
                end
         | 
| 713 | 
            +
             | 
| 714 | 
            +
                response = httpget("/?TG=SEAL", corpNum, userID)
         | 
| 715 | 
            +
                response['url']
         | 
| 716 | 
            +
              end
         | 
| 717 | 
            +
             | 
| 718 | 
            +
              # 공인인증서 등록 URL
         | 
| 719 | 
            +
              def getTaxCertURL(corpNum, userID)
         | 
| 720 | 
            +
                if corpNum.length != 10
         | 
| 721 | 
            +
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 722 | 
            +
                end
         | 
| 723 | 
            +
             | 
| 724 | 
            +
                response = httpget("/?TG=CERT", corpNum, userID)
         | 
| 725 | 
            +
                response['url']
         | 
| 726 | 
            +
              end
         | 
| 727 | 
            +
             | 
| 728 | 
            +
             | 
| 693 729 | 
             
            end # end of TaxinvoiceService
         | 
| 694 730 |  | 
| 695 731 | 
             
            module MgtKeyType
         | 
    
        data/lib/popbill.rb
    CHANGED
    
    | @@ -7,7 +7,7 @@ require 'linkhub' | |
| 7 7 |  | 
| 8 8 | 
             
            # Popbill API BaseService class
         | 
| 9 9 | 
             
            class BaseService
         | 
| 10 | 
            -
              ServiceID_REAL = "POPBILL" | 
| 10 | 
            +
              ServiceID_REAL = "POPBILL"
         | 
| 11 11 | 
             
              ServiceID_TEST = "POPBILL_TEST"
         | 
| 12 12 | 
             
              ServiceURL_REAL = "https://popbill.linkhub.co.kr"
         | 
| 13 13 | 
             
              ServiceURL_TEST = "https://popbill-test.linkhub.co.kr"
         | 
| @@ -25,6 +25,7 @@ class BaseService | |
| 25 25 | 
             
                  @instance.scopes = ["member"]
         | 
| 26 26 | 
             
                  return @instance
         | 
| 27 27 | 
             
                end
         | 
| 28 | 
            +
             | 
| 28 29 | 
             
                private :new
         | 
| 29 30 | 
             
              end
         | 
| 30 31 |  | 
| @@ -69,7 +70,7 @@ class BaseService | |
| 69 70 | 
             
                  begin
         | 
| 70 71 | 
             
                    # getSessionToken from Linkhub
         | 
| 71 72 | 
             
                    targetToken = @linkhub.getSessionToken(
         | 
| 72 | 
            -
             | 
| 73 | 
            +
                        @isTest ? ServiceID_TEST : ServiceID_REAL, corpNum, @scopes)
         | 
| 73 74 | 
             
                  rescue LinkhubException => le
         | 
| 74 75 | 
             
                    raise PopbillException.new(le.code, le.message)
         | 
| 75 76 | 
             
                  end
         | 
| @@ -78,7 +79,9 @@ class BaseService | |
| 78 79 | 
             
                end
         | 
| 79 80 |  | 
| 80 81 | 
             
                targetToken['session_token']
         | 
| 81 | 
            -
              end | 
| 82 | 
            +
              end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
              # end of getSession_Token
         | 
| 82 85 |  | 
| 83 86 | 
             
              def gzip_parse (target)
         | 
| 84 87 | 
             
                sio = StringIO.new(target)
         | 
| @@ -89,8 +92,8 @@ class BaseService | |
| 89 92 | 
             
              # Popbill API http Get Request Func
         | 
| 90 93 | 
             
              def httpget(url, corpNum, userID = '')
         | 
| 91 94 | 
             
                headers = {
         | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 95 | 
            +
                    "x-pb-version" => BaseService::POPBILL_APIVersion,
         | 
| 96 | 
            +
                    "Accept-Encoding" => "gzip,deflate",
         | 
| 94 97 | 
             
                }
         | 
| 95 98 |  | 
| 96 99 | 
             
                if corpNum.to_s != ''
         | 
| @@ -117,16 +120,18 @@ class BaseService | |
| 117 120 | 
             
                  end
         | 
| 118 121 | 
             
                else
         | 
| 119 122 | 
             
                  raise PopbillException.new(JSON.parse(res.body)["code"],
         | 
| 120 | 
            -
             | 
| 123 | 
            +
                                             JSON.parse(res.body)["message"])
         | 
| 121 124 | 
             
                end
         | 
| 122 | 
            -
              end | 
| 125 | 
            +
              end
         | 
| 126 | 
            +
             | 
| 127 | 
            +
              #end of httpget
         | 
| 123 128 |  | 
| 124 129 | 
             
              # Request HTTP Post
         | 
| 125 130 | 
             
              def httppost(url, corpNum, postData, action = '', userID = '', contentsType = '')
         | 
| 126 131 |  | 
| 127 132 | 
             
                headers = {
         | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 133 | 
            +
                    "x-pb-version" => BaseService::POPBILL_APIVersion,
         | 
| 134 | 
            +
                    "Accept-Encoding" => "gzip,deflate",
         | 
| 130 135 | 
             
                }
         | 
| 131 136 |  | 
| 132 137 | 
             
                if contentsType == ''
         | 
| @@ -147,7 +152,7 @@ class BaseService | |
| 147 152 | 
             
                  headers["X-HTTP-Method-Override"] = action
         | 
| 148 153 | 
             
                end
         | 
| 149 154 |  | 
| 150 | 
            -
                uri = URI(getServiceURL() + url | 
| 155 | 
            +
                uri = URI(getServiceURL() + url)
         | 
| 151 156 |  | 
| 152 157 | 
             
                https = Net::HTTP.new(uri.host, 443)
         | 
| 153 158 | 
             
                https.use_ssl = true
         | 
| @@ -163,18 +168,20 @@ class BaseService | |
| 163 168 | 
             
                  end
         | 
| 164 169 | 
             
                else
         | 
| 165 170 | 
             
                  raise PopbillException.new(JSON.parse(res.body)["code"],
         | 
| 166 | 
            -
             | 
| 171 | 
            +
                                             JSON.parse(res.body)["message"])
         | 
| 167 172 | 
             
                end
         | 
| 168 | 
            -
              end | 
| 173 | 
            +
              end
         | 
| 174 | 
            +
             | 
| 175 | 
            +
              #end of httppost
         | 
| 169 176 |  | 
| 170 177 |  | 
| 171 178 | 
             
              # Request HTTP Post File
         | 
| 172 179 | 
             
              def httppostfile(url, corpNum, form, files, userID)
         | 
| 173 180 | 
             
                headers = {
         | 
| 174 | 
            -
             | 
| 175 | 
            -
             | 
| 176 | 
            -
             | 
| 177 | 
            -
             | 
| 181 | 
            +
                    "x-pb-version" => BaseService::POPBILL_APIVersion,
         | 
| 182 | 
            +
                    "Content-Type" => "multipart/form-data;boundary=" + BaseService::BOUNDARY,
         | 
| 183 | 
            +
                    "Accept-Encoding" => "gzip,deflate",
         | 
| 184 | 
            +
                    "Connection" => "Keep-Alive"
         | 
| 178 185 | 
             
                }
         | 
| 179 186 |  | 
| 180 187 | 
             
                if corpNum.to_s != ''
         | 
| @@ -191,7 +198,7 @@ class BaseService | |
| 191 198 | 
             
                  post_body << "--#{BaseService::BOUNDARY}\r\n"
         | 
| 192 199 | 
             
                  post_body << "Content-Disposition: form-data; name=\"form\"\r\n"
         | 
| 193 200 | 
             
                  post_body << "Content-Type: Application/json;\r\n\r\n"
         | 
| 194 | 
            -
                  post_body << form.to_json+"\r\n"
         | 
| 201 | 
            +
                  post_body << form.to_json + "\r\n"
         | 
| 195 202 | 
             
                end
         | 
| 196 203 |  | 
| 197 204 | 
             
                files.each do |filePath|
         | 
| @@ -202,7 +209,7 @@ class BaseService | |
| 202 209 | 
             
                    post_body << "Content-Type: Application/octet-stream\r\n\r\n"
         | 
| 203 210 | 
             
                    post_body << File.read(filePath)
         | 
| 204 211 | 
             
                  rescue
         | 
| 205 | 
            -
                    raise PopbillException.new(-99999999,"Failed to reading filedata from filepath")
         | 
| 212 | 
            +
                    raise PopbillException.new(-99999999, "Failed to reading filedata from filepath")
         | 
| 206 213 | 
             
                  end
         | 
| 207 214 | 
             
                end
         | 
| 208 215 |  | 
| @@ -224,17 +231,17 @@ class BaseService | |
| 224 231 | 
             
                  end
         | 
| 225 232 | 
             
                else
         | 
| 226 233 | 
             
                  raise PopbillException.new(JSON.parse(res.body)["code"],
         | 
| 227 | 
            -
             | 
| 234 | 
            +
                                             JSON.parse(res.body)["message"])
         | 
| 228 235 | 
             
                end
         | 
| 229 236 |  | 
| 230 237 | 
             
              end
         | 
| 231 238 |  | 
| 232 239 | 
             
              def httppostfiles(url, corpNum, form, files, userID)
         | 
| 233 240 | 
             
                headers = {
         | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 237 | 
            -
             | 
| 241 | 
            +
                    "x-pb-version" => BaseService::POPBILL_APIVersion,
         | 
| 242 | 
            +
                    "Content-Type" => "multipart/form-data;boundary=" + BaseService::BOUNDARY,
         | 
| 243 | 
            +
                    "Accept-Encoding" => "gzip,deflate",
         | 
| 244 | 
            +
                    "Connection" => "Keep-Alive"
         | 
| 238 245 | 
             
                }
         | 
| 239 246 |  | 
| 240 247 | 
             
                if corpNum.to_s != ''
         | 
| @@ -262,7 +269,7 @@ class BaseService | |
| 262 269 | 
             
                    post_body << "Content-Type: Application/octet-stream\r\n\r\n"
         | 
| 263 270 | 
             
                    post_body << File.read(filePath)
         | 
| 264 271 | 
             
                  rescue
         | 
| 265 | 
            -
                    raise PopbillException.new(-99999999,"Failed to reading filedata from filepath")
         | 
| 272 | 
            +
                    raise PopbillException.new(-99999999, "Failed to reading filedata from filepath")
         | 
| 266 273 | 
             
                  end
         | 
| 267 274 | 
             
                end
         | 
| 268 275 |  | 
| @@ -284,7 +291,7 @@ class BaseService | |
| 284 291 | 
             
                  end
         | 
| 285 292 | 
             
                else
         | 
| 286 293 | 
             
                  raise PopbillException.new(JSON.parse(res.body)["code"],
         | 
| 287 | 
            -
             | 
| 294 | 
            +
                                             JSON.parse(res.body)["message"])
         | 
| 288 295 | 
             
                end
         | 
| 289 296 |  | 
| 290 297 | 
             
              end
         | 
| @@ -335,7 +342,7 @@ class BaseService | |
| 335 342 |  | 
| 336 343 | 
             
              # check Popbill Member ID
         | 
| 337 344 | 
             
              def checkID(idValue)
         | 
| 338 | 
            -
                http_response = httpget("/IDCheck?ID="+idValue,"","")
         | 
| 345 | 
            +
                http_response = httpget("/IDCheck?ID=" + idValue, "", "")
         | 
| 339 346 | 
             
              end
         | 
| 340 347 |  | 
| 341 348 | 
             
              # Get Pobill SSO URL
         | 
| @@ -344,7 +351,27 @@ class BaseService | |
| 344 351 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 345 352 | 
             
                end
         | 
| 346 353 |  | 
| 347 | 
            -
                response = httpget("/?TG="+togo, corpNum, userID)
         | 
| 354 | 
            +
                response = httpget("/?TG=" + togo, corpNum, userID)
         | 
| 355 | 
            +
                response['url']
         | 
| 356 | 
            +
              end
         | 
| 357 | 
            +
             | 
| 358 | 
            +
              # 팝빌 로그인 URL
         | 
| 359 | 
            +
              def getAccessURL(corpNum, userID)
         | 
| 360 | 
            +
                if corpNum.length != 10
         | 
| 361 | 
            +
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 362 | 
            +
                end
         | 
| 363 | 
            +
             | 
| 364 | 
            +
                response = httpget("/?TG=LOGIN", corpNum, userID)
         | 
| 365 | 
            +
                response['url']
         | 
| 366 | 
            +
              end
         | 
| 367 | 
            +
             | 
| 368 | 
            +
              # 팝빌 연동회원 포인트 충전 URL
         | 
| 369 | 
            +
              def getChargeURL(corpNum, userID)
         | 
| 370 | 
            +
                if corpNum.length != 10
         | 
| 371 | 
            +
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 372 | 
            +
                end
         | 
| 373 | 
            +
             | 
| 374 | 
            +
                response = httpget("/?TG=CHRG", corpNum, userID)
         | 
| 348 375 | 
             
                response['url']
         | 
| 349 376 | 
             
              end
         | 
| 350 377 |  | 
| @@ -353,7 +380,7 @@ class BaseService | |
| 353 380 | 
             
                if corpNum.length != 10
         | 
| 354 381 | 
             
                  raise PopbillException.new('-99999999', '사업자등록번호가 올바르지 않습니다.')
         | 
| 355 382 | 
             
                end
         | 
| 356 | 
            -
                http_response = httpget("/Join?CorpNum="+corpNum+"&LID="+linkID, "", "")
         | 
| 383 | 
            +
                http_response = httpget("/Join?CorpNum=" + corpNum + "&LID=" + linkID, "", "")
         | 
| 357 384 | 
             
              end
         | 
| 358 385 |  | 
| 359 386 | 
             
              # Get list Corp Contact
         | 
| @@ -401,6 +428,7 @@ end # end of BaseService class | |
| 401 428 | 
             
            # Popbill API Exception Handler class
         | 
| 402 429 | 
             
            class PopbillException < StandardError
         | 
| 403 430 | 
             
              attr_reader :code, :message
         | 
| 431 | 
            +
             | 
| 404 432 | 
             
              def initialize(code, message)
         | 
| 405 433 | 
             
                @code = code
         | 
| 406 434 | 
             
                @message = message
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: popbill
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Linkhub Dev
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018- | 
| 11 | 
            +
            date: 2018-11-15 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: linkhub
         |