teambition_api 0.0.1 → 0.0.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 +4 -4
- data/README.md +10 -25
- data/lib/teambition_api/helpers/collection.rb +15 -0
- data/lib/teambition_api/helpers/post.rb +33 -0
- data/lib/teambition_api/helpers/project.rb +28 -0
- data/lib/teambition_api/helpers/webhook.rb +17 -0
- data/lib/teambition_api/version.rb +1 -1
- data/teambition_api.gemspec +1 -1
- metadata +7 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: dcab6066b0dec9ec0993458b11d53845b80fba92
         | 
| 4 | 
            +
              data.tar.gz: 030a8f3569876b55643c6e9c3e247bd39a3f9951
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 800ef6f19ab459ea2568152864647e615de3bbf196c2a7f062b3a31a4dcfdc2b4f14a172d81c04992a538fe34919e15674268506127d683b7a67f788bed0ab32
         | 
| 7 | 
            +
              data.tar.gz: ef3aaaa4961489a94e9d5df636d33576b3923a81dd9a194970210c2f101159fb24c6cbe4fd593d7561e79fefe70a40822724448c971427591b8668052b77f365
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,31 +1,16 @@ | |
| 1 1 | 
             
            # TeambitionApi
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
            ## 安装
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 5 | 
            +
            Gemfile文件添加如下行:
         | 
| 6 6 |  | 
| 7 | 
            -
             | 
| 7 | 
            +
                gem 'teambition_api', '~> 0.0.1'
         | 
| 8 8 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
            gem 'teambition_api'
         | 
| 11 | 
            -
            ```
         | 
| 9 | 
            +
            添加`teambition_api.rb`,在`initializers`文件夹下
         | 
| 12 10 |  | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
                $ gem install teambition_api
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            ## Usage
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            TODO: Write usage instructions here
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            ## Contributing
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            1. Fork it ( https://github.com/[my-github-username]/teambition_api/fork )
         | 
| 28 | 
            -
            2. Create your feature branch (`git checkout -b my-new-feature`)
         | 
| 29 | 
            -
            3. Commit your changes (`git commit -am 'Add some feature'`)
         | 
| 30 | 
            -
            4. Push to the branch (`git push origin my-new-feature`)
         | 
| 31 | 
            -
            5. Create a new Pull Request
         | 
| 11 | 
            +
                TeambitionApi.setup do |config|
         | 
| 12 | 
            +
                    config.oauth_server  = "https://account.teambition.com"
         | 
| 13 | 
            +
                    config.server        = "https://api.teambition.com"
         | 
| 14 | 
            +
                    config.client_key    = "your_key"
         | 
| 15 | 
            +
                    config.client_secret = "your_secrect"
         | 
| 16 | 
            +
                end
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            module TeambitionApi
         | 
| 2 | 
            +
              module Helpers
         | 
| 3 | 
            +
                class Collection
         | 
| 4 | 
            +
                  extend TeambitionApi::Helpers::Base
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  ACTION_HASH = {
         | 
| 7 | 
            +
                    create: "/api/collections?access_token=%s"
         | 
| 8 | 
            +
                  }
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  def self.create(collection = {}, access_token)
         | 
| 11 | 
            +
                    post(ACTION_HASH[:create] % access_token, collection)
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
            end
         | 
| @@ -0,0 +1,33 @@ | |
| 1 | 
            +
            module TeambitionApi
         | 
| 2 | 
            +
              module Helpers
         | 
| 3 | 
            +
                class Post
         | 
| 4 | 
            +
                  extend TeambitionApi::Helpers::Base
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  ACTION_HASH = {
         | 
| 7 | 
            +
                    get_post: "/api/posts/%s",
         | 
| 8 | 
            +
                    get_project_post: "/api/projects/%s/posts",
         | 
| 9 | 
            +
                    create_post: "/api/posts?access_token=%s",
         | 
| 10 | 
            +
                    create_project_post: "/api/projects/%s/posts?access_token=%s"
         | 
| 11 | 
            +
                  }
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  def self.get_post(id, access_token)
         | 
| 14 | 
            +
                    params = { access_token: access_token }
         | 
| 15 | 
            +
                    get(ACTION_HASH[:get_post] % id, params)
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  def self.get_project_post(project_id, access_token)
         | 
| 19 | 
            +
                    params = { access_token: access_token }
         | 
| 20 | 
            +
                    get(ACTION_HASH[:get_project_post] % project_id, params)
         | 
| 21 | 
            +
                  end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  def self.create_post(post = {}, access_token)
         | 
| 24 | 
            +
                    post(ACTION_HASH[:create_post] % access_token, post)
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  def self.create_project_post(project_id, post = {}, access_token)
         | 
| 28 | 
            +
                    post(ACTION_HASH[:create_project_post] % [project_id, access_token], post)
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
            end
         | 
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            module TeambitionApi
         | 
| 2 | 
            +
              module Helpers
         | 
| 3 | 
            +
                class Project
         | 
| 4 | 
            +
                  extend TeambitionApi::Helpers::Base
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  ACTION_HASH = {
         | 
| 7 | 
            +
                    get_project: "/api/projects",
         | 
| 8 | 
            +
                    all_collections: "/api/projects/%s/collections",
         | 
| 9 | 
            +
                    copy: "/api/projects/%s/copy?access_token=%s"
         | 
| 10 | 
            +
                  }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  def self.get_all_projects(access_token)
         | 
| 13 | 
            +
                    params = { access_token: access_token }
         | 
| 14 | 
            +
                    get(ACTION_HASH[:get_project], params)
         | 
| 15 | 
            +
                  end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  def self.get_all_collections(project_id, access_token)
         | 
| 18 | 
            +
                    params = { access_token: access_token }
         | 
| 19 | 
            +
                    get(ACTION_HASH[:all_collections] % project_id, params)
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  def self.copy(project_id, option = {}, access_token)
         | 
| 23 | 
            +
                    post(ACTION_HASH[:copy] % [project_id, access_token], option)
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
            end
         | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            module TeambitionApi
         | 
| 2 | 
            +
              module Helpers
         | 
| 3 | 
            +
                class Webhook
         | 
| 4 | 
            +
                  extend TeambitionApi::Helpers::Base
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                  ACTION_HASH ={
         | 
| 7 | 
            +
                    create_org_hook: "/api/organizations/%s/hooks?access_token=%s"
         | 
| 8 | 
            +
                  }
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  def self.create_organization_hook(organizationId, callback_url, events, access_token)
         | 
| 11 | 
            +
                    params = { callbackURL: callback_url, active: true, events: ["project.create"]}
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                    post(ACTION_HASH[:create_org_hook] % [ organizationId, access_token ], params)
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
                end
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
    
        data/teambition_api.gemspec
    CHANGED
    
    | @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| | |
| 10 10 | 
             
              spec.email         = ["402399938@qq.com"]
         | 
| 11 11 | 
             
              spec.summary       = "TeambitionAPI"
         | 
| 12 12 | 
             
              spec.description   = "封装TeambitionAPI"
         | 
| 13 | 
            -
              spec.homepage      = ""
         | 
| 13 | 
            +
              spec.homepage      = "https://github.com/wangrui438/teambition_api"
         | 
| 14 14 | 
             
              spec.license       = "MIT"
         | 
| 15 15 |  | 
| 16 16 | 
             
              spec.files         = `git ls-files -z`.split("\x0")
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: teambition_api
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - '402399938'
         | 
| @@ -96,14 +96,18 @@ files: | |
| 96 96 | 
             
            - lib/teambition_api.rb
         | 
| 97 97 | 
             
            - lib/teambition_api/configuration.rb
         | 
| 98 98 | 
             
            - lib/teambition_api/helpers/base.rb
         | 
| 99 | 
            +
            - lib/teambition_api/helpers/collection.rb
         | 
| 99 100 | 
             
            - lib/teambition_api/helpers/oauth.rb
         | 
| 100 101 | 
             
            - lib/teambition_api/helpers/organization.rb
         | 
| 102 | 
            +
            - lib/teambition_api/helpers/post.rb
         | 
| 103 | 
            +
            - lib/teambition_api/helpers/project.rb
         | 
| 104 | 
            +
            - lib/teambition_api/helpers/webhook.rb
         | 
| 101 105 | 
             
            - lib/teambition_api/version.rb
         | 
| 102 106 | 
             
            - spec/helpers/oauth_spec.rb
         | 
| 103 107 | 
             
            - spec/helpers/organization_spec.rb
         | 
| 104 108 | 
             
            - spec/spec_helper.rb
         | 
| 105 109 | 
             
            - teambition_api.gemspec
         | 
| 106 | 
            -
            homepage:  | 
| 110 | 
            +
            homepage: https://github.com/wangrui438/teambition_api
         | 
| 107 111 | 
             
            licenses:
         | 
| 108 112 | 
             
            - MIT
         | 
| 109 113 | 
             
            metadata: {}
         | 
| @@ -123,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 123 127 | 
             
                  version: '0'
         | 
| 124 128 | 
             
            requirements: []
         | 
| 125 129 | 
             
            rubyforge_project: 
         | 
| 126 | 
            -
            rubygems_version: 2. | 
| 130 | 
            +
            rubygems_version: 2.4.8
         | 
| 127 131 | 
             
            signing_key: 
         | 
| 128 132 | 
             
            specification_version: 4
         | 
| 129 133 | 
             
            summary: TeambitionAPI
         |