coda_docs 0.2.0.pre.beta → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bbbc145e6673be029873082a6d0aadb21bc9b89cd204264ba5d33c28b0f7ff7a
4
- data.tar.gz: 1ba6290ad037435db6df6446bc57cbaf206342f3788774508b5bbb4d425ae853
3
+ metadata.gz: f25ef6a3dec7c0311fb93b8cb649a738eaa8fdefdffae63b8a136eb38e39cb1c
4
+ data.tar.gz: 7105c6735b893187c86f1b27e4e08a6e774bc71ac3d6418658197035154aeda5
5
5
  SHA512:
6
- metadata.gz: 7b7d7e4d3aa0898ca7c61a10892234c427ba5bfa67a9c3aaf80d4b69d0804760710eaaf1ee1997a0a1b0c795fa96438de369a074d5e0b19a095e4f7a429a9278
7
- data.tar.gz: d1ed52129cb3c197aa838f759bd7da0d586c8473d538d43f28cabe7ec06e4b2dfab342ac2daaf3c4939efc0890c84f13747358487039d803c5564e2138e2b8cf
6
+ metadata.gz: e1415c38663db9aa59ae81832c5d9e068e92bbeee2bf08b99b1611f2c61de06e7394f47f9f6bdfe28d591cad48c16beec0b7ee64cde3a42e49f1f277de8e51ab
7
+ data.tar.gz: d976ac1a630f436d52900380b11f631fcf92c2832910db39dd7ababb755e581c0908627021305eeaacd847e22c8768545d3beb0b89d96913602ce4f82bb804a0
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  *.rbc
3
3
  .ruby-version
4
4
  .byebug_history
5
+ .rspec_status
5
6
  /.config
6
7
  /coverage/
7
8
  /InstalledFiles
@@ -1,6 +1,6 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
3
- Excludes:
2
+ TargetRubyVersion: 2.4
3
+ Exclude:
4
4
  - app/admin/*.rb
5
5
  - db/migrate/*.rb
6
6
 
data/Gemfile CHANGED
@@ -1,10 +1,16 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in coda_docs.gemspec
6
6
  gemspec
7
7
 
8
8
  group :test do
9
9
  gem 'rspec'
10
+ gem 'vcr'
11
+ gem 'webmock'
12
+ end
13
+
14
+ group :tools do
15
+ gem 'rubocop'
10
16
  end
@@ -1,41 +1,55 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coda_docs (0.2.0.pre.beta)
4
+ coda_docs (1.0.0)
5
5
  activesupport
6
6
  httparty
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- activesupport (5.2.4)
11
+ activesupport (6.0.3.2)
12
12
  concurrent-ruby (~> 1.0, >= 1.0.2)
13
13
  i18n (>= 0.7, < 2)
14
14
  minitest (~> 5.1)
15
15
  tzinfo (~> 1.1)
16
+ zeitwerk (~> 2.2, >= 2.2.2)
17
+ addressable (2.7.0)
18
+ public_suffix (>= 2.0.2, < 5.0)
19
+ ast (2.4.1)
16
20
  byebug (10.0.2)
17
21
  coderay (1.1.2)
18
- concurrent-ruby (1.1.5)
22
+ concurrent-ruby (1.1.7)
23
+ crack (0.4.3)
24
+ safe_yaml (~> 1.0.0)
19
25
  diff-lcs (1.3)
20
26
  dotenv (2.5.0)
21
- httparty (0.17.1)
27
+ hashdiff (1.0.0)
28
+ httparty (0.18.1)
22
29
  mime-types (~> 3.0)
23
30
  multi_xml (>= 0.5.2)
24
- i18n (1.7.0)
31
+ i18n (1.8.5)
25
32
  concurrent-ruby (~> 1.0)
26
33
  method_source (0.9.2)
27
- mime-types (3.3)
34
+ mime-types (3.3.1)
28
35
  mime-types-data (~> 3.2015)
29
- mime-types-data (3.2019.1009)
30
- minitest (5.13.0)
36
+ mime-types-data (3.2020.0512)
37
+ minitest (5.14.1)
31
38
  multi_xml (0.6.0)
39
+ parallel (1.19.1)
40
+ parser (2.7.1.4)
41
+ ast (~> 2.4.1)
32
42
  pry (0.12.2)
33
43
  coderay (~> 1.1.0)
34
44
  method_source (~> 0.9.0)
35
45
  pry-byebug (3.6.0)
36
46
  byebug (~> 10.0)
37
47
  pry (~> 0.10)
38
- rake (10.5.0)
48
+ public_suffix (4.0.2)
49
+ rainbow (3.0.0)
50
+ rake (13.0.1)
51
+ regexp_parser (1.7.1)
52
+ rexml (3.2.4)
39
53
  rspec (3.8.0)
40
54
  rspec-core (~> 3.8.0)
41
55
  rspec-expectations (~> 3.8.0)
@@ -49,9 +63,29 @@ GEM
49
63
  diff-lcs (>= 1.2.0, < 2.0)
50
64
  rspec-support (~> 3.8.0)
51
65
  rspec-support (3.8.0)
66
+ rubocop (0.89.1)
67
+ parallel (~> 1.10)
68
+ parser (>= 2.7.1.1)
69
+ rainbow (>= 2.2.2, < 4.0)
70
+ regexp_parser (>= 1.7)
71
+ rexml
72
+ rubocop-ast (>= 0.3.0, < 1.0)
73
+ ruby-progressbar (~> 1.7)
74
+ unicode-display_width (>= 1.4.0, < 2.0)
75
+ rubocop-ast (0.3.0)
76
+ parser (>= 2.7.1.4)
77
+ ruby-progressbar (1.10.1)
78
+ safe_yaml (1.0.5)
52
79
  thread_safe (0.3.6)
53
- tzinfo (1.2.5)
80
+ tzinfo (1.2.7)
54
81
  thread_safe (~> 0.1)
82
+ unicode-display_width (1.7.0)
83
+ vcr (5.0.0)
84
+ webmock (3.7.6)
85
+ addressable (>= 2.3.6)
86
+ crack (>= 0.3.2)
87
+ hashdiff (>= 0.4.0, < 2.0.0)
88
+ zeitwerk (2.4.0)
55
89
 
56
90
  PLATFORMS
57
91
  ruby
@@ -62,8 +96,11 @@ DEPENDENCIES
62
96
  dotenv (~> 2.5)
63
97
  pry
64
98
  pry-byebug
65
- rake (~> 10.0)
99
+ rake (~> 13.0)
66
100
  rspec
101
+ rubocop
102
+ vcr
103
+ webmock
67
104
 
68
105
  BUNDLED WITH
69
- 2.0.2
106
+ 2.1.4
data/Rakefile CHANGED
@@ -8,5 +8,5 @@ task default: :spec
8
8
  # To open up gem in pry mode during development
9
9
  # Run rake console
10
10
  task :console do
11
- exec "pry -r coda_docs -I ./lib"
11
+ exec 'pry -r coda_docs -I ./lib'
12
12
  end
@@ -1,7 +1,7 @@
1
- #!/usr/bin/env ruby
1
+ # !/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "coda_docs"
3
+ require 'bundler/setup'
4
+ require 'coda_docs'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "coda_docs"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = 'Coda Docs Api Gem'
12
12
  spec.description = 'Coda Docs Api Gem'
13
13
  spec.homepage = 'https://github.com/joinmonday/coda_docs'
14
- spec.required_ruby_version = '>= 2.2'
14
+ spec.required_ruby_version = '>= 2.4'
15
15
 
16
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -34,12 +34,12 @@ Gem::Specification.new do |spec|
34
34
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
35
35
  spec.require_paths = ['lib']
36
36
 
37
- spec.add_development_dependency 'bundler'#, '~> 1.16'
37
+ spec.add_development_dependency 'bundler' # , '~> 1.16'
38
38
  spec.add_development_dependency 'dotenv', '~> 2.5'
39
39
  spec.add_development_dependency 'pry'
40
40
  spec.add_development_dependency 'pry-byebug'
41
- spec.add_development_dependency 'rake', '~> 10.0'
41
+ spec.add_development_dependency 'rake', '~> 13.0'
42
42
  spec.add_development_dependency 'rspec', '~> 3.0'
43
- spec.add_dependency 'httparty'
44
43
  spec.add_dependency 'activesupport'
44
+ spec.add_dependency 'httparty'
45
45
  end
@@ -1,7 +1,7 @@
1
1
  module CodaDocs
2
2
  class Connection
3
3
  include HTTParty
4
- base_uri 'https://coda.io/apis/v1beta1'
4
+ base_uri 'https://coda.io/apis/v1'
5
5
  format :json
6
6
  end
7
7
  end
@@ -0,0 +1,10 @@
1
+ module CodaDocs
2
+ module Entities
3
+ class Categories < Entity
4
+ def all
5
+ response = connection.get('/categories')
6
+ parse_response(response)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,8 +1,8 @@
1
1
  module CodaDocs
2
2
  module Entities
3
3
  class Docs < Entity
4
- def all
5
- response = connection.get('/docs')
4
+ def all(options = nil)
5
+ response = connection.get('/docs', query: options)
6
6
  parse_response(response)
7
7
  end
8
8
 
@@ -10,17 +10,38 @@ module CodaDocs
10
10
  connection.get("/docs/#{doc_id}")
11
11
  end
12
12
 
13
- def create(title: 'Untitled', timezone: 'America/Los_Angeles', source: nil, folder_id: nil)
13
+ def create(title: 'Untitled', timezone: 'America/Los_Angeles', source_doc: nil, folder_id: nil)
14
14
  connection.post(
15
15
  '/docs',
16
16
  body: {
17
17
  title: title,
18
- sourceDoc: source,
18
+ sourceDoc: source_doc,
19
19
  timezone: timezone,
20
20
  folderId: folder_id
21
21
  }.to_json
22
22
  )
23
23
  end
24
+
25
+ def delete(doc_id:)
26
+ connection.delete("/docs/#{doc_id}")
27
+ end
28
+
29
+ def publish(doc_id:, slug:, discoverable:, earn_credit:, category_names:, mode:)
30
+ connection.put(
31
+ "/docs/#{doc_id}/publish",
32
+ body: {
33
+ slug: slug,
34
+ discoverable: discoverable,
35
+ earnCredit: earn_credit,
36
+ categoryNames: category_names,
37
+ mode: mode
38
+ }.to_json
39
+ )
40
+ end
41
+
42
+ def unpublish(doc_id:)
43
+ connection.delete("/docs/#{doc_id}/publish")
44
+ end
24
45
  end
25
46
  end
26
47
  end
@@ -0,0 +1,26 @@
1
+ module CodaDocs
2
+ module Entities
3
+ class Pages < Entity
4
+ def all(doc_id, options = nil)
5
+ response = connection.get("/docs/#{doc_id}/pages", query: options)
6
+ parse_response(response)
7
+ end
8
+
9
+ def find(doc_id:, page_id:)
10
+ connection.get("/docs/#{doc_id}/pages/#{page_id}", query: options)
11
+ end
12
+
13
+ def update(doc_id:, page_id:, name:, subtitle:, icon_name:, image_url:)
14
+ connection.put(
15
+ "/docs/#{doc_id}/pages/#{page_id}",
16
+ body: {
17
+ name: name,
18
+ subtitle: subtitle,
19
+ iconName: icon_name,
20
+ imageUrl: image_url
21
+ }.to_json
22
+ )
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module CodaDocs
2
- VERSION = '0.2.0-beta'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coda_docs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.beta
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Muñoz
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2020-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '13.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
- version: '10.0'
82
+ version: '13.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: httparty
98
+ name: activesupport
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: activesupport
112
+ name: httparty
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -146,6 +146,7 @@ files:
146
146
  - lib/coda_docs/client.rb
147
147
  - lib/coda_docs/connection.rb
148
148
  - lib/coda_docs/entities/account.rb
149
+ - lib/coda_docs/entities/categories.rb
149
150
  - lib/coda_docs/entities/columns.rb
150
151
  - lib/coda_docs/entities/controls.rb
151
152
  - lib/coda_docs/entities/docs.rb
@@ -153,8 +154,8 @@ files:
153
154
  - lib/coda_docs/entities/folders.rb
154
155
  - lib/coda_docs/entities/formulas.rb
155
156
  - lib/coda_docs/entities/miscellaneous.rb
157
+ - lib/coda_docs/entities/pages.rb
156
158
  - lib/coda_docs/entities/rows.rb
157
- - lib/coda_docs/entities/sections.rb
158
159
  - lib/coda_docs/entities/tables.rb
159
160
  - lib/coda_docs/version.rb
160
161
  homepage: https://github.com/joinmonday/coda_docs
@@ -164,7 +165,7 @@ metadata:
164
165
  homepage_uri: https://github.com/joinmonday/coda_docs
165
166
  source_code_uri: https://github.com/joinmonday/coda_docs
166
167
  changelog_uri: https://github.com/joinmonday/coda_docs
167
- post_install_message:
168
+ post_install_message:
168
169
  rdoc_options: []
169
170
  require_paths:
170
171
  - lib
@@ -172,16 +173,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
173
  requirements:
173
174
  - - ">="
174
175
  - !ruby/object:Gem::Version
175
- version: '2.2'
176
+ version: '2.4'
176
177
  required_rubygems_version: !ruby/object:Gem::Requirement
177
178
  requirements:
178
- - - ">"
179
+ - - ">="
179
180
  - !ruby/object:Gem::Version
180
- version: 1.3.1
181
+ version: '0'
181
182
  requirements: []
182
- rubyforge_project:
183
- rubygems_version: 2.7.7
184
- signing_key:
183
+ rubygems_version: 3.0.8
184
+ signing_key:
185
185
  specification_version: 4
186
186
  summary: Coda Docs Api Gem
187
187
  test_files: []
@@ -1,14 +0,0 @@
1
- module CodaDocs
2
- module Entities
3
- class Sections < Entity
4
- def all(doc_id)
5
- response = connection.get("/docs/#{doc_id}/sections")
6
- parse_response(response)
7
- end
8
-
9
- def find(doc_id:, section_id:)
10
- connection.get("/docs/#{doc_id}/sections/#{section_id}")
11
- end
12
- end
13
- end
14
- end