suzuri_client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/suzuri_client.rb +373 -0
- data/lib/suzuri_client/version.rb +3 -0
- data/suzuri_client.gemspec +26 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b5a6e0b9e9e37a32d3b19f2356b181ea4324f9e3
|
4
|
+
data.tar.gz: 608f654dcc54068e3480f9ff99aef7b67edc7850
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e8b7efbc630edcc57d056ef267b7a64fafde81fff39e2d6cc43bed7f65612584df9f9db2edf12bdec5dd7114bcc571edba56564dd1ce5dc5d6593cf0e03e5f20
|
7
|
+
data.tar.gz: 0c7581d48c813a5be9ba2da2f114fce41f499fd79d12d7c21e53b1eb387e6191c0b7a488bd82bce8d62a883914d2c5cf2d89befdc49cc95e41080afbe9552702
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Kenichi TAKAHASHI
|
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,39 @@
|
|
1
|
+
# SuzuriClient
|
2
|
+
|
3
|
+
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/suzuri_client`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'suzuri_client'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install suzuri_client
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
1. Fork it ( https://github.com/[my-github-username]/suzuri_client/fork )
|
36
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
37
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
38
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
39
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "suzuri_client"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,373 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'suzuri_client/version'
|
3
|
+
|
4
|
+
#
|
5
|
+
# WARNING: Do not edit by hand, this file was generated by Heroics:
|
6
|
+
#
|
7
|
+
# https://github.com/interagent/heroics
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'heroics'
|
11
|
+
require 'uri'
|
12
|
+
|
13
|
+
module Suzuri
|
14
|
+
# Get a Client configured to use HTTP Basic authentication.
|
15
|
+
#
|
16
|
+
# @param api_key [String] The API key to use when connecting.
|
17
|
+
# @param options [Hash<Symbol,String>] Optionally, custom settings
|
18
|
+
# to use with the client. Allowed options are `default_headers`,
|
19
|
+
# `cache`, `user` and `url`.
|
20
|
+
# @return [Client] A client configured to use the API with HTTP Basic
|
21
|
+
# authentication.
|
22
|
+
def self.connect(api_key, options=nil)
|
23
|
+
options = custom_options(options)
|
24
|
+
uri = URI.parse(options[:url])
|
25
|
+
uri.user = options.fetch(:user, 'user').gsub('@', '%40')
|
26
|
+
uri.password = api_key
|
27
|
+
client = Heroics.client_from_schema(SCHEMA, uri.to_s, options)
|
28
|
+
Client.new(client)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Get a Client configured to use OAuth authentication.
|
32
|
+
#
|
33
|
+
# @param oauth_token [String] The OAuth token to use with the API.
|
34
|
+
# @param options [Hash<Symbol,String>] Optionally, custom settings
|
35
|
+
# to use with the client. Allowed options are `default_headers`,
|
36
|
+
# `cache` and `url`.
|
37
|
+
# @return [Client] A client configured to use the API with OAuth
|
38
|
+
# authentication.
|
39
|
+
def self.connect_oauth(oauth_token, options=nil)
|
40
|
+
options = custom_options(options)
|
41
|
+
url = options[:url]
|
42
|
+
client = Heroics.oauth_client_from_schema(oauth_token, SCHEMA, url, options)
|
43
|
+
Client.new(client)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Get a Client configured to use Token authentication.
|
47
|
+
#
|
48
|
+
# @param token [String] The token to use with the API.
|
49
|
+
# @param options [Hash<Symbol,String>] Optionally, custom settings
|
50
|
+
# to use with the client. Allowed options are `default_headers`,
|
51
|
+
# `cache` and `url`.
|
52
|
+
# @return [Client] A client configured to use the API with OAuth
|
53
|
+
# authentication.
|
54
|
+
def self.connect_token(token, options=nil)
|
55
|
+
options = custom_options(options)
|
56
|
+
url = options[:url]
|
57
|
+
client = Heroics.token_client_from_schema(token, SCHEMA, url, options)
|
58
|
+
Client.new(client)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Get customized options.
|
62
|
+
def self.custom_options(options)
|
63
|
+
return default_options if options.nil?
|
64
|
+
|
65
|
+
final_options = default_options
|
66
|
+
if options[:default_headers]
|
67
|
+
final_options[:default_headers].merge!(options[:default_headers])
|
68
|
+
end
|
69
|
+
final_options[:cache] = options[:cache] if options[:cache]
|
70
|
+
final_options[:url] = options[:url] if options[:url]
|
71
|
+
final_options[:user] = options[:user] if options[:user]
|
72
|
+
final_options
|
73
|
+
end
|
74
|
+
|
75
|
+
# Get the default options.
|
76
|
+
def self.default_options
|
77
|
+
default_headers = {}
|
78
|
+
cache = Moneta.new(:Memory)
|
79
|
+
{
|
80
|
+
default_headers: default_headers,
|
81
|
+
cache: cache,
|
82
|
+
url: "https://suzuri.jp"
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
private_class_method :default_options, :custom_options
|
87
|
+
|
88
|
+
# Suzuri API
|
89
|
+
class Client
|
90
|
+
def initialize(client)
|
91
|
+
@client = client
|
92
|
+
end
|
93
|
+
|
94
|
+
# {"en"=>"Choice", "ja"=>"Choiceは、UserがProductを集めて作れるリストです。サイト内ではChoiceのことはオモイデと呼ばれています。"}
|
95
|
+
#
|
96
|
+
# @return [Choice]
|
97
|
+
def choice
|
98
|
+
@choice_resource ||= Choice.new(@client)
|
99
|
+
end
|
100
|
+
|
101
|
+
# {"en"=>"Favorite is users action of favoring Product (like facebook's like or twitter's favorite)", "ja"=>"Favorite(ズッキュン)は、UserがProductを気に入った時にするアクションです(Facebookのいいね!やtwitterのお気に入りのようなものです)"}
|
102
|
+
#
|
103
|
+
# @return [Favorite]
|
104
|
+
def favorite
|
105
|
+
@favorite_resource ||= Favorite.new(@client)
|
106
|
+
end
|
107
|
+
|
108
|
+
# {"en"=>"user identity of other web sites", "ja"=>"他サイトでのユーザーのアイデンティティ"}
|
109
|
+
#
|
110
|
+
# @return [Identity]
|
111
|
+
def identity
|
112
|
+
@identity_resource ||= Identity.new(@client)
|
113
|
+
end
|
114
|
+
|
115
|
+
# {"en"=>"Item is a product type we can create in SUZURI. For example, there is the item of 'T-Shirt' or 'Mug'.", "ja"=>"Item(アイテム)は、SUZURIで作ることができる商品の種類です。TシャツやマグカップなどのItem(アイテム)があります。"}
|
116
|
+
#
|
117
|
+
# @return [Item]
|
118
|
+
def item
|
119
|
+
@item_resource ||= Item.new(@client)
|
120
|
+
end
|
121
|
+
|
122
|
+
# {"en"=>"Item color", "ja"=>"アイテムカラー"}
|
123
|
+
#
|
124
|
+
# @return [ItemColor]
|
125
|
+
def item_color
|
126
|
+
@item_color_resource ||= ItemColor.new(@client)
|
127
|
+
end
|
128
|
+
|
129
|
+
# {"en"=>"item size", "ja"=>"アイテムのサイズ"}
|
130
|
+
#
|
131
|
+
# @return [ItemSize]
|
132
|
+
def item_size
|
133
|
+
@item_size_resource ||= ItemSize.new(@client)
|
134
|
+
end
|
135
|
+
|
136
|
+
# {"en"=>"combination of Item Color & Item Size.", "ja"=>"アイテムカラーとアイテムサイズの組み合わせ"}
|
137
|
+
#
|
138
|
+
# @return [ItemVariant]
|
139
|
+
def item_variant
|
140
|
+
@item_variant_resource ||= ItemVariant.new(@client)
|
141
|
+
end
|
142
|
+
|
143
|
+
# {"en"=>"Material is a material for create Product. Material is generated from image file uploaded by User", "ja"=>"Material(素材)は、Userがアップロードした画像によって生成される、Product(商品)を作るための素材です。ひとつのMaterialからは、Item一種類につき一つずつのProductを作ることができます。Materialから作ることのできる商品の種類は、**Item List API** を使って取得することができます。"}
|
144
|
+
#
|
145
|
+
# @return [Material]
|
146
|
+
def material
|
147
|
+
@material_resource ||= Material.new(@client)
|
148
|
+
end
|
149
|
+
|
150
|
+
# {"en"=>"Product created from Material", "ja"=>"Productは、Materialから生まれた各商品のことです。商品の値段は *material:price* と *itemVariant:price* によって決定されます。"}
|
151
|
+
#
|
152
|
+
# @return [Product]
|
153
|
+
def product
|
154
|
+
@product_resource ||= Product.new(@client)
|
155
|
+
end
|
156
|
+
|
157
|
+
# {"en"=>"user profile", "ja"=>"ユーザのプロフィール"}
|
158
|
+
#
|
159
|
+
# @return [Profile]
|
160
|
+
def profile
|
161
|
+
@profile_resource ||= Profile.new(@client)
|
162
|
+
end
|
163
|
+
|
164
|
+
# {"en"=>"User is a Suzuri User.", "ja"=>"User(ユーザ)とは、SUZURIのユーザです。"}
|
165
|
+
#
|
166
|
+
# @return [User]
|
167
|
+
def user
|
168
|
+
@user_resource ||= User.new(@client)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
private
|
173
|
+
|
174
|
+
# {"en"=>"Choice", "ja"=>"Choiceは、UserがProductを集めて作れるリストです。サイト内ではChoiceのことはオモイデと呼ばれています。"}
|
175
|
+
class Choice
|
176
|
+
def initialize(client)
|
177
|
+
@client = client
|
178
|
+
end
|
179
|
+
|
180
|
+
# {"en"=>"get info for Choice selected by id", "ja"=>"idで指定したChoiceの情報を取得します。"}
|
181
|
+
#
|
182
|
+
# @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"}
|
183
|
+
def info(choice_id)
|
184
|
+
@client.choice.info(choice_id)
|
185
|
+
end
|
186
|
+
|
187
|
+
# {"en"=>"create Choice", "ja"=>"Choiceを作成します。"}
|
188
|
+
#
|
189
|
+
# @param body: the object to pass as the request payload
|
190
|
+
def create(body)
|
191
|
+
@client.choice.create(body)
|
192
|
+
end
|
193
|
+
|
194
|
+
# {"en"=>"delete Choice", "ja"=>"Choiceを削除します。成功すると204を返します。"}
|
195
|
+
#
|
196
|
+
# @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"}
|
197
|
+
def delete(choice_id)
|
198
|
+
@client.choice.delete(choice_id)
|
199
|
+
end
|
200
|
+
|
201
|
+
# {"en"=>"add product to Choice", "ja"=>"Choiceに指定したProductを追加します。"}
|
202
|
+
#
|
203
|
+
# @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"}
|
204
|
+
# @param body: the object to pass as the request payload
|
205
|
+
def add_product(choice_id, body)
|
206
|
+
@client.choice.add_product(choice_id, body)
|
207
|
+
end
|
208
|
+
|
209
|
+
# {"en"=>"remove product from choice", "ja"=>"Choiceから指定したProductを削除します。"}
|
210
|
+
#
|
211
|
+
# @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"}
|
212
|
+
# @param body: the object to pass as the request payload
|
213
|
+
def remove_product(choice_id, body)
|
214
|
+
@client.choice.remove_product(choice_id, body)
|
215
|
+
end
|
216
|
+
|
217
|
+
# {"en"=>"update Choice", "ja"=>"Choiceのタイトルや説明を更新します。"}
|
218
|
+
#
|
219
|
+
# @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"}
|
220
|
+
# @param body: the object to pass as the request payload
|
221
|
+
def update(choice_id, body)
|
222
|
+
@client.choice.update(choice_id, body)
|
223
|
+
end
|
224
|
+
|
225
|
+
# {"en"=>"choices list", "ja"=>"Choiceの一覧を取得します。"}
|
226
|
+
#
|
227
|
+
# @param body: the object to pass as the request payload
|
228
|
+
def list(body)
|
229
|
+
@client.choice.list(body)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# {"en"=>"Favorite is users action of favoring Product (like facebook's like or twitter's favorite)", "ja"=>"Favorite(ズッキュン)は、UserがProductを気に入った時にするアクションです(Facebookのいいね!やtwitterのお気に入りのようなものです)"}
|
234
|
+
class Favorite
|
235
|
+
def initialize(client)
|
236
|
+
@client = client
|
237
|
+
end
|
238
|
+
|
239
|
+
# {"en"=>"favor product", "ja"=>"ProductをFavoriteします。"}
|
240
|
+
#
|
241
|
+
# @param product_id: {"en"=>"unique identifier of product", "ja"=>"Productの一意なID"}
|
242
|
+
def product(product_id)
|
243
|
+
@client.favorite.product(product_id)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
# {"en"=>"user identity of other web sites", "ja"=>"他サイトでのユーザーのアイデンティティ"}
|
248
|
+
class Identity
|
249
|
+
def initialize(client)
|
250
|
+
@client = client
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# {"en"=>"Item is a product type we can create in SUZURI. For example, there is the item of 'T-Shirt' or 'Mug'.", "ja"=>"Item(アイテム)は、SUZURIで作ることができる商品の種類です。TシャツやマグカップなどのItem(アイテム)があります。"}
|
255
|
+
class Item
|
256
|
+
def initialize(client)
|
257
|
+
@client = client
|
258
|
+
end
|
259
|
+
|
260
|
+
# {"en"=>"get all Item list", "ja"=>"全Itemのリストを取得します。"}
|
261
|
+
def list()
|
262
|
+
@client.item.list()
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
# {"en"=>"Item color", "ja"=>"アイテムカラー"}
|
267
|
+
class ItemColor
|
268
|
+
def initialize(client)
|
269
|
+
@client = client
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
# {"en"=>"item size", "ja"=>"アイテムのサイズ"}
|
274
|
+
class ItemSize
|
275
|
+
def initialize(client)
|
276
|
+
@client = client
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
# {"en"=>"combination of Item Color & Item Size.", "ja"=>"アイテムカラーとアイテムサイズの組み合わせ"}
|
281
|
+
class ItemVariant
|
282
|
+
def initialize(client)
|
283
|
+
@client = client
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
# {"en"=>"Material is a material for create Product. Material is generated from image file uploaded by User", "ja"=>"Material(素材)は、Userがアップロードした画像によって生成される、Product(商品)を作るための素材です。ひとつのMaterialからは、Item一種類につき一つずつのProductを作ることができます。Materialから作ることのできる商品の種類は、**Item List API** を使って取得することができます。"}
|
288
|
+
class Material
|
289
|
+
def initialize(client)
|
290
|
+
@client = client
|
291
|
+
end
|
292
|
+
|
293
|
+
# {"en"=>"create Material & Products by from image", "ja"=>"画像からMaterialとProductを作ります。**レートリミットが設けてあります。**"}
|
294
|
+
#
|
295
|
+
# @param body: the object to pass as the request payload
|
296
|
+
def create(body)
|
297
|
+
@client.material.create(body)
|
298
|
+
end
|
299
|
+
|
300
|
+
# {"en"=>"Update Material information", "ja"=>"Material及びProductの情報を更新します。Productsパラメータを指定した場合、このMaterialと指定したitemIdから成るProductがすでに存在する場合はProductの更新操作となり、存在しない場合はProductの作成操作となります。**レートリミットが設けてあります**"}
|
301
|
+
#
|
302
|
+
# @param material_id: {"en"=>"unique identifier of Material", "ja"=>"Materialのid"}
|
303
|
+
# @param body: the object to pass as the request payload
|
304
|
+
def update(material_id, body)
|
305
|
+
@client.material.update(material_id, body)
|
306
|
+
end
|
307
|
+
|
308
|
+
# {"en"=>"Delete Material", "ja"=>"Materialを削除します。紐付いたProductsもすべて削除されます。成功した時は204を返します。"}
|
309
|
+
#
|
310
|
+
# @param material_id: {"en"=>"unique identifier of Material", "ja"=>"Materialのid"}
|
311
|
+
def delete(material_id)
|
312
|
+
@client.material.delete(material_id)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
# {"en"=>"Product created from Material", "ja"=>"Productは、Materialから生まれた各商品のことです。商品の値段は *material:price* と *itemVariant:price* によって決定されます。"}
|
317
|
+
class Product
|
318
|
+
def initialize(client)
|
319
|
+
@client = client
|
320
|
+
end
|
321
|
+
|
322
|
+
# {"en"=>"get info for a Product specified by id.", "ja"=>"idを指定してProduct情報を取得します。"}
|
323
|
+
#
|
324
|
+
# @param product_id: {"en"=>"unique identifier of product", "ja"=>"Productの一意なID"}
|
325
|
+
def info(product_id)
|
326
|
+
@client.product.info(product_id)
|
327
|
+
end
|
328
|
+
|
329
|
+
# {"en"=>"get Products info", "ja"=>"複数のProduct情報を取得します。"}
|
330
|
+
#
|
331
|
+
# @param body: the object to pass as the request payload
|
332
|
+
def list(body)
|
333
|
+
@client.product.list(body)
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
# {"en"=>"user profile", "ja"=>"ユーザのプロフィール"}
|
338
|
+
class Profile
|
339
|
+
def initialize(client)
|
340
|
+
@client = client
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
# {"en"=>"User is a Suzuri User.", "ja"=>"User(ユーザ)とは、SUZURIのユーザです。"}
|
345
|
+
class User
|
346
|
+
def initialize(client)
|
347
|
+
@client = client
|
348
|
+
end
|
349
|
+
|
350
|
+
# {"en"=>"Info for existing User.", "ja"=>"idで指定したUserの情報を取得します"}
|
351
|
+
#
|
352
|
+
# @param user_id: {"en"=>"unique identifier of User", "ja"=>"Userの一意なID"}
|
353
|
+
def info(user_id)
|
354
|
+
@client.user.info(user_id)
|
355
|
+
end
|
356
|
+
|
357
|
+
# {"en"=>"Info for authorized User", "ja"=>"認証されたUserの情報を取得します"}
|
358
|
+
def self()
|
359
|
+
@client.user.self()
|
360
|
+
end
|
361
|
+
|
362
|
+
# {"en"=>"update authorized User", "ja"=>"認証されたUserの情報を更新します"}
|
363
|
+
#
|
364
|
+
# @param body: the object to pass as the request payload
|
365
|
+
def update(body)
|
366
|
+
@client.user.update(body)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
SCHEMA = Heroics::Schema.new(MultiJson.load(<<-'HEROICS_SCHEMA'))
|
371
|
+
{"$schema":"http://json-schema.org/draft-04/hyper-schema","definitions":{"choice":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Choice","ja":"Choice(オモイデ)"},"description":{"en":"Choice","ja":"Choiceは、UserがProductを集めて作れるリストです。サイト内ではChoiceのことはオモイデと呼ばれています。"},"definitions":{"id":{"description":{"en":"unique identifier of Choice","ja":"Choiceのid"},"example":7,"type":["integer"]},"title":{"description":{"en":"title of Choice","ja":"Choiceのタイトル"},"example":"スリスリピックアップ","type":["string"]},"description":{"description":{"en":"description of Choice","ja":"Choiceの説明文"},"example":"猫の商品を沢山あつめてみました。","type":["string","null"]},"secret":{"description":{"en":"flag of secret mode","ja":"Choiceの非公開フラグ(通常はfalse)"},"example":false,"type":["boolean"]},"bannerUrl":{"description":{"en":"url of banner image of choice","ja":"Choiceページのバナー画像URL"},"example":"https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246","format":"uri","type":["string","null"]},"productsCount":{"description":{"en":"count of Products included by Choice","ja":"Choiceに入っているProductの数"},"example":1,"type":["integer"]}},"links":[{"description":{"en":"get info for Choice selected by id","ja":"idで指定したChoiceの情報を取得します。"},"title":"Info","href":"/api/v1/choices/{(%23%2Fdefinitions%2Fchoice%2Fdefinitions%2Fid)}","method":"GET","rel":"self","targetSchema":{"type":["object"],"properties":{"choice":{"type":["object"],"$ref":"#/definitions/choice"}}}},{"description":{"en":"create Choice","ja":"Choiceを作成します。"},"title":"Create","href":"/api/v1/choices","method":"POST","rel":"object","schema":{"type":["object"],"properties":{"title":{"description":{"en":"title of Choice","ja":"作成するChoiceのタイトル"},"type":["string"],"example":"スリスリピックアップ"},"description":{"description":{"en":"description of Choice","ja":"作成するChoiceの説明"},"type":["string"],"example":"猫の商品を沢山あつめてみました。"},"bannerUrl":{"type":["string"],"description":{"en":"url of Choices banner","ja":"作成するChoiceのバナー画像URL"},"example":"https://dp3obxrw75ln8.cloudfront.net/choices/banners/7.jpg?1415260246"},"choiceProducts":{"type":["array"],"description":{"en":"Products info which is added to Choice","ja":"Choiceに追加するProduct情報の配列"},"items":{"type":["object"],"properties":{"productId":{"$ref":"#/definitions/product/definitions/id"},"itemVariantId":{"$ref":"#/definitions/item_variant/definitions/id"}}}}},"required":["title"]},"targetSchema":{"type":["object"],"properties":{"choice":{"type":["object"],"$ref":"#/definitions/choice"}}}},{"description":{"en":"delete Choice","ja":"Choiceを削除します。成功すると204を返します。"},"title":"Delete","href":"/api/v1/choices/{(%23%2Fdefinitions%2Fchoice%2Fdefinitions%2Fid)}","method":"DELETE","rel":"delete","response_example":{"head":"HTTP/1.1 204 No Content","body":"レスポンスヘッダのみ返します"}},{"description":{"en":"add product to Choice","ja":"Choiceに指定したProductを追加します。"},"title":"Add product","href":"/api/v1/choices/{(%23%2Fdefinitions%2Fchoice%2Fdefinitions%2Fid)}","method":"POST","rel":"object","schema":{"type":["object"],"properties":{"productId":{"description":{"en":"id of product which is to be added to Choice","ja":"Choiceに追加したいProductのid"},"example":1,"type":["integer"],"minimum":1},"itemVariantId":{"description":{"en":"id of item variant (combination of color and size) which is to be binded to product","ja":"Choiceに追加したいProductのItem Variant (色とサイズの組み合わせ) id"},"example":1,"type":["integer"],"minimum":1}}},"targetSchema":{"type":["object"],"properties":{"choice":{"type":["object"],"$ref":"#/definitions/choice"}}}},{"description":{"en":"remove product from choice","ja":"Choiceから指定したProductを削除します。"},"title":"Remove product","href":"/api/v1/choices/{(%23%2Fdefinitions%2Fchoice%2Fdefinitions%2Fid)}/remove","method":"POST","rel":"delete","schema":{"type":["object"],"properties":{"productId":{"description":{"en":"id of product which is to be removed from Choice","ja":"Choiceから削除したいProductのid"},"example":1,"type":["integer"],"minimum":1},"itemVariantId":{"description":{"en":"id of item variant which is to be binded to product","ja":"Choiceから削除したいProductのItem Variant (色とサイズの組み合わせ) id"},"example":1,"type":["integer"],"minimum":1}}},"targetSchema":{"type":["object"],"properties":{"choice":{"type":["object"],"$ref":"#/definitions/choice"}}}},{"description":{"en":"update Choice","ja":"Choiceのタイトルや説明を更新します。"},"title":"Update","href":"/api/v1/choices/{(%23%2Fdefinitions%2Fchoice%2Fdefinitions%2Fid)}/","method":"PUT","rel":"object","schema":{"type":["object"],"properties":{"title":{"$ref":"#/definitions/choice/definitions/title"},"description":{"$ref":"#/definitions/choice/definitions/description"},"bannerUrl":{"$ref":"#/definitions/choice/definitions/bannerUrl"},"choiceProducts":{"description":{"en":"Prodcucts info (this will be overwrite Choices Products Array whole.)","ja":"新たに設定するProducts(例えばここに空配列を指定した場合、追加されていたProductはChoiceからすべてなくなります。このパラメータは必須ではないので、更新の必要がなければ設定しないでください)"},"type":["array"],"items":{"type":["object"],"properties":{"productId":{"$ref":"#/definitions/product/definitions/id"},"itemVariantId":{"$ref":"#/definitions/item_variant/definitions/id"}}}}}},"targetSchema":{"type":["object"],"properties":{"choice":{"type":["object"],"$ref":"#/definitions/choice"}}}},{"description":{"en":"choices list","ja":"Choiceの一覧を取得します。"},"title":"List","href":"/api/v1/choices","method":"GET","rel":"object","schema":{"type":["object"],"properties":{"limit":{"description":{"en":"limit of Choice list (default 20)","ja":"取得するChoiceの数の上限(デフォルトは20)"},"example":15,"type":["string"],"pattern":"^([1-9]|[1-4][0-9]|50)$"},"offset":{"description":{"en":"offset of list (default is 0, higher number is older)","ja":"取得するChoiceの開始位置 (デフォルトは0, 数字が大きいほど古い)"},"example":100,"type":["string"],"pattern":"^[1-9][0-9]*$"}}},"targetSchema":{"type":["object"],"properties":{"choices":{"type":["array"],"definition":{"en":"Choice Array","ja":"Choiceの配列"},"items":{"$ref":"#/definitions/choice"}}}}}],"properties":{"id":{"$ref":"#/definitions/choice/definitions/id"},"title":{"$ref":"#/definitions/choice/definitions/title"},"description":{"$ref":"#/definitions/choice/definitions/description"},"secret":{"$ref":"#/definitions/choice/definitions/secret"},"bannerUrl":{"$ref":"#/definitions/choice/definitions/bannerUrl"},"productsCount":{"$ref":"#/definitions/choice/definitions/productsCount"},"user":{"type":["object"],"properties":{"id":{"$ref":"#/definitions/user/definitions/id"},"name":{"$ref":"#/definitions/user/definitions/name"},"displayName":{"$ref":"#/definitions/user/definitions/displayName"},"avatarUrl":{"$ref":"#/definitions/user/definitions/avatarUrl"}}}},"type":["object"]},"favorite":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Favorite","ja":"Favorite(ズッキュン)"},"description":{"en":"Favorite is users action of favoring Product (like facebook's like or twitter's favorite)","ja":"Favorite(ズッキュン)は、UserがProductを気に入った時にするアクションです(Facebookのいいね!やtwitterのお気に入りのようなものです)"},"definitions":{"id":{"description":{"en":"unique identifier of Favrotie","ja":"Favoriteのid"},"example":7,"type":["integer"]},"count":{"description":{"en":"Favorite count","ja":"Favoriteの数"},"example":3,"type":["integer"]},"productId":{"description":{"en":"id of product which is favored","ja":"Favoriteの対象となる商品のid"},"example":14,"type":["integer"]}},"links":[{"description":{"en":"favor product","ja":"ProductをFavoriteします。"},"href":"/api/v1/products/{(%23%2Fdefinitions%2Fproduct%2Fdefinitions%2Fid)}/favorites","method":"POST","rel":"self","title":"Product","targetSchema":{"type":["object"],"properties":{"favorite":{"type":["object"],"$ref":"#/definitions/favorite"}}}}],"properties":{"id":{"$ref":"#/definitions/favorite/definitions/id"},"count":{"$ref":"#/definitions/favorite/definitions/count"},"user":{"properties":{"id":{"$ref":"#/definitions/user/definitions/id"},"name":{"$ref":"#/definitions/user/definitions/name"},"displayName":{"$ref":"#/definitions/user/definitions/displayName"},"avatarUrl":{"$ref":"#/definitions/user/definitions/avatarUrl"}}}},"type":["object"]},"identity":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Identity","ja":"アイデンティティ"},"definitions":{"id":{"description":{"en":"ID of identity","ja":"アイデンティティのID"},"type":["integer"],"example":1},"provider":{"description":{"en":"provider of identity","ja":"アイデンティティの発行者"},"type":["string"],"example":"twitter"},"uid":{"description":{"en":"uid of identity","ja":"アイデンティティのuid"},"type":["string"],"example":9999},"url":{"description":{"en":"url that express identity","ja":"アイデンティティを表すurl"},"type":["string","null"],"example":"https://twitter.com/suzurijp"}},"description":{"en":"user identity of other web sites","ja":"他サイトでのユーザーのアイデンティティ"},"properties":{"id":{"$ref":"#/definitions/identity/definitions/id"},"provider":{"$ref":"#/definitions/identity/definitions/provider"},"uid":{"$ref":"#/definitions/identity/definitions/uid"},"url":{"$ref":"#/definitions/identity/definitions/url"}},"type":["object"]},"item":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Item","ja":"Item(アイテム)"},"description":{"en":"Item is a product type we can create in SUZURI. For example, there is the item of 'T-Shirt' or 'Mug'.","ja":"Item(アイテム)は、SUZURIで作ることができる商品の種類です。TシャツやマグカップなどのItem(アイテム)があります。"},"definitions":{"id":{"description":{"en":"unique identifier of Item","ja":"Itemのid"},"example":1,"type":["integer"]},"name":{"description":{"en":"unique name of Item","ja":"Itemの一意な名前"},"example":"t-shirt","type":["string"]},"angles":{"description":{"en":"angles of Item (used when generate item image)","ja":"Itemの画像におけるアングルの種類"},"example":[1],"type":["array"],"items":{"type":["integer","string"],"example":1}},"humanizeName":{"description":{"en":"descriptive label for Item, displayed on the screen","ja":"Itemを表す名前"},"example":"Tシャツ","type":["string"]}},"links":[{"description":{"en":"get all Item list","ja":"全Itemのリストを取得します。"},"title":"List","href":"/api/v1/items","method":"GET","rel":"instances","targetSchema":{"type":["object"],"properties":{"items":{"type":["array"],"items":{"type":["object"],"properties":{"id":{"$ref":"#/definitions/item/definitions/id"},"name":{"$ref":"#/definitions/item/definitions/name"},"angles":{"$ref":"#/definitions/item/definitions/angles"},"humanizeName":{"$ref":"#/definitions/item/definitions/humanizeName"},"variants":{"type":["array"],"items":{"$ref":"#/definitions/item_variant"}}}}}}}}],"properties":{"id":{"$ref":"#/definitions/item/definitions/id"},"name":{"$ref":"#/definitions/item/definitions/name"},"angles":{"$ref":"#/definitions/item/definitions/angles"},"humanizeName":{"$ref":"#/definitions/item/definitions/humanizeName"}},"type":["object"]},"item_color":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Item color","ja":"アイテムカラー"},"definitions":{"id":{"description":{"en":"unique identifier of item color","ja":"アイテムカラーの一意なID"},"example":1,"type":["integer"]},"name":{"description":{"en":"unique name of item color","ja":"アイテムカラーの一意な名前"},"example":"white","type":["string"]},"rgb":{"description":{"en":"rgb color of item color","ja":"アイテムカラーのRGB"},"example":null,"type":["string"]}},"description":{"en":"Item color","ja":"アイテムカラー"},"properties":{"id":{"$ref":"#/definitions/item_color/definitions/id"},"name":{"$ref":"#/definitions/item_color/definitions/name"},"rgb":{"$ref":"#/definitions/item_color/definitions/rgb"}},"type":["object"]},"item_size":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Item size","ja":"アイテムサイズ"},"definitions":{"id":{"description":{"en":"unique identifier of item size","ja":"アイテムサイズの一意なID"},"example":1,"type":["integer"]},"name":{"description":{"en":"unique name of item size","ja":"アイテムサイズの一意な名前"},"example":"s","type":["string"]}},"description":{"en":"item size","ja":"アイテムのサイズ"},"properties":{"id":{"$ref":"#/definitions/item_size/definitions/id"},"name":{"$ref":"#/definitions/item_size/definitions/name"}},"type":["object"]},"item_variant":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Item variant","ja":"アイテムバリエーション"},"definitions":{"id":{"description":{"en":"unique identifier of item_variant","ja":"アイテムバリエーションの一意なID"},"example":1,"type":["integer"]},"price":{"description":{"en":"price of item_variant","ja":"アイテムバリエーションの原価"},"example":2080,"type":["integer"]},"exemplary":{"description":{"en":"flag of exemplary or not (if variant was exemplary, that is used for SUZURI\\'s products list page)","ja":"代表フラグ(代表のアイテムバリエーションが、SUZURIサイトの商品リストページに使用されます)"},"example":true,"type":["boolean"]}},"description":{"en":"combination of Item Color & Item Size.","ja":"アイテムカラーとアイテムサイズの組み合わせ"},"properties":{"id":{"$ref":"#/definitions/item_variant/definitions/id"},"price":{"$ref":"#/definitions/item_variant/definitions/price"},"exemplary":{"$ref":"#/definitions/item_variant/definitions/exemplary"},"color":{"$ref":"#/definitions/item_color"},"size":{"$ref":"#/definitions/item_size"}},"type":["object"]},"material":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Material","ja":"Material(素材)"},"description":{"en":"Material is a material for create Product. Material is generated from image file uploaded by User","ja":"Material(素材)は、Userがアップロードした画像によって生成される、Product(商品)を作るための素材です。ひとつのMaterialからは、Item一種類につき一つずつのProductを作ることができます。Materialから作ることのできる商品の種類は、**Item List API** を使って取得することができます。"},"definitions":{"id":{"description":{"en":"unique identifier of Material","ja":"Materialのid"},"example":31106,"type":["integer"]},"title":{"description":{"en":"title of Material","ja":"Materialのタイトル"},"example":"AAスリスリくん","type":["string"]},"description":{"description":{"en":"description of Material","ja":"Materialの説明"},"example":"cjdiaosjdadfv:::surisurikun:::jaifiavdaiovfhaidhviwefoiah.","type":["null","string"]},"price":{"description":{"en":"price of Material (will be added to the price of item variant)","ja":"Materialの値段 (いわゆるトリブン)。"},"example":100,"type":["integer"]},"violation":{"description":{"en":"true when the material go violate the rules","ja":"違反フラグ (Materialが規約違反しているかどうか)"},"example":false,"type":["boolean"]},"published":{"description":{"en":"true when the material go be published","ja":"公開・非公開フラグ (Materialが公開されているときtrue)"},"example":true,"type":["boolean"]},"publishedAt":{"description":{"en":"when material was published","ja":"Materialが公開された時間"},"example":"2014-05-07 11:05:25 +0900","format":"date-time","type":["string"]},"uploadedAt":{"description":{"en":"when material was uploaded","ja":"Materialが更新された時間"},"example":"2014-05-07 11:03:15 +0900","format":"date-time","type":["string"]},"dominantRgb":{"description":{"en":"dominant color RGB of material","ja":"Materialの主張色のRGB"},"example":null,"type":["string","null"]},"originalWidth":{"description":{"en":"original width of Material","ja":"Materialの画像の横幅"},"example":1920,"type":["integer"]},"originalHeight":{"description":{"en":"original height of Material","ja":"Materialの画像の縦幅"},"example":1080,"type":["integer"]}},"links":[{"title":"Create","description":{"en":"create Material & Products by from image","ja":"画像からMaterialとProductを作ります。**レートリミットが設けてあります。**"},"href":"/api/v1/materials","method":"POST","rel":"self","ratelimit":{"period":900,"limit":200},"schema":{"type":["object"],"properties":{"texture":{"description":{"en":"url of texture image of material (data uri is OK)","ja":"Materialの画像URL (データURIでも可)"},"example":["https://41.media.tumblr.com/QA9JpdgnOc8ov98s1C4S5EjJ_500.jpg"],"type":["string"]},"title":{"$ref":"#/definitions/material/definitions/title"},"price":{"$ref":"#/definitions/material/definitions/price"},"description":{"$ref":"#/definitions/material/definitions/description"},"products":{"type":["array"],"description":{"en":"array of products","ja":"同時にProductも作る場合は、このパラメータに作りたいProductを指定します。指定する場合は、itemId と exemplaryItemVariantId は必須となります。Productは、後述のMaterial Update APIによってあとから作ることもできます。"},"items":{"type":["object"],"properties":{"itemId":{"type":["integer"],"description":{"en":"id of Item of Product","ja":"作るProductのItemのid"},"example":1},"exemplaryItemVariantId":{"type":["integer"],"description":{"en":"id of Item variant of Product","ja":"作るProductの代表的なItem Variant(色とサイズの組み合わせ)のid"},"example":151},"published":{"type":["boolean"],"description":{"en":"if you publish Product, turn this field true","ja":"作ったProductを公開する場合はtrue"},"example":true},"resizeMode":{"type":["string","null"],"description":{"en":"resize mode of material","ja":"自動でリサイズするオプションです。`contain` を指定すると、プリント領域にぴったり収まるように画像を拡大・縮小します。"},"example":"contain"}}}}},"required":["title","texture"]},"targetSchema":{"type":["object"],"properties":{"material":{"$ref":"#/definitions/material"},"products":{"type":["array"],"items":{"$ref":"#/definitions/product"}}}}},{"title":"Update","description":{"en":"Update Material information","ja":"Material及びProductの情報を更新します。Productsパラメータを指定した場合、このMaterialと指定したitemIdから成るProductがすでに存在する場合はProductの更新操作となり、存在しない場合はProductの作成操作となります。**レートリミットが設けてあります**"},"href":"/api/v1/materials/{(%23%2Fdefinitions%2Fmaterial%2Fdefinitions%2Fid)}","method":"PUT","rel":"self","ratelimit":{"period":900,"limit":200},"schema":{"type":["object"],"properties":{"title":{"$ref":"#/definitions/material/definitions/title"},"price":{"$ref":"#/definitions/material/definitions/price"},"description":{"$ref":"#/definitions/material/definitions/description"},"products":{"type":["array"],"description":{"en":"array of Products","ja":"更新するProductのパラメータ"},"items":{"type":["object"],"properties":{"itemId":{"type":["integer"],"description":{"en":"id of Item of Product","ja":"更新するProductのItemのid"},"example":1},"exemplaryItemVariantId":{"type":["integer"],"description":{"en":"id of Item variant of Product","ja":"更新するProductの代表的なItem Variant(色とサイズの組み合わせ)のid"},"example":151},"published":{"type":["boolean"],"description":{"en":"if you publish product, turn this field true","ja":"trueだと公開、falseだと非公開"},"example":true},"resizeMode":{"type":["string","null"],"description":{"en":"resize mode of material","ja":"自動でリサイズするオプション。`contain` を指定すると、プリント領域にぴったり収まるように画像を拡大・縮小"},"example":"contain"}}}}}},"targetSchema":{"type":["object"],"properties":{"material":{"$ref":"#/definitions/material"},"products":{"type":["array"],"items":{"$ref":"#/definitions/product"}}}}},{"title":"Delete","description":{"en":"Delete Material","ja":"Materialを削除します。紐付いたProductsもすべて削除されます。成功した時は204を返します。"},"href":"/api/v1/materials/{(%23%2Fdefinitions%2Fmaterial%2Fdefinitions%2Fid)}","method":"DELETE","rel":"delete","response_example":{"head":"HTTP/1.1 204 No Content","body":"レスポンスヘッダのみ返します"}}],"properties":{"id":{"$ref":"#/definitions/material/definitions/id"},"title":{"$ref":"#/definitions/material/definitions/title"},"description":{"$ref":"#/definitions/material/definitions/description"},"price":{"$ref":"#/definitions/material/definitions/price"},"violation":{"$ref":"#/definitions/material/definitions/violation"},"published":{"$ref":"#/definitions/material/definitions/published"},"publishedAt":{"$ref":"#/definitions/material/definitions/publishedAt"},"uploadedAt":{"$ref":"#/definitions/material/definitions/uploadedAt"},"dominantRgb":{"$ref":"#/definitions/material/definitions/dominantRgb"},"originalWidth":{"$ref":"#/definitions/material/definitions/originalWidth"},"originalHeight":{"$ref":"#/definitions/material/definitions/originalHeight"},"user":{"type":["object"],"properties":{"id":{"$ref":"#/definitions/user/definitions/id"},"name":{"$ref":"#/definitions/user/definitions/name"},"displayName":{"$ref":"#/definitions/user/definitions/displayName"},"avatarUrl":{"$ref":"#/definitions/user/definitions/avatarUrl"}}}},"type":["object"]},"product":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"Product","ja":"Product(商品)"},"description":{"en":"Product created from Material","ja":"Productは、Materialから生まれた各商品のことです。商品の値段は *material:price* と *itemVariant:price* によって決定されます。"},"definitions":{"id":{"description":{"en":"unique identifier of product","ja":"Productの一意なID"},"example":1,"type":["integer"]},"title":{"description":{"en":"title of product","ja":"Productのタイトル"},"example":"AAスリスリくん Tシャツ","type":["string"]},"published":{"description":{"en":"if product is published, this is true","ja":"公開フラグ (公開されていれば真)"},"example":true,"type":["boolean"]},"publishedAt":{"description":{"en":"when product was published","ja":"Productが公開された時間"},"example":"2015-01-14 11:58:29 +0900","format":"date-time","type":["string"]},"createdAt":{"description":{"en":"when product was created","ja":"Product作成された時間"},"example":"2015-01-14 11:58:29 +0900","format":"date-time","type":["string"]},"updatedAt":{"description":{"en":"when product was updated","ja":"Productが更新された時間"},"example":"2015-01-14 11:58:29 +0900","format":"date-time","type":["string"]},"examplaryAngle":{"description":{"en":"exemplary angle of products (which is used for SUZURI web page)","ja":"Productの代表的角度(SUZURIのウェブサイトで使用されます)"},"example":null,"type":["integer","null"]},"imageUrl":{"description":{"en":"url of product image (we have to fix where enclosed by \\'{}\\')","ja":"Product画像のURL。`{}` で囲まれた箇所は変数です。 次の値を入れて使用して下さい。`{width}x{height}` に画像のサイズ。(有効な値は `323x323`、`765x765`) `{size}/{color}` にアイテムサイズ/カラーの名前。(有効な組み合わせは itemVariantsを参照)"},"example":"https://d1q9av5b648rmv.cloudfront.net/{width}x{height}/t-shirt/{size}/{color}/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b","type":["string"]},"sampleImageUrl":{"description":{"en":"sample of image url","ja":"Product画像URLのサンプル"},"example":"https://d1q9av5b648rmv.cloudfront.net/1530x1530/t-shirt/s/white/31106/1399428195-2520x2992.png.jpg?h=224855199776d40aa2f7d6e3f181bfb19db9a90b","type":["string"]},"url":{"description":{"en":"url of product (we have to fix where enclosed by \\'{}\\')","ja":"ProductのWebページのURL。`{}` で囲まれた箇所は変数です。 `{size}/{color}` にアイテムサイズ/カラーの名前を入れて使用して下さい。(有効な組み合わせは itemVariantsを参照)"},"example":"https://suzuri.jp/surisurikun/31106/t-shirt/{size}/{white}","type":["string"]},"sampleUrl":{"description":{"en":"sample of url","ja":"ProductページURLのサンプル"},"example":"https://suzuri.jp/surisurikun/31106/t-shirt/s/white","type":["string"]}},"links":[{"description":{"en":"get info for a Product specified by id.","ja":"idを指定してProduct情報を取得します。"},"href":"/api/v1/products/{(%23%2Fdefinitions%2Fproduct%2Fdefinitions%2Fid)}","method":"GET","rel":"self","title":"Info","targetSchema":{"type":["object"],"properties":{"products":{"type":["object"],"properties":{"id":{"$ref":"#/definitions/product/definitions/id"},"title":{"$ref":"#/definitions/product/definitions/title"},"published":{"$ref":"#/definitions/product/definitions/published"},"publishedAt":{"$ref":"#/definitions/product/definitions/publishedAt"},"createdAt":{"$ref":"#/definitions/product/definitions/createdAt"},"updatedAt":{"$ref":"#/definitions/product/definitions/updatedAt"},"examplaryAngle":{"$ref":"#/definitions/product/definitions/examplaryAngle"},"imageUrl":{"$ref":"#/definitions/product/definitions/imageUrl"},"sampleImageUrl":{"$ref":"#/definitions/product/definitions/sampleImageUrl"},"url":{"$ref":"#/definitions/product/definitions/url"},"sampleUrl":{"$ref":"#/definitions/product/definitions/sampleUrl"},"item":{"type":["object"],"$ref":"#/definitions/item"},"material":{"type":["object"],"$ref":"#/definitions/material"},"itemVariants":{"type":["array"],"definition":{"en":"ItemVariant Array","ja":"このProductで選択可能なItemVariant(サイズと色の組み合わせ)の配列"},"items":{"$ref":"#/definitions/item_variant"}},"sampleItemVariant":{"$ref":"#/definitions/item_variant"}}}}}},{"description":{"en":"get Products info","ja":"複数のProduct情報を取得します。"},"href":"/api/v1/products","method":"GET","rel":"object","schema":{"type":["object"],"properties":{"itemId":{"description":{"en":"name of Item","ja":"取得するProductをItemのIDで絞り込む"},"example":1,"type":["string"],"pattern":"^[1-9][0-9]*$"},"limit":{"description":{"en":"limit of Products list (default 20)","ja":"取得するProductの数を指定します(デフォルトは20)"},"example":30,"type":["string"],"pattern":"^([1-9]|[1-4][0-9]|50)$"},"offset":{"description":{"en":"offset of Products list","ja":"取得するProductの開始位置を指定します"},"example":100,"type":["string"],"pattern":"^[1-9][0-9]*$"},"userId":{"description":{"en":"filtering list by User id of Product owner","ja":"取得するProductを User id で絞り込む"},"example":2,"type":["string"],"pattern":"^[1-9][0-9]*$"}}},"targetSchema":{"type":["object"],"properties":{"products":{"description":"Productの配列","type":["array"],"items":{"$ref":"#/definitions/product"}}}},"title":"List"}],"properties":{"id":{"$ref":"#/definitions/product/definitions/id"},"title":{"$ref":"#/definitions/product/definitions/title"},"published":{"$ref":"#/definitions/product/definitions/published"},"publishedAt":{"$ref":"#/definitions/product/definitions/publishedAt"},"createdAt":{"$ref":"#/definitions/product/definitions/createdAt"},"updatedAt":{"$ref":"#/definitions/product/definitions/updatedAt"},"examplaryAngle":{"$ref":"#/definitions/product/definitions/examplaryAngle"},"imageUrl":{"$ref":"#/definitions/product/definitions/imageUrl"},"sampleImageUrl":{"$ref":"#/definitions/product/definitions/sampleImageUrl"},"url":{"$ref":"#/definitions/product/definitions/url"},"sampleUrl":{"$ref":"#/definitions/product/definitions/sampleUrl"},"item":{"type":["object"],"$ref":"#/definitions/item"},"material":{"type":["object"],"$ref":"#/definitions/material"},"sampleItemVariant":{"type":["object"],"$ref":"#/definitions/item_variant"}},"type":["object"]},"profile":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":"Profile","definitions":{"url":{"description":{"en":"user\\'s web page","ja":"ユーザのホームページのURL"},"example":"https://suzuri.jp/","type":["string","null"]},"body":{"description":{"en":"profile description","ja":"プロフィールの詳細"},"example":"こんにちは!SUZURI の公式忍者・スリスリくんです。\\nキミも忍者にならないか?","type":["string","null"]},"headerUrl":{"description":{"en":"url of header image of user\\'s profile page","ja":"ユーザプロフィールページのヘッダ画像URL"},"example":"https://dp3obxrw75ln8.cloudfront.net/profiles/headers/10.png?1398245916","type":["string","null"]}},"description":{"en":"user profile","ja":"ユーザのプロフィール"},"properties":{"url":{"$ref":"#/definitions/profile/definitions/url"},"body":{"$ref":"#/definitions/profile/definitions/body"},"headerUrl":{"$ref":"#/definitions/profile/definitions/headerUrl"}},"type":["object"]},"user":{"$schema":"http://json-schema.org/draft-04/hyper-schema","title":{"en":"User","ja":"User(ユーザ)"},"definitions":{"id":{"description":{"en":"unique identifier of User","ja":"Userの一意なID"},"type":["integer"],"example":1},"name":{"description":{"en":"unique name of User","ja":"Userの一意な名前"},"type":["string"],"example":"surisurikun"},"displayName":{"description":{"en":"descriptive label for User, displayed on the screen","ja":"ウェブページなどに表示するUserの名前"},"type":["string","null"],"example":"忍者スリスリくん"},"avatarUrl":{"description":{"en":"url avatar image of User","ja":"Userのアバター画像のURL"},"type":["string","null"],"example":"https://dp3obxrw75ln8.cloudfront.net/users/avatars/7.png?1395818488"}},"description":{"en":"User is a Suzuri User.","ja":"User(ユーザ)とは、SUZURIのユーザです。"},"links":[{"description":{"en":"Info for existing User.","ja":"idで指定したUserの情報を取得します"},"title":"Info","href":"/api/v1/users/{(%23%2Fdefinitions%2Fuser%2Fdefinitions%2Fid)}","method":"GET","rel":"self","targetSchema":{"type":["object"],"properties":{"user":{"type":["object"],"$ref":"#/definitions/user/"}}}},{"description":{"en":"Info for authorized User","ja":"認証されたUserの情報を取得します"},"href":"/api/v1/user","method":"GET","rel":"self","title":"self","targetSchema":{"type":["object"],"properties":{"user":{"type":["object"],"$ref":"#/definitions/user/"}}}},{"description":{"en":"update authorized User","ja":"認証されたUserの情報を更新します"},"href":"/api/v1/user","method":"PUT","rel":"self","title":"update","schema":{"type":["object"],"properties":{"displayName":{"$ref":"#/definitions/user/definitions/displayName"},"avatarUrl":{"$ref":"#/definitions/user/definitions/avatarUrl"}}},"targetSchema":{"type":["object"],"properties":{"user":{"type":["object"],"$ref":"#/definitions/user/"}}}}],"properties":{"id":{"$ref":"#/definitions/user/definitions/id"},"name":{"$ref":"#/definitions/user/definitions/name"},"displayName":{"$ref":"#/definitions/user/definitions/displayName"},"avatarUrl":{"$ref":"#/definitions/user/definitions/avatarUrl"},"profile":{"$ref":"#/definitions/profile"}},"type":["object"]}},"properties":{"choice":{"$ref":"#/definitions/choice"},"favorite":{"$ref":"#/definitions/favorite"},"identity":{"$ref":"#/definitions/identity"},"item":{"$ref":"#/definitions/item"},"item_color":{"$ref":"#/definitions/item_color"},"item_size":{"$ref":"#/definitions/item_size"},"item_variant":{"$ref":"#/definitions/item_variant"},"material":{"$ref":"#/definitions/material"},"product":{"$ref":"#/definitions/product"},"profile":{"$ref":"#/definitions/profile"},"user":{"$ref":"#/definitions/user"}},"type":["object"],"description":"Suzuri API","id":"suzuri","links":[{"href":"https://suzuri.jp/api/v1","rel":"self"}],"title":"Suzuri"}
|
372
|
+
HEROICS_SCHEMA
|
373
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'suzuri_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "suzuri_client"
|
8
|
+
spec.version = SuzuriClient::VERSION
|
9
|
+
spec.authors = ["Kenichi TAKAHASHI"]
|
10
|
+
spec.email = ["kenichi.taka@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Suzuri API Client (Powered by heroics)}
|
13
|
+
spec.description = %q{Suzuri API Client (Powered by heroics)}
|
14
|
+
spec.homepage = "https://github.com/kenchan/suzuri_client"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "heroics"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.8"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: suzuri_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kenichi TAKAHASHI
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: heroics
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Suzuri API Client (Powered by heroics)
|
56
|
+
email:
|
57
|
+
- kenichi.taka@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- CODE_OF_CONDUCT.md
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/console
|
69
|
+
- bin/setup
|
70
|
+
- lib/suzuri_client.rb
|
71
|
+
- lib/suzuri_client/version.rb
|
72
|
+
- suzuri_client.gemspec
|
73
|
+
homepage: https://github.com/kenchan/suzuri_client
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Suzuri API Client (Powered by heroics)
|
97
|
+
test_files: []
|