cyby 0.1.2 → 0.1.3
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/README.md +4 -0
- data/lib/cyby/kintone.rb +1 -0
- data/lib/cyby/kintone/invalid_record.rb +42 -0
- data/lib/cyby/kintone/rest_api.rb +4 -4
- data/lib/cyby/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 66d4f99e8afcfe24f66739ca5f5e29e5a759f5ae
         | 
| 4 | 
            +
              data.tar.gz: 1bf2541d7e1dc619b070b98ebc9ff6bacf071580
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9cbf745f3f2e33117fe783d4dcf92bb02e50e8378d5089fcd021dbaa699d333ed66025f8d8367fca6b939eb4c95e15cfa960736478cc3236075166f19a180d25
         | 
| 7 | 
            +
              data.tar.gz: d816ffdc5684c5397f82715f1ae77364a27fde5212fd4d1ceab2e08fbda6d663cadace7dc75c12346a58bd2282c74ae3cec37b6493feb6232e69239e8d732c2a
         | 
    
        data/README.md
    CHANGED
    
    
    
        data/lib/cyby/kintone.rb
    CHANGED
    
    
| @@ -0,0 +1,42 @@ | |
| 1 | 
            +
            module Cyby
         | 
| 2 | 
            +
              module Kintone
         | 
| 3 | 
            +
                class InvalidRecord < StandardError
         | 
| 4 | 
            +
                  attr_reader :response, :message, :id, :errors, :code, :response_code
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  def initialize(response)
         | 
| 7 | 
            +
                    @response = response
         | 
| 8 | 
            +
                    @message = @response["message"]
         | 
| 9 | 
            +
                    @id = @response["id"]
         | 
| 10 | 
            +
                    @code = @response["code"]
         | 
| 11 | 
            +
                    @response_code = @response.code
         | 
| 12 | 
            +
                    set_errors
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  def inspect
         | 
| 16 | 
            +
                    {
         | 
| 17 | 
            +
                      message: @message,
         | 
| 18 | 
            +
                      id: @id,
         | 
| 19 | 
            +
                      code: @code,
         | 
| 20 | 
            +
                      response_code: @response_code,
         | 
| 21 | 
            +
                      errors: @errors
         | 
| 22 | 
            +
                    }.inspect
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  def to_s
         | 
| 26 | 
            +
                    "InvalidRecord: #{inspect}"
         | 
| 27 | 
            +
                  end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                  private
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  def set_errors
         | 
| 32 | 
            +
                    @errors = {}
         | 
| 33 | 
            +
                    @response["errors"].each do |key, value|
         | 
| 34 | 
            +
                      match = key.match(/record\.([^.]+)\.value/)
         | 
| 35 | 
            +
                      if match
         | 
| 36 | 
            +
                        @errors[match[1]] = value["messages"]
         | 
| 37 | 
            +
                      end
         | 
| 38 | 
            +
                    end
         | 
| 39 | 
            +
                  end
         | 
| 40 | 
            +
                end
         | 
| 41 | 
            +
              end
         | 
| 42 | 
            +
            end
         | 
| @@ -25,7 +25,7 @@ module Cyby | |
| 25 25 | 
             
                    if resp.code == 200
         | 
| 26 26 | 
             
                      resp
         | 
| 27 27 | 
             
                    else
         | 
| 28 | 
            -
                       | 
| 28 | 
            +
                      raise Cyby::Kintone::InvalidRecord.new(resp)
         | 
| 29 29 | 
             
                    end
         | 
| 30 30 | 
             
                  end
         | 
| 31 31 |  | 
| @@ -36,7 +36,7 @@ module Cyby | |
| 36 36 | 
             
                    if resp.code == 200
         | 
| 37 37 | 
             
                      resp
         | 
| 38 38 | 
             
                    else
         | 
| 39 | 
            -
                       | 
| 39 | 
            +
                      raise Cyby::Kintone::InvalidRecord.new(resp)
         | 
| 40 40 | 
             
                    end
         | 
| 41 41 | 
             
                  end
         | 
| 42 42 |  | 
| @@ -47,7 +47,7 @@ module Cyby | |
| 47 47 | 
             
                    if resp.code == 200
         | 
| 48 48 | 
             
                      resp
         | 
| 49 49 | 
             
                    else
         | 
| 50 | 
            -
                       | 
| 50 | 
            +
                      raise Cyby::Kintone::InvalidRecord.new(resp)
         | 
| 51 51 | 
             
                    end
         | 
| 52 52 | 
             
                  end
         | 
| 53 53 |  | 
| @@ -58,7 +58,7 @@ module Cyby | |
| 58 58 | 
             
                    if resp.code == 200
         | 
| 59 59 | 
             
                      resp
         | 
| 60 60 | 
             
                    else
         | 
| 61 | 
            -
                       | 
| 61 | 
            +
                      raise Cyby::Kintone::InvalidRecord.new(resp)
         | 
| 62 62 | 
             
                    end
         | 
| 63 63 | 
             
                  end
         | 
| 64 64 | 
             
                end
         | 
    
        data/lib/cyby/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cyby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Hiroyuki Sato
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2015- | 
| 11 | 
            +
            date: 2015-05-29 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -83,6 +83,7 @@ files: | |
| 83 83 | 
             
            - lib/cyby.rb
         | 
| 84 84 | 
             
            - lib/cyby/kintone.rb
         | 
| 85 85 | 
             
            - lib/cyby/kintone/app.rb
         | 
| 86 | 
            +
            - lib/cyby/kintone/invalid_record.rb
         | 
| 86 87 | 
             
            - lib/cyby/kintone/query.rb
         | 
| 87 88 | 
             
            - lib/cyby/kintone/query/where.rb
         | 
| 88 89 | 
             
            - lib/cyby/kintone/query/where_and.rb
         |