microcms-ruby-sdk 1.2.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ac22f7433f5c15562d37eb291ab04297082a36b02fe34b14206f578fdd8a6cb
4
- data.tar.gz: 5411bed835d189ca46f280fada06bb7b25a2eb937d0fda8d478be9b52fe43560
3
+ metadata.gz: 2f0a496c76ac71e67e1bd4f6f1994dd89ec164201389947e1d776405096612b3
4
+ data.tar.gz: cce04b74bb27adda2b0cb643f89db8f00ccd7dc7c4d3d6b80bbbd3870ca86c54
5
5
  SHA512:
6
- metadata.gz: 294a44d8524dadb0389169bbb0022055dbfd94c53da7f99c74c37c8f88baa64192bb56f08a8b8c0915cad6297ac56c470ed2ba4de609d87320b7146fc9b5da6e
7
- data.tar.gz: d0fb8d0095703342ddaa6145483691669c54f69f59a1a8446112bb353e0f28251bb6368f48b73e4d559a81d28e25f2cf702b51f5e93d6663963ea7fe65b8aaa5
6
+ metadata.gz: 86dd4071bf65b8870e3f45150d0ade1b2e5e9d032dac128c8fd922667b1cdcaeedb8fdf3e9093b615c908507704c1a1d844bb88011d84e887d0888baf5ebed9a
7
+ data.tar.gz: 3ed31472193dd1a833dc5b0b1c97691e9ded099d277a7fe244bfbe31653cdb0343baba30a0c9344836765416f7f619b4ab89dbc6cda444877b3eac6f58b2bd93
data/README.md CHANGED
@@ -1,49 +1,57 @@
1
1
  # microCMS Ruby SDK
2
2
 
3
- [microCMS](https://document.microcms.io/manual/api-request) Ruby SDK.
3
+ [microCMS](https://document.microcms.io/) Ruby SDKです。
4
4
 
5
- ## Tutorial
5
+ ## 保守方針
6
6
 
7
- See [official tutorial](https://document.microcms.io/tutorial/ruby/ruby-top).
7
+ このSDKの現在の保守レベルは `Maintenance` です。
8
8
 
9
- ## Installation
9
+ 詳細は[SDKの保守方針](https://document.microcms.io/manual/limitations#hc2b0bc6659)をご覧ください。
10
10
 
11
- Add this line to your application's Gemfile:
11
+ ## チュートリアル
12
+
13
+ [公式チュートリアル](https://document.microcms.io/tutorial/ruby/ruby-top)をご覧ください。
14
+
15
+ ## インストール
16
+
17
+ アプリケーションのGemfileに以下を追加します。
12
18
 
13
19
  ```ruby
14
20
  gem 'microcms-ruby-sdk'
15
21
  ```
16
22
 
17
- And then execute:
23
+ その後、以下を実行します。
18
24
 
19
25
  $ bundle install
20
26
 
21
- Or install it yourself as:
27
+ または、以下のコマンドで直接インストールできます。
22
28
 
23
29
  $ gem install microcms-ruby-sdk
24
30
 
25
- ## Usage
31
+ ## 使い方
26
32
 
27
- ### Import
33
+ ### インポート
28
34
 
29
35
  ```rb
30
36
  require 'microcms'
31
37
  ```
32
38
 
33
- ### Create client object
39
+ ### クライアントオブジェクトの作成
34
40
 
35
41
  ```rb
36
42
  MicroCMS.service_domain = 'YOUR_DOMAIN'
37
43
  MicroCMS.api_key = 'YOUR_API_KEY'
38
44
  ```
39
45
 
40
- ### Get content list
46
+ `YOUR_DOMAIN` にはサービスのサブドメイン名(`XXXX.microcms.io` `XXXX` の部分)を指定してください。FQDNではありません。
47
+
48
+ ### コンテンツ一覧の取得
41
49
 
42
50
  ```rb
43
51
  puts MicroCMS.list('endpoint')
44
52
  ```
45
53
 
46
- ### Get content list with parameters
54
+ ### パラメータを指定したコンテンツ一覧の取得
47
55
 
48
56
  ```rb
49
57
  puts MicroCMS.list(
@@ -53,7 +61,7 @@ puts MicroCMS.list(
53
61
  limit: 100,
54
62
  offset: 1,
55
63
  orders: ['updatedAt'],
56
- q: 'Hello',
64
+ q: 'こんにちは',
57
65
  fields: %w[id title],
58
66
  ids: ['foo'],
59
67
  filters: 'publishedAt[greater_than]2021-01-01',
@@ -62,13 +70,13 @@ puts MicroCMS.list(
62
70
  )
63
71
  ```
64
72
 
65
- ### Get single content
73
+ ### 単一コンテンツの取得
66
74
 
67
75
  ```rb
68
76
  puts MicroCMS.get('endpoint', 'ruby')
69
77
  ```
70
78
 
71
- ### Get single content with parameters
79
+ ### パラメータを指定した単一コンテンツの取得
72
80
 
73
81
  ```rb
74
82
  puts MicroCMS.get(
@@ -82,74 +90,73 @@ puts MicroCMS.get(
82
90
  )
83
91
  ```
84
92
 
85
- ### Get object form content
93
+ ### オブジェクト形式のコンテンツの取得
86
94
 
87
95
  ```rb
88
96
  puts MicroCMS.get('endpoint')
89
97
  ```
90
98
 
91
- ### Create content
99
+ ### コンテンツの作成
92
100
 
93
101
  ```rb
94
- puts MicroCMS.create('endpoint', { text: 'Hello, microcms-ruby-sdk!' })
102
+ puts MicroCMS.create('endpoint', { text: 'こんにちは、microcms-ruby-sdk' })
95
103
  ```
96
104
 
97
- ### Create content with specified ID
105
+ ### IDを指定したコンテンツの作成
98
106
 
99
107
  ```rb
100
108
  puts MicroCMS.create(
101
109
  'endpoint',
102
110
  {
103
111
  id: 'my-content-id',
104
- text: 'Hello, microcms-ruby-sdk!',
112
+ text: 'こんにちは、microcms-ruby-sdk',
105
113
  },
106
114
  )
107
115
  ```
108
116
 
109
- ### Create draft content
117
+ ### 下書きコンテンツの作成
110
118
 
111
119
  ```rb
112
120
  puts MicroCMS.create(
113
121
  'endpoint',
114
122
  {
115
123
  id: 'my-content-id',
116
- text: 'Hello, microcms-ruby-sdk!',
124
+ text: 'こんにちは、microcms-ruby-sdk',
117
125
  },
118
126
  { status: 'draft' },
119
127
  )
120
128
  ```
121
129
 
122
- ### Update content
130
+ ### コンテンツの更新
123
131
 
124
132
  ```rb
125
-
126
133
  puts MicroCMS.update(
127
134
  'endpoint',
128
135
  {
129
136
  id: 'microcms-ruby-sdk',
130
- text: 'Hello, microcms-ruby-sdk update method!',
137
+ text: 'こんにちは、microcms-ruby-sdkupdateメソッド!',
131
138
  },
132
139
  )
133
140
  ```
134
141
 
135
- ### Update object form content
142
+ ### オブジェクト形式のコンテンツの更新
136
143
 
137
144
  ```rb
138
- puts MicroCMS.update('endpoint', { text: 'Hello, microcms-ruby-sdk update method!' })
145
+ puts MicroCMS.update('endpoint', { text: 'こんにちは、microcms-ruby-sdkupdateメソッド!' })
139
146
  ```
140
147
 
141
- ### Delete content
148
+ ### コンテンツの削除
142
149
 
143
150
  ```rb
144
151
  MicroCMS.delete('endpoint', 'microcms-ruby-sdk')
145
152
  ```
146
153
 
147
- ## Development
154
+ ## 開発
148
155
 
149
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
156
+ リポジトリをチェックアウトした後、`bin/setup` を実行して依存関係をインストールしてください。`bin/console` を実行すると、対話形式で動作を確認できます。
150
157
 
151
- 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).
158
+ このgemをローカル環境にインストールするには、`bundle exec rake install` を実行してください。新しいバージョンをリリースするには、`version.rb` のバージョン番号を更新してから `bundle exec rake release` を実行します。このコマンドはバージョンのgitタグを作成し、gitのコミットとタグをpushした後、`.gem` ファイルを[rubygems.org](https://rubygems.org)にpushします。
152
159
 
153
- ## Contributing
160
+ ## コントリビュート
154
161
 
155
- Bug reports and pull requests are welcome on GitHub at <https://github.com/microcmsio/microcms-ruby-sdk>.
162
+ バグ報告やプルリクエストは、[GitHub](https://github.com/microcmsio/microcms-ruby-sdk)で受け付けています。
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MicroCMS
4
- VERSION = '1.2.0'
4
+ VERSION = '1.3.0'
5
5
  end
data/lib/microcms.rb CHANGED
@@ -5,6 +5,7 @@ require 'net/http'
5
5
  require 'uri'
6
6
  require 'json'
7
7
  require 'forwardable'
8
+ require 'ostruct'
8
9
 
9
10
  # MicroCMS
10
11
  module MicroCMS
@@ -161,7 +162,7 @@ module MicroCMS
161
162
  @status_code = status_code
162
163
  @body = parse_body(body)
163
164
 
164
- message = @body['message'] || 'Unknown error occured.'
165
+ message = @body['message'] || 'Unknown error occurred.'
165
166
  super(message)
166
167
  end
167
168
 
data/microcms.gemspec CHANGED
@@ -18,12 +18,13 @@ Gem::Specification.new do |spec|
18
18
 
19
19
  spec.metadata['rubygems_mfa_required'] = 'true'
20
20
 
21
- # Specify which files should be added to the gem when it is released.
22
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ # `ruby -e "puts Gem::Specification.load('microcms.gemspec').files.sort"` で確認可能
22
+ spec.files = Dir.chdir(__dir__) do
23
+ `git ls-files -z lib LICENSE README.md microcms.gemspec`.split("\x0").reject(&:empty?)
25
24
  end
26
25
  spec.bindir = 'exe'
27
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
27
  spec.require_paths = ['lib']
28
+
29
+ spec.add_dependency 'ostruct'
29
30
  end
metadata CHANGED
@@ -1,34 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: microcms-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - microCMS
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2022-06-02 00:00:00.000000000 Z
12
- dependencies: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ostruct
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
13
26
  description: microCMS Ruby SDK
14
- email:
15
27
  executables: []
16
28
  extensions: []
17
29
  extra_rdoc_files: []
18
30
  files:
19
- - ".github/workflows/ci.yml"
20
- - ".github/workflows/publish.yml"
21
- - ".gitignore"
22
- - ".rspec"
23
- - ".rubocop.yml"
24
- - ".ruby-version"
25
- - Gemfile
26
31
  - LICENSE
27
32
  - README.md
28
- - Rakefile
29
- - bin/console
30
- - bin/setup
31
- - examples/examples.rb
32
33
  - lib/microcms.rb
33
34
  - lib/microcms/version.rb
34
35
  - microcms.gemspec
@@ -39,7 +40,6 @@ metadata:
39
40
  source_code_uri: https://github.com/microcmsio/microcms-ruby-sdk
40
41
  changelog_uri: https://github.com/microcmsio/microcms-ruby-sdk
41
42
  rubygems_mfa_required: 'true'
42
- post_install_message:
43
43
  rdoc_options: []
44
44
  require_paths:
45
45
  - lib
@@ -54,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  requirements: []
57
- rubygems_version: 3.0.3.1
58
- signing_key:
57
+ rubygems_version: 4.0.10
59
58
  specification_version: 4
60
59
  summary: microCMS Ruby SDK
61
60
  test_files: []
@@ -1,42 +0,0 @@
1
- name: Test
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- pull_request:
7
- branches: [ main ]
8
- jobs:
9
- lint:
10
- runs-on: ubuntu-latest
11
- steps:
12
- - name: Checkout code
13
- uses: actions/checkout@v2
14
-
15
- - name: Setup Ruby and install gems
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: 2.7
19
- bundler-cache: true
20
-
21
- - name: Run linters
22
- run: |
23
- bundle install && bundle exec rubocop
24
-
25
- test:
26
- runs-on: ubuntu-latest
27
- strategy:
28
- matrix:
29
- ruby-version: [2.6, 2.7, 3.0]
30
- steps:
31
- - name: Checkout code
32
- uses: actions/checkout@v2
33
-
34
- - name: Set up Ruby
35
- uses: ruby/setup-ruby@v1
36
- with:
37
- ruby-version: ${{ matrix.ruby-version }}
38
- bundler-cache: true
39
-
40
- - name: test
41
- run: |
42
- bundle install && bundle exec rspec
@@ -1,32 +0,0 @@
1
- name: Ruby Gem
2
-
3
- on:
4
- push:
5
- tags:
6
- - v*
7
-
8
- jobs:
9
- build:
10
- name: Build + Publish
11
- runs-on: ubuntu-latest
12
- permissions:
13
- contents: read
14
- packages: write
15
-
16
- steps:
17
- - uses: actions/checkout@v2
18
- - name: Set up Ruby 2.6
19
- uses: actions/setup-ruby@v1
20
- with:
21
- ruby-version: 2.6.x
22
-
23
- - name: Publish to RubyGems
24
- run: |
25
- mkdir -p $HOME/.gem
26
- touch $HOME/.gem/credentials
27
- chmod 0600 $HOME/.gem/credentials
28
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
29
- gem build *.gemspec
30
- gem push *.gem
31
- env:
32
- GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- Gemfile.lock
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,11 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
- NewCops: enable
4
-
5
- Metrics/BlockLength:
6
- Exclude:
7
- - 'spec/**/*'
8
-
9
- Style/OpenStructUse:
10
- Exclude:
11
- - 'spec/**/*'
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.7.2
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in microcms.gemspec
6
- gemspec
7
-
8
- gem 'rake', '~> 12.0'
9
-
10
- gem 'rubocop', require: false
11
-
12
- gem 'rspec', require: false
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- task default: :spec
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'microcms'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/examples/examples.rb DELETED
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- MicroCMS.service_domain = ENV.fetch('YOUR_DOMAIN', nil)
4
- MicroCMS.api_key = ENV.fetch('YOUR_API_KEY', nil)
5
-
6
- endpoint = ENV.fetch('YOUR_ENDPOINT', nil)
7
-
8
- puts MicroCMS.list(endpoint)
9
-
10
- puts MicroCMS.list(endpoint, {
11
- limit: 100,
12
- offset: 1,
13
- orders: ['updatedAt'],
14
- q: 'Hello',
15
- fields: %w[id title],
16
- filters: 'publishedAt[greater_than]2021-01-01'
17
- })
18
-
19
- puts MicroCMS.get(endpoint, 'ruby')
20
-
21
- puts MicroCMS.get(endpoint, 'ruby', { draft_key: 'abcdef1234' })
22
-
23
- puts MicroCMS.create(endpoint, { text: 'Hello, microcms-ruby-sdk!' })
24
-
25
- puts MicroCMS.create(endpoint, { id: 'microcms-ruby-sdk', text: 'Hello, microcms-ruby-sdk!' })
26
-
27
- puts MicroCMS.create(endpoint, { text: 'Hello, microcms-ruby-sdk!' }, { status: 'draft' })
28
-
29
- puts MicroCMS.update(endpoint, { id: 'microcms-ruby-sdk', text: 'Hello, microcms-ruby-sdk update method!' })
30
-
31
- MicroCMS.delete(endpoint, 'microcms-ruby-sdk')