dato 0.2.4 → 0.2.6

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
  SHA1:
3
- metadata.gz: b54b098b276ed1157ddb3a025a7ed159f4de08ce
4
- data.tar.gz: 51dabe629a57a274820cf257173b06cf0e3f48fe
3
+ metadata.gz: c1af418795209463483593dad3aca96164b865c6
4
+ data.tar.gz: 0da3150305fb346f91d406f41af07c713ceeaf4b
5
5
  SHA512:
6
- metadata.gz: c175e119234ebb14bdbd534b68a76300cffd7fa893255d95afe2f785020c925b8afce747c94141da9984fafddfbc0cd054fc221fc4f3568847709fc32c65b237
7
- data.tar.gz: 63acf4d92d062a34301091d45402a254b08eadd1eee5ed4b6b91aaa852ec72dcab93edabdd28f3528a67736a1e90219f8616e3aeb76ae15fb3691002724657da
6
+ metadata.gz: d0c411699fae909ad158658f20821ed6e780b38de79bdb8edf8011dff2c2954625dd5bc7c10ffd8b4af586a3d82eff4ad2a0f1b701961a6d423f5de98fc12e2f
7
+ data.tar.gz: f2ce4a3ccf2218aeecc9e9c309f271bea99384d08d1a2838cc2d4e5e080fefd8d4fdb151a3a119d9f4ab64153a6d3c40fb1534b9c2cf48a619700ee9b30bc989
data/.rubocop.yml CHANGED
@@ -1,6 +1,13 @@
1
+
1
2
  AllCops:
2
3
  TargetRubyVersion: 2.3
3
4
 
5
+ Exclude:
6
+ - "dato.gemspec"
7
+
8
+ Style/SafeNavigation:
9
+ Enabled: false
10
+
4
11
  Style/Documentation:
5
12
  Enabled: false
6
13
 
data/Rakefile CHANGED
@@ -14,13 +14,18 @@ task :regenerate do
14
14
  BuildClient.new(
15
15
  open('https://site-api.datocms.com/docs/site-api-hyperschema.json').read,
16
16
  'site',
17
- %w(session item)
17
+ %w(session item user#update user#destroy)
18
18
  ).build
19
19
 
20
20
  BuildClient.new(
21
21
  open('https://site-api.datocms.com/docs/account-api-hyperschema.json').read,
22
22
  'account',
23
- %w(session account#create account#reset_password)
23
+ %w(
24
+ session
25
+ account#create account#reset_password
26
+ subscription
27
+ portal_session
28
+ )
24
29
  ).build
25
30
  end
26
31
 
@@ -115,9 +115,6 @@ client.upload_image(path_or_url)
115
115
  client.upload_file(path_or_url)
116
116
 
117
117
  client.users.create(resource_attributes)
118
- client.users.update(user_id, resource_attributes)
119
118
  client.users.all
120
119
  client.users.find(user_id)
121
- client.users.reset_password(resource_attributes)
122
- client.users.destroy(user_id)
123
- ```
120
+ ```
@@ -8,6 +8,7 @@ require 'dato/version'
8
8
 
9
9
  require 'dato/account/repo/account'
10
10
  require 'dato/account/repo/site'
11
+ require 'dato/account/repo/deploy_event'
11
12
  require 'dato/api_error'
12
13
 
13
14
  require 'cacert'
@@ -17,7 +18,8 @@ module Dato
17
18
  class Client
18
19
  REPOS = {
19
20
  account: Repo::Account,
20
- sites: Repo::Site
21
+ sites: Repo::Site,
22
+ deploy_events: Repo::DeployEvent
21
23
  }.freeze
22
24
 
23
25
  attr_reader :token, :base_url, :schema, :extra_headers
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+ require 'dato/account/repo/base'
3
+
4
+ module Dato
5
+ module Account
6
+ module Repo
7
+ class DeployEvent < Base
8
+ def all
9
+ get_request '/deploy-events'
10
+ end
11
+
12
+ def find(deploy_event_id)
13
+ get_request "/deploy-events/#{deploy_event_id}"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -40,10 +40,10 @@ module Dato
40
40
  end
41
41
 
42
42
  def simple_slugify(item, title, suffix)
43
- if title
44
- slug = title.parameterize[0..50].gsub(/(^\-|\-$)/, '')
45
- skip_id_prefix ? "#{slug}#{suffix}" : "#{item['id']}-#{slug}#{suffix}"
46
- end
43
+ return nil unless title
44
+
45
+ slug = title.parameterize[0..50].gsub(/(^\-|\-$)/, '')
46
+ skip_id_prefix ? "#{slug}#{suffix}" : "#{item['id']}-#{slug}#{suffix}"
47
47
  end
48
48
 
49
49
  def slugify(item, title, suffix)
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+ require 'dato/site/repo/base'
3
+
4
+ module Dato
5
+ module Site
6
+ module Repo
7
+ class DeployEvent < Base
8
+ def all
9
+ get_request '/deploy-events'
10
+ end
11
+
12
+ def find(deploy_event_id)
13
+ get_request "/deploy-events/#{deploy_event_id}"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -21,8 +21,7 @@ module Dato
21
21
  type: :menu_item,
22
22
  attributes: %i(label position),
23
23
  relationships: { item_type: { collection: false, type: :item_type }, parent: { collection: false, type: :menu_item } },
24
- required_attributes: %i(label position),
25
- required_relationships: %i(item_type)
24
+ required_attributes: %i(label position)
26
25
  ).serialize(resource_attributes, menu_item_id)
27
26
 
28
27
  put_request "/menu-items/#{menu_item_id}", body
@@ -12,7 +12,7 @@ module Dato
12
12
  def update(resource_attributes)
13
13
  body = JsonApiSerializer.new(
14
14
  type: :site,
15
- attributes: %i(deploy_adapter deploy_settings favicon global_seo locales name no_index theme_hue timezone)
15
+ attributes: %i(deploy_adapter deploy_settings favicon global_seo locales name no_index ssg theme_hue timezone)
16
16
  ).serialize(resource_attributes)
17
17
 
18
18
  put_request '/site', body
@@ -8,22 +8,13 @@ module Dato
8
8
  def create(resource_attributes)
9
9
  body = JsonApiSerializer.new(
10
10
  type: :user,
11
- attributes: %i(email first_name is_admin last_name),
11
+ attributes: %i(email first_name last_name),
12
12
  required_attributes: %i(email first_name last_name)
13
13
  ).serialize(resource_attributes)
14
14
 
15
15
  post_request '/users', body
16
16
  end
17
17
 
18
- def update(user_id, resource_attributes)
19
- body = JsonApiSerializer.new(
20
- type: :user,
21
- attributes: %i(email first_name is_admin last_name password)
22
- ).serialize(resource_attributes, user_id)
23
-
24
- put_request "/users/#{user_id}", body
25
- end
26
-
27
18
  def all
28
19
  get_request '/users'
29
20
  end
@@ -41,10 +32,6 @@ module Dato
41
32
 
42
33
  post_request '/users/reset_password', body
43
34
  end
44
-
45
- def destroy(user_id)
46
- delete_request "/users/#{user_id}"
47
- end
48
35
  end
49
36
  end
50
37
  end
data/lib/dato/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Dato
3
- VERSION = '0.2.4'
3
+ VERSION = '0.2.6'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefano Verna
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-06 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -347,6 +347,7 @@ files:
347
347
  - lib/dato/account/client.rb
348
348
  - lib/dato/account/repo/account.rb
349
349
  - lib/dato/account/repo/base.rb
350
+ - lib/dato/account/repo/deploy_event.rb
350
351
  - lib/dato/account/repo/site.rb
351
352
  - lib/dato/api_error.rb
352
353
  - lib/dato/cli.rb
@@ -392,6 +393,7 @@ files:
392
393
  - lib/dato/migrate_slugs/runner.rb
393
394
  - lib/dato/site/client.rb
394
395
  - lib/dato/site/repo/base.rb
396
+ - lib/dato/site/repo/deploy_event.rb
395
397
  - lib/dato/site/repo/field.rb
396
398
  - lib/dato/site/repo/item.rb
397
399
  - lib/dato/site/repo/item_type.rb