# encoding: utf-8 require 'suzuri_client/version' # # WARNING: Do not edit by hand, this file was generated by Heroics: # # https://github.com/interagent/heroics # require 'heroics' require 'uri' module Suzuri # Get a Client configured to use HTTP Basic authentication. # # @param api_key [String] The API key to use when connecting. # @param options [Hash] Optionally, custom settings # to use with the client. Allowed options are `default_headers`, # `cache`, `user` and `url`. # @return [Client] A client configured to use the API with HTTP Basic # authentication. def self.connect(api_key, options=nil) options = custom_options(options) uri = URI.parse(options[:url]) uri.user = options.fetch(:user, 'user').gsub('@', '%40') uri.password = api_key client = Heroics.client_from_schema(SCHEMA, uri.to_s, options) Client.new(client) end # Get a Client configured to use OAuth authentication. # # @param oauth_token [String] The OAuth token to use with the API. # @param options [Hash] Optionally, custom settings # to use with the client. Allowed options are `default_headers`, # `cache` and `url`. # @return [Client] A client configured to use the API with OAuth # authentication. def self.connect_oauth(oauth_token, options=nil) options = custom_options(options) url = options[:url] client = Heroics.oauth_client_from_schema(oauth_token, SCHEMA, url, options) Client.new(client) end # Get a Client configured to use Token authentication. # # @param token [String] The token to use with the API. # @param options [Hash] Optionally, custom settings # to use with the client. Allowed options are `default_headers`, # `cache` and `url`. # @return [Client] A client configured to use the API with OAuth # authentication. def self.connect_token(token, options=nil) options = custom_options(options) url = options[:url] client = Heroics.token_client_from_schema(token, SCHEMA, url, options) Client.new(client) end # Get customized options. def self.custom_options(options) return default_options if options.nil? final_options = default_options if options[:default_headers] final_options[:default_headers].merge!(options[:default_headers]) end final_options[:cache] = options[:cache] if options[:cache] final_options[:url] = options[:url] if options[:url] final_options[:user] = options[:user] if options[:user] final_options end # Get the default options. def self.default_options default_headers = {} cache = Moneta.new(:Memory) { default_headers: default_headers, cache: cache, url: "https://suzuri.jp" } end private_class_method :default_options, :custom_options # Suzuri API class Client def initialize(client) @client = client end # {"en"=>"Choice", "ja"=>"Choiceは、UserがProductを集めて作れるリストです。サイト内ではChoiceのことはオモイデと呼ばれています。"} # # @return [Choice] def choice @choice_resource ||= Choice.new(@client) end # {"en"=>"Favorite is users action of favoring Product (like facebook's like or twitter's favorite)", "ja"=>"Favorite(ズッキュン)は、UserがProductを気に入った時にするアクションです(Facebookのいいね!やtwitterのお気に入りのようなものです)"} # # @return [Favorite] def favorite @favorite_resource ||= Favorite.new(@client) end # {"en"=>"user identity of other web sites", "ja"=>"他サイトでのユーザーのアイデンティティ"} # # @return [Identity] def identity @identity_resource ||= Identity.new(@client) end # {"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(アイテム)があります。"} # # @return [Item] def item @item_resource ||= Item.new(@client) end # {"en"=>"Item color", "ja"=>"アイテムカラー"} # # @return [ItemColor] def item_color @item_color_resource ||= ItemColor.new(@client) end # {"en"=>"item size", "ja"=>"アイテムのサイズ"} # # @return [ItemSize] def item_size @item_size_resource ||= ItemSize.new(@client) end # {"en"=>"combination of Item Color & Item Size.", "ja"=>"アイテムカラーとアイテムサイズの組み合わせ"} # # @return [ItemVariant] def item_variant @item_variant_resource ||= ItemVariant.new(@client) end # {"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** を使って取得することができます。"} # # @return [Material] def material @material_resource ||= Material.new(@client) end # {"en"=>"Product created from Material", "ja"=>"Productは、Materialから生まれた各商品のことです。商品の値段は *material:price* と *itemVariant:price* によって決定されます。"} # # @return [Product] def product @product_resource ||= Product.new(@client) end # {"en"=>"user profile", "ja"=>"ユーザのプロフィール"} # # @return [Profile] def profile @profile_resource ||= Profile.new(@client) end # {"en"=>"User is a Suzuri User.", "ja"=>"User(ユーザ)とは、SUZURIのユーザです。"} # # @return [User] def user @user_resource ||= User.new(@client) end end private # {"en"=>"Choice", "ja"=>"Choiceは、UserがProductを集めて作れるリストです。サイト内ではChoiceのことはオモイデと呼ばれています。"} class Choice def initialize(client) @client = client end # {"en"=>"get info for Choice selected by id", "ja"=>"idで指定したChoiceの情報を取得します。"} # # @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"} def info(choice_id) @client.choice.info(choice_id) end # {"en"=>"create Choice", "ja"=>"Choiceを作成します。"} # # @param body: the object to pass as the request payload def create(body) @client.choice.create(body) end # {"en"=>"delete Choice", "ja"=>"Choiceを削除します。成功すると204を返します。"} # # @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"} def delete(choice_id) @client.choice.delete(choice_id) end # {"en"=>"add product to Choice", "ja"=>"Choiceに指定したProductを追加します。"} # # @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"} # @param body: the object to pass as the request payload def add_product(choice_id, body) @client.choice.add_product(choice_id, body) end # {"en"=>"remove product from choice", "ja"=>"Choiceから指定したProductを削除します。"} # # @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"} # @param body: the object to pass as the request payload def remove_product(choice_id, body) @client.choice.remove_product(choice_id, body) end # {"en"=>"update Choice", "ja"=>"Choiceのタイトルや説明を更新します。"} # # @param choice_id: {"en"=>"unique identifier of Choice", "ja"=>"Choiceのid"} # @param body: the object to pass as the request payload def update(choice_id, body) @client.choice.update(choice_id, body) end # {"en"=>"choices list", "ja"=>"Choiceの一覧を取得します。"} # # @param body: the object to pass as the request payload def list(body) @client.choice.list(body) end end # {"en"=>"Favorite is users action of favoring Product (like facebook's like or twitter's favorite)", "ja"=>"Favorite(ズッキュン)は、UserがProductを気に入った時にするアクションです(Facebookのいいね!やtwitterのお気に入りのようなものです)"} class Favorite def initialize(client) @client = client end # {"en"=>"favor product", "ja"=>"ProductをFavoriteします。"} # # @param product_id: {"en"=>"unique identifier of product", "ja"=>"Productの一意なID"} def product(product_id) @client.favorite.product(product_id) end end # {"en"=>"user identity of other web sites", "ja"=>"他サイトでのユーザーのアイデンティティ"} class Identity def initialize(client) @client = client end end # {"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(アイテム)があります。"} class Item def initialize(client) @client = client end # {"en"=>"get all Item list", "ja"=>"全Itemのリストを取得します。"} def list() @client.item.list() end end # {"en"=>"Item color", "ja"=>"アイテムカラー"} class ItemColor def initialize(client) @client = client end end # {"en"=>"item size", "ja"=>"アイテムのサイズ"} class ItemSize def initialize(client) @client = client end end # {"en"=>"combination of Item Color & Item Size.", "ja"=>"アイテムカラーとアイテムサイズの組み合わせ"} class ItemVariant def initialize(client) @client = client end end # {"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** を使って取得することができます。"} class Material def initialize(client) @client = client end # {"en"=>"create Material & Products by from image", "ja"=>"画像からMaterialとProductを作ります。**レートリミットが設けてあります。**"} # # @param body: the object to pass as the request payload def create(body) @client.material.create(body) end # {"en"=>"Update Material information", "ja"=>"Material及びProductの情報を更新します。Productsパラメータを指定した場合、このMaterialと指定したitemIdから成るProductがすでに存在する場合はProductの更新操作となり、存在しない場合はProductの作成操作となります。**レートリミットが設けてあります**"} # # @param material_id: {"en"=>"unique identifier of Material", "ja"=>"Materialのid"} # @param body: the object to pass as the request payload def update(material_id, body) @client.material.update(material_id, body) end # {"en"=>"Delete Material", "ja"=>"Materialを削除します。紐付いたProductsもすべて削除されます。成功した時は204を返します。"} # # @param material_id: {"en"=>"unique identifier of Material", "ja"=>"Materialのid"} def delete(material_id) @client.material.delete(material_id) end end # {"en"=>"Product created from Material", "ja"=>"Productは、Materialから生まれた各商品のことです。商品の値段は *material:price* と *itemVariant:price* によって決定されます。"} class Product def initialize(client) @client = client end # {"en"=>"get info for a Product specified by id.", "ja"=>"idを指定してProduct情報を取得します。"} # # @param product_id: {"en"=>"unique identifier of product", "ja"=>"Productの一意なID"} def info(product_id) @client.product.info(product_id) end # {"en"=>"get Products info", "ja"=>"複数のProduct情報を取得します。"} # # @param body: the object to pass as the request payload def list(body) @client.product.list(body) end end # {"en"=>"user profile", "ja"=>"ユーザのプロフィール"} class Profile def initialize(client) @client = client end end # {"en"=>"User is a Suzuri User.", "ja"=>"User(ユーザ)とは、SUZURIのユーザです。"} class User def initialize(client) @client = client end # {"en"=>"Info for existing User.", "ja"=>"idで指定したUserの情報を取得します"} # # @param user_id: {"en"=>"unique identifier of User", "ja"=>"Userの一意なID"} def info(user_id) @client.user.info(user_id) end # {"en"=>"Info for authorized User", "ja"=>"認証されたUserの情報を取得します"} def self() @client.user.self() end # {"en"=>"update authorized User", "ja"=>"認証されたUserの情報を更新します"} # # @param body: the object to pass as the request payload def update(body) @client.user.update(body) end end SCHEMA = Heroics::Schema.new(MultiJson.load(<<-'HEROICS_SCHEMA')) {"$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"} HEROICS_SCHEMA end