bc3client 0.1.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 +7 -0
- data/.gitignore +15 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/bc3client.gemspec +37 -0
- data/bin/bc3client +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/bc3client.rb +5 -0
- data/lib/bc3client/basecamp.rb +34 -0
- data/lib/bc3client/client.rb +30 -0
- data/lib/bc3client/models/basecamp.rb +1 -0
- data/lib/bc3client/resource.rb +35 -0
- data/lib/bc3client/todo.rb +35 -0
- data/lib/bc3client/todo_list.rb +36 -0
- data/lib/bc3client/todo_set.rb +27 -0
- data/lib/bc3client/version.rb +3 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7aa10d08141b205bb52b294d1da5f264a378b8fb
|
4
|
+
data.tar.gz: f56e813ca0c094e7b53072de9de8b81b371f8481
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea13536140725071ab9ccdf85409a10a470f8ab9c95a9054c6d510b34ace114776e2ebe43f7b2f22af90d3bf4e1a9b844a0311cd90f972b69dcfc037d55e1457
|
7
|
+
data.tar.gz: 3e6dbc79d8d84eb6bcfd690cb510006608381b9cf4f17a9f88e3427bd772e959a27fdd009f87161a29cbda838ef5b495291fda94ed4c6d92fd6e113f7ddfaa1a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Mitch Stewart
|
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,47 @@
|
|
1
|
+
# Bc3client
|
2
|
+
|
3
|
+
How to create a gem using bundler:
|
4
|
+
http://bundler.io/v1.12/guides/creating_gem.html
|
5
|
+
|
6
|
+
How run a single test:
|
7
|
+
bundle exec rspec ./spec/bc3client_spec.rb:12
|
8
|
+
|
9
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bc3client`. To experiment with that code, run `bin/console` for an interactive prompt.
|
10
|
+
|
11
|
+
TODO: Delete this and the text above, and describe your gem
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'bc3client'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install bc3client
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
TODO: Write usage instructions here
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
|
+
|
37
|
+
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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bc3client.
|
42
|
+
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
47
|
+
|
data/Rakefile
ADDED
data/bc3client.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bc3client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bc3client"
|
8
|
+
spec.version = Bc3client::VERSION
|
9
|
+
spec.authors = ["Mitch Stewart"]
|
10
|
+
spec.email = ["mitch.stewart.io@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{This gem is a client for Basecamp 3's API.}
|
13
|
+
spec.description = %q{This gem is a client for Basecamp 3's API.}
|
14
|
+
spec.homepage = "https://github.com/mitchstewart/bc3client"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
spec.add_development_dependency "json"
|
37
|
+
end
|
data/bin/bc3client
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "bc3client"
|
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(__FILE__)
|
data/bin/setup
ADDED
data/lib/bc3client.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'bc3client'
|
2
|
+
require "net/http"
|
3
|
+
require "uri"
|
4
|
+
require "bc3client/resource"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Bc3client
|
8
|
+
|
9
|
+
class Basecamp < Resource
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
args = args.flatten(1) unless !args[0].is_a?(Array)
|
13
|
+
super(args)
|
14
|
+
end
|
15
|
+
|
16
|
+
def all
|
17
|
+
get build_uri basecamps_path
|
18
|
+
end
|
19
|
+
|
20
|
+
def find_by_id(id)
|
21
|
+
get build_uri basecamp_path(id)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def basecamps_path
|
27
|
+
"/#{@account_id}/projects.json"
|
28
|
+
end
|
29
|
+
|
30
|
+
def basecamp_path(id)
|
31
|
+
"/#{@account_id}/projects/#{id}.json"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'bc3client'
|
2
|
+
require "net/http"
|
3
|
+
require "uri"
|
4
|
+
require "bc3client/resource"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Bc3client
|
8
|
+
|
9
|
+
class Client
|
10
|
+
|
11
|
+
attr_accessor :basecamp
|
12
|
+
|
13
|
+
def initialize(*args)
|
14
|
+
@args = args
|
15
|
+
@basecamp = Bc3client::Basecamp.new(@args)
|
16
|
+
end
|
17
|
+
|
18
|
+
def todo project_id
|
19
|
+
Bc3client::ToDo.new Array.new(@args).push(project_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
def todo_list project_id
|
23
|
+
Bc3client::ToDoList.new Array.new(@args).push(project_id)
|
24
|
+
end
|
25
|
+
|
26
|
+
def todo_set project_id
|
27
|
+
Bc3client::ToDoSet.new Array.new(@args).push(project_id)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# TODO
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'bc3client'
|
2
|
+
|
3
|
+
module Bc3client
|
4
|
+
|
5
|
+
class Resource
|
6
|
+
|
7
|
+
def initialize(*args)
|
8
|
+
args = args.flatten(1) unless !args[0].is_a?(Array)
|
9
|
+
@access_token = args[0]
|
10
|
+
@user_agent = args[1]
|
11
|
+
@account_id = args[2]
|
12
|
+
@base_uri = "https://3.basecampapi.com"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test
|
16
|
+
puts "account id = #{@account_id}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def build_uri(path)
|
20
|
+
URI.parse(@base_uri + path)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def get(uri)
|
26
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
27
|
+
http.use_ssl = true
|
28
|
+
request = Net::HTTP::Get.new(uri.request_uri)
|
29
|
+
request['Authorization'] = "Bearer #{@access_token}"
|
30
|
+
request['User-Agent'] = @user_agent
|
31
|
+
response = http.request(request)
|
32
|
+
JSON.parse(response.body)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'bc3client'
|
2
|
+
require "net/http"
|
3
|
+
require "uri"
|
4
|
+
require "bc3client/resource"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Bc3client
|
8
|
+
|
9
|
+
class ToDo < Resource
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
args = args.flatten(1) unless !args[0].is_a?(Array)
|
13
|
+
super(args)
|
14
|
+
@project_id = args[3]
|
15
|
+
end
|
16
|
+
|
17
|
+
def all(todo_list_id)
|
18
|
+
get build_uri(todos_path(@project_id, todo_list_id))
|
19
|
+
end
|
20
|
+
|
21
|
+
def find_by_id(todo_id)
|
22
|
+
get build_uri(todo_path(todo_id))
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def todos_path(todo_list_id)
|
28
|
+
"/#{@account_id}/buckets/#{@project_id}/todolists/#{todo_list_id}/todos.json"
|
29
|
+
end
|
30
|
+
|
31
|
+
def todo_path(todo_id)
|
32
|
+
"/#{@account_id}/buckets/#{@project_id}/todos/#{todo_id}.json"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'bc3client'
|
2
|
+
require "net/http"
|
3
|
+
require "uri"
|
4
|
+
require "bc3client/resource"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Bc3client
|
8
|
+
|
9
|
+
class ToDoList < Resource
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
args = args.flatten(1) unless !args[0].is_a?(Array)
|
13
|
+
super(args)
|
14
|
+
@project_id = args[3]
|
15
|
+
end
|
16
|
+
|
17
|
+
def all(todo_set_id)
|
18
|
+
puts build_uri(todo_set_path(todo_set_id))
|
19
|
+
get build_uri(todo_set_path(todo_set_id))
|
20
|
+
end
|
21
|
+
|
22
|
+
def find_by_id(todo_list_id)
|
23
|
+
get build_uri(todo_list_path(todo_list_id))
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def todo_set_path(todo_set_id)
|
29
|
+
"/#{@account_id}/buckets/#{@project_id}/todosets/#{todo_set_id}/todolists.json"
|
30
|
+
end
|
31
|
+
|
32
|
+
def todo_list_path(todo_list_id)
|
33
|
+
"/#{@account_id}/buckets/#{@project_id}/todolists/#{todo_list_id}.json"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'bc3client'
|
2
|
+
require "net/http"
|
3
|
+
require "uri"
|
4
|
+
require "bc3client/resource"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Bc3client
|
8
|
+
|
9
|
+
class ToDoSet < Resource
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
args = args.flatten(1) unless !args[0].is_a?(Array)
|
13
|
+
super(args)
|
14
|
+
@project_id = args[3]
|
15
|
+
end
|
16
|
+
|
17
|
+
def find_by_id(todo_set_id)
|
18
|
+
get build_uri(todo_set_path(todo_set_id))
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def todo_set_path(todo_set_id)
|
24
|
+
"/#{@account_id}/buckets/#{@project_id}/todosets/#{todo_set_id}.json"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bc3client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mitch Stewart
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-16 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.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
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: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: This gem is a client for Basecamp 3's API.
|
70
|
+
email:
|
71
|
+
- mitch.stewart.io@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bc3client.gemspec
|
84
|
+
- bin/bc3client
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/bc3client.rb
|
88
|
+
- lib/bc3client/basecamp.rb
|
89
|
+
- lib/bc3client/client.rb
|
90
|
+
- lib/bc3client/models/basecamp.rb
|
91
|
+
- lib/bc3client/resource.rb
|
92
|
+
- lib/bc3client/todo.rb
|
93
|
+
- lib/bc3client/todo_list.rb
|
94
|
+
- lib/bc3client/todo_set.rb
|
95
|
+
- lib/bc3client/version.rb
|
96
|
+
homepage: https://github.com/mitchstewart/bc3client
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata:
|
100
|
+
allowed_push_host: https://rubygems.org
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 2.6.12
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: This gem is a client for Basecamp 3's API.
|
121
|
+
test_files: []
|