kintone 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +26 -0
  3. data/.travis.yml +4 -0
  4. data/Guardfile +10 -0
  5. data/README.md +35 -13
  6. data/Rakefile +9 -1
  7. data/kintone.gemspec +17 -14
  8. data/lib/kintone.rb +2 -2
  9. data/lib/kintone/api.rb +36 -22
  10. data/lib/kintone/api/guest.rb +16 -8
  11. data/lib/kintone/command.rb +11 -2
  12. data/lib/kintone/command/app_acl.rb +4 -8
  13. data/lib/kintone/command/field_acl.rb +4 -8
  14. data/lib/kintone/command/form.rb +4 -8
  15. data/lib/kintone/command/record.rb +6 -10
  16. data/lib/kintone/command/record_acl.rb +4 -8
  17. data/lib/kintone/command/records.rb +11 -15
  18. data/lib/kintone/command/space.rb +15 -0
  19. data/lib/kintone/command/space_body.rb +11 -0
  20. data/lib/kintone/command/template_space.rb +12 -0
  21. data/lib/kintone/version.rb +1 -1
  22. data/spec/kintone/api/guest_spec.rb +134 -0
  23. data/spec/kintone/api_spec.rb +176 -0
  24. data/spec/kintone/command/app_acl_spec.rb +28 -0
  25. data/spec/kintone/command/field_acl_spec.rb +28 -0
  26. data/spec/kintone/command/form_spec.rb +26 -0
  27. data/spec/kintone/command/record_acl_spec.rb +28 -0
  28. data/spec/kintone/command/record_spec.rb +93 -0
  29. data/spec/kintone/command/records_spec.rb +169 -0
  30. data/spec/kintone/command/space_body_spec.rb +28 -0
  31. data/spec/kintone/command/space_spec.rb +53 -0
  32. data/spec/kintone/command/template_space_spec.rb +41 -0
  33. metadata +75 -36
  34. data/spec/api/guest_spec.rb +0 -54
  35. data/spec/api_spec.rb +0 -148
  36. data/spec/command/app_acl_spec.rb +0 -28
  37. data/spec/command/field_acl_spec.rb +0 -28
  38. data/spec/command/form_spec.rb +0 -25
  39. data/spec/command/record_acl_spec.rb +0 -28
  40. data/spec/command/record_spec.rb +0 -92
  41. data/spec/command/records_spec.rb +0 -162
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+ require 'kintone/command/template_space'
3
+ require 'kintone/api'
4
+
5
+ describe Kintone::Command::TemplateSpace do
6
+ let(:target) { Kintone::Command::TemplateSpace.new(api) }
7
+ let(:api) { Kintone::Api.new('example.cybozu.com', 'Administrator', 'cybozu') }
8
+
9
+ describe '#create' do
10
+ subject { target.create(id, name, members, is_guest: is_guest, fixed_member: fixed_member) }
11
+
12
+ context '' do
13
+ before(:each) do
14
+ stub_request(
15
+ :post,
16
+ 'https://example.cybozu.com/k/v1/template/space.json'
17
+ )
18
+ .with(body: request_data.to_json)
19
+ .to_return(body: "{\"id\":\"1\"}", status: 200)
20
+ end
21
+
22
+ let(:id) { 1 }
23
+ let(:name) { 'sample space' }
24
+ let(:members) { [] }
25
+ let(:is_guest) { false }
26
+ let(:fixed_member) { false }
27
+
28
+ def request_data
29
+ {
30
+ id: id,
31
+ name: name,
32
+ members: members,
33
+ isGuest: is_guest,
34
+ fixedMember: fixed_member
35
+ }
36
+ end
37
+
38
+ it { expect(subject).to eq 'id' => '1' }
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,97 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kintone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rikiya Kawakami
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2014-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.8.9
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_middleware
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.9.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard-rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  description: kintone API client for Ruby.
@@ -101,9 +129,12 @@ executables: []
101
129
  extensions: []
102
130
  extra_rdoc_files: []
103
131
  files:
104
- - .gitignore
105
- - .rspec
132
+ - ".gitignore"
133
+ - ".rspec"
134
+ - ".rubocop.yml"
135
+ - ".travis.yml"
106
136
  - Gemfile
137
+ - Guardfile
107
138
  - LICENSE.txt
108
139
  - README.md
109
140
  - Rakefile
@@ -118,15 +149,21 @@ files:
118
149
  - lib/kintone/command/record.rb
119
150
  - lib/kintone/command/record_acl.rb
120
151
  - lib/kintone/command/records.rb
152
+ - lib/kintone/command/space.rb
153
+ - lib/kintone/command/space_body.rb
154
+ - lib/kintone/command/template_space.rb
121
155
  - lib/kintone/version.rb
122
- - spec/api/guest_spec.rb
123
- - spec/api_spec.rb
124
- - spec/command/app_acl_spec.rb
125
- - spec/command/field_acl_spec.rb
126
- - spec/command/form_spec.rb
127
- - spec/command/record_acl_spec.rb
128
- - spec/command/record_spec.rb
129
- - spec/command/records_spec.rb
156
+ - spec/kintone/api/guest_spec.rb
157
+ - spec/kintone/api_spec.rb
158
+ - spec/kintone/command/app_acl_spec.rb
159
+ - spec/kintone/command/field_acl_spec.rb
160
+ - spec/kintone/command/form_spec.rb
161
+ - spec/kintone/command/record_acl_spec.rb
162
+ - spec/kintone/command/record_spec.rb
163
+ - spec/kintone/command/records_spec.rb
164
+ - spec/kintone/command/space_body_spec.rb
165
+ - spec/kintone/command/space_spec.rb
166
+ - spec/kintone/command/template_space_spec.rb
130
167
  - spec/spec_helper.rb
131
168
  homepage: https://github.com/jue58/kintone
132
169
  licenses:
@@ -138,28 +175,30 @@ require_paths:
138
175
  - lib
139
176
  required_ruby_version: !ruby/object:Gem::Requirement
140
177
  requirements:
141
- - - '>='
178
+ - - ">="
142
179
  - !ruby/object:Gem::Version
143
180
  version: '0'
144
181
  required_rubygems_version: !ruby/object:Gem::Requirement
145
182
  requirements:
146
- - - '>='
183
+ - - ">="
147
184
  - !ruby/object:Gem::Version
148
185
  version: '0'
149
186
  requirements: []
150
187
  rubyforge_project:
151
- rubygems_version: 2.0.3
188
+ rubygems_version: 2.2.2
152
189
  signing_key:
153
190
  specification_version: 4
154
191
  summary: kintone API client for Ruby.
155
192
  test_files:
156
- - spec/api/guest_spec.rb
157
- - spec/api_spec.rb
158
- - spec/command/app_acl_spec.rb
159
- - spec/command/field_acl_spec.rb
160
- - spec/command/form_spec.rb
161
- - spec/command/record_acl_spec.rb
162
- - spec/command/record_spec.rb
163
- - spec/command/records_spec.rb
193
+ - spec/kintone/api/guest_spec.rb
194
+ - spec/kintone/api_spec.rb
195
+ - spec/kintone/command/app_acl_spec.rb
196
+ - spec/kintone/command/field_acl_spec.rb
197
+ - spec/kintone/command/form_spec.rb
198
+ - spec/kintone/command/record_acl_spec.rb
199
+ - spec/kintone/command/record_spec.rb
200
+ - spec/kintone/command/records_spec.rb
201
+ - spec/kintone/command/space_body_spec.rb
202
+ - spec/kintone/command/space_spec.rb
203
+ - spec/kintone/command/template_space_spec.rb
164
204
  - spec/spec_helper.rb
165
- has_rdoc:
@@ -1,54 +0,0 @@
1
- require 'spec_helper'
2
- require 'kintone/api/guest'
3
- require 'kintone/api'
4
-
5
- describe Kintone::Api::Guest do
6
- let(:target) { Kintone::Api::Guest.new(space, api) }
7
- let(:space) { 1 }
8
- let(:api) { Kintone::Api.new("example.cybozu.com", "Administrator", "cybozu") }
9
-
10
- describe "#get_url" do
11
- subject { target.get_url(command) }
12
- context "" do
13
- let(:command) { "path" }
14
-
15
- it { expect(subject).to eq("/k/guest/1/v1/path.json") }
16
- end
17
- end
18
-
19
- describe "#record" do
20
- subject { target.record }
21
-
22
- it { expect(subject).to be_a_kind_of(Kintone::Command::Record) }
23
- end
24
-
25
- describe "#records" do
26
- subject { target.records }
27
-
28
- it { expect(subject).to be_a_kind_of(Kintone::Command::Records) }
29
- end
30
-
31
- describe "#form" do
32
- subject { target.form }
33
-
34
- it { expect(subject).to be_a_kind_of(Kintone::Command::Form) }
35
- end
36
-
37
- describe "#app_acl" do
38
- subject { target.app_acl }
39
-
40
- it { expect(subject).to be_a_kind_of(Kintone::Command::AppAcl) }
41
- end
42
-
43
- describe "#record_acl" do
44
- subject { target.record_acl }
45
-
46
- it { expect(subject).to be_a_kind_of(Kintone::Command::RecordAcl) }
47
- end
48
-
49
- describe "#field_acl" do
50
- subject { target.field_acl }
51
-
52
- it { expect(subject).to be_a_kind_of(Kintone::Command::FieldAcl) }
53
- end
54
- end
data/spec/api_spec.rb DELETED
@@ -1,148 +0,0 @@
1
- require 'spec_helper'
2
- require 'kintone/api'
3
- require 'kintone/api/guest'
4
- require 'kintone/command/record'
5
- require 'kintone/command/records'
6
-
7
- describe Kintone::Api do
8
- let(:target) { Kintone::Api.new(domain, user, password) }
9
- let(:domain) { "www.example.com" }
10
- let(:user) { "Administrator" }
11
- let(:password) { "cybozu" }
12
-
13
- describe "#get_url" do
14
- subject { target.get_url(command) }
15
-
16
- context "" do
17
- let(:command) { "path" }
18
- it { expect(subject).to eq("/k/v1/path.json") }
19
- end
20
- end
21
-
22
- describe "#guest" do
23
- subject { target.guest(space) }
24
-
25
- context "引数が数値の1の時" do
26
- let(:space) { 1 }
27
-
28
- it { expect(subject).to be_a_kind_of(Kintone::Api::Guest) }
29
- it { expect(subject.instance_variable_get(:@guest_path)).to eq("/k/guest/1/v1/") }
30
- end
31
-
32
- context "引数がnilの時" do
33
- let(:space) { nil }
34
- xit { expect(subject.instance_variable_get(:@guest_path)).to eq("/k/guest//v1/") }
35
- end
36
-
37
- context "引数に数字以外の文字が含まれる時" do
38
- let(:space) { "2.1" }
39
- xit { expect(subject.instance_variable_get(:@guest_path)).to eq("/k/guest//v1/") }
40
- end
41
- end
42
-
43
- describe "#get" do
44
- before(:each) do
45
- stub_request(
46
- :get,
47
- "https://www.example.com/k/v1/path?p1=abc&p2=def"
48
- ).
49
- with(:headers => {"X-Cybozu-Authorization" => "QWRtaW5pc3RyYXRvcjpjeWJvenU="}).
50
- to_return(:body => "{\"abc\":\"def\"}", :status => 200)
51
- end
52
-
53
- subject { target.get(path, params) }
54
- let(:path) { "/k/v1/path" }
55
- let(:params) { {"p1" => "abc", "p2" => "def"} }
56
-
57
- it { expect(subject).to eq({"abc" => "def"}) }
58
- end
59
-
60
- describe "#post" do
61
- before(:each) do
62
- stub_request(
63
- :post,
64
- "https://www.example.com/k/v1/path"
65
- ).
66
- with(:headers => {"X-Cybozu-Authorization" => "QWRtaW5pc3RyYXRvcjpjeWJvenU=", "Content-Type" => "application/json"},
67
- :body => "{\"p1\":\"abc\",\"p2\":\"def\"}").
68
- to_return(:body => "{\"abc\":\"def\"}", :status => 200)
69
- end
70
-
71
- subject { target.post(path, body) }
72
- let(:path) { "/k/v1/path" }
73
- let(:body) { {"p1" => "abc", "p2" => "def"} }
74
-
75
- it { expect(subject).to eq({"abc" => "def"}) }
76
- end
77
-
78
- describe "#put" do
79
- before(:each) do
80
- stub_request(
81
- :put,
82
- "https://www.example.com/k/v1/path"
83
- ).
84
- with(:headers => {"X-Cybozu-Authorization" => "QWRtaW5pc3RyYXRvcjpjeWJvenU=", "Content-Type" => "application/json"},
85
- :body => "{\"p1\":\"abc\",\"p2\":\"def\"}").
86
- to_return(:body => "{\"abc\":\"def\"}", :status => 200)
87
- end
88
-
89
- subject { target.put(path, body) }
90
- let(:path) { "/k/v1/path" }
91
- let(:body) { {"p1" => "abc", "p2" => "def"} }
92
-
93
- it { expect(subject).to eq({"abc" => "def"}) }
94
- end
95
-
96
- describe "#delete" do
97
- before(:each) do
98
- stub_request(
99
- :delete,
100
- "https://www.example.com/k/v1/path?p1=abc&p2=def"
101
- ).
102
- with(:headers => {"X-Cybozu-Authorization" => "QWRtaW5pc3RyYXRvcjpjeWJvenU="}).
103
- to_return(:body => "{\"abc\":\"def\"}", :status => 200)
104
- end
105
-
106
- subject { target.delete(path, params) }
107
- let(:path) { "/k/v1/path" }
108
- let(:params) { {"p1" => "abc", "p2" => "def"} }
109
-
110
- it { expect(subject).to eq({"abc" => "def"}) }
111
- end
112
-
113
- describe "#record" do
114
- subject { target.record }
115
-
116
- it { expect(subject).to be_a_kind_of(Kintone::Command::Record) }
117
- end
118
-
119
- describe "#records" do
120
- subject { target.records }
121
-
122
- it { expect(subject).to be_a_kind_of(Kintone::Command::Records) }
123
- end
124
-
125
- describe "#form" do
126
- subject { target.form }
127
-
128
- it { expect(subject).to be_a_kind_of(Kintone::Command::Form) }
129
- end
130
-
131
- describe "#app_acl" do
132
- subject { target.app_acl }
133
-
134
- it { expect(subject).to be_a_kind_of(Kintone::Command::AppAcl) }
135
- end
136
-
137
- describe "#record_acl" do
138
- subject { target.record_acl }
139
-
140
- it { expect(subject).to be_a_kind_of(Kintone::Command::RecordAcl) }
141
- end
142
-
143
- describe "#field_acl" do
144
- subject { target.field_acl }
145
-
146
- it { expect(subject).to be_a_kind_of(Kintone::Command::FieldAcl) }
147
- end
148
- end