backlog_v2_4r 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 23f52e1e9c5d728418c8721f021003e312f4da56
4
+ data.tar.gz: 337ef3aeb52429b2212b86f68024dc23762a9afa
5
+ SHA512:
6
+ metadata.gz: 988893baca47854f97c8e3e3686a2c8c9e369e4a0c46088b2ee240d6d206b236abf90665c7f53d8a9e58d0675ff7e6563322282214ea1c2790f5949dbabf97b8
7
+ data.tar.gz: fc75421b98321e01b19de72e1812545eaa504525adca516c9578afcfd3c40ccb54605e706746039dac0765db8cbf9c924ff2e72310fd8108656fa9383547d29d
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ #require: rubocop-rspec
2
+
3
+ # 最大行数は120まで拡張
4
+ Metrics/LineLength:
5
+ Max: 120
6
+
7
+ # コメント文にasciiコード以外(日本語も)OKとする
8
+ # disable to check whether only ascii symbols in comments.
9
+ AsciiComments:
10
+ Enabled: false
11
+
12
+ # 文字列の基本はダブルクウォートにする
13
+ Style/StringLiterals:
14
+ EnforcedStyle: double_quotes
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.0
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in backlog_v2_4r.gemspec
4
+ gemspec
5
+
6
+ group :test do
7
+ gem 'rspec'
8
+ gem "pry-byebug"
9
+ end
10
+
11
+ gem "httpclient"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Yusuke KON
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # BacklogV24r
2
+
3
+ [Backlog](http://www.backlog.jp/) is an issue tracking SaaS.
4
+ This gem accesses with api based on [Backlog API Document](http://developer.nulab-inc.com/ja/docs/backlog).
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'backlog_v2_4r'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install backlog_v2_4r
21
+
22
+ ## Usage
23
+
24
+ ```
25
+ You have got to have backlogs api key
26
+
27
+ backlog_api = BacklogApi.new(api_key: api_key_xxxxxxxxxxxx)
28
+
29
+ I recommend you use environment variables as follows
30
+
31
+ backlog_api = BacklogApi.new(api_key: ENV["API_KEY"])
32
+
33
+ # get projects
34
+ backlog_api.projects
35
+
36
+ # get spage
37
+ backlog_api.space
38
+
39
+ # search issues
40
+ backlog_api.issues({ "projectId[]" => project_id, "count" => 10 })
41
+
42
+ backlog_api.issues(params)
43
+
44
+ # note: params based on [Backlog API Document](http://developer.nulab-inc.com/ja/docs/backlog)
45
+
46
+ ```
47
+
48
+ ## Development
49
+
50
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
51
+
52
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it ( https://github.com/[my-github-username]/backlog_v2_4r/fork )
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'backlog_v2_4r/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "backlog_v2_4r"
8
+ spec.version = BacklogV24r::VERSION
9
+ spec.authors = ["Yusuke KON @kon_yu"]
10
+ spec.email = ["yusukedrive@gmail.com"]
11
+
12
+ spec.summary = %q{Get Backlog(powerd by nulab) data}
13
+ spec.description = %q{Backlog is an d issue traking service. Backlog has web Api. it can use api_key, This gem can get Backlog's data with that api.}
14
+ spec.homepage = "https://github.com/konyu/backlog_v2_4r.rb"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.8"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "backlog_v2_4r"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ require "backlog_v2_4r/version"
2
+ require "backlog_v2_4r/backlog_api"
3
+
4
+ module BacklogV24r
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,45 @@
1
+ require "httpclient"
2
+ require 'json'
3
+ # comment
4
+ class BacklogApi
5
+ attr_accessor :hc
6
+
7
+ BACKLOG_URL = "https://bsttchr.backlog.jp/api/v2/".freeze
8
+ @api_key = ""
9
+ def initialize(api_key: nil)
10
+ @api_key = api_key
11
+ @hc = ::HTTPClient.new
12
+ end
13
+
14
+ def space
15
+ data = @hc.get_content(build_html(method: "space"))
16
+ JSON.parse(data)
17
+ end
18
+
19
+
20
+ def projects
21
+ data = @hc.get_content(build_html(method: "projects"))
22
+ JSON.parse(data)
23
+ end
24
+
25
+ def issues(params)
26
+ data = @hc.get_content(build_html(method: "issues"), params)
27
+ JSON.parse(data)
28
+ end
29
+
30
+ def versions(project_id_or_key)
31
+ data = @hc.get_content(build_html_with_action(method: "projects", arg: project_id_or_key, action: "versions"))
32
+ JSON.parse(data)
33
+ end
34
+
35
+ private
36
+
37
+ def build_html(method: nil)
38
+ BACKLOG_URL + method + "?apiKey=" + @api_key
39
+ end
40
+
41
+ def build_html_with_action(method: nil, arg: nil, action: nil)
42
+ BACKLOG_URL + method + "/" + arg + "/" + action + "?apiKey=" + @api_key
43
+ end
44
+
45
+ end
@@ -0,0 +1,3 @@
1
+ module BacklogV24r
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: backlog_v2_4r
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Yusuke KON @kon_yu
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Backlog is an d issue traking service. Backlog has web Api. it can use
56
+ api_key, This gem can get Backlog's data with that api.
57
+ email:
58
+ - yusukedrive@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".rubocop.yml"
66
+ - ".ruby-version"
67
+ - ".travis.yml"
68
+ - CODE_OF_CONDUCT.md
69
+ - Gemfile
70
+ - LICENSE.txt
71
+ - README.md
72
+ - Rakefile
73
+ - backlog_v2_4r.gemspec
74
+ - bin/console
75
+ - bin/setup
76
+ - lib/backlog_v2_4r.rb
77
+ - lib/backlog_v2_4r/backlog_api.rb
78
+ - lib/backlog_v2_4r/version.rb
79
+ homepage: https://github.com/konyu/backlog_v2_4r.rb
80
+ licenses:
81
+ - MIT
82
+ metadata: {}
83
+ post_install_message:
84
+ rdoc_options: []
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project:
99
+ rubygems_version: 2.4.5
100
+ signing_key:
101
+ specification_version: 4
102
+ summary: Get Backlog(powerd by nulab) data
103
+ test_files: []