diff --git a/.gitignore b/.gitignore index 1c3b129..05a17cb 100644 --- a/.gitignore +++ b/.gitignore @@ -31,9 +31,9 @@ build/ # for a library or gem, you might want to ignore these files since the code is # intended to run in multiple environments; otherwise, check them in: -Gemfile.lock -.ruby-version -.ruby-gemset +# Gemfile.lock +# .ruby-version +# .ruby-gemset # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: .rvmrc diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3a253c4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,26 @@ +.ruby: &ruby + variables: + LANG: "C.UTF-8" + before_script: + - ruby -v + - bundle config set --local deployment true + - bundle install -j $(nproc) + parallel: + matrix: + - RUBY_VERSION: ['2.7', '3.0', '3.1'] + image: "ruby:$RUBY_VERSION" + cache: + paths: + - vendor/ruby + key: 'ruby-$RUBY_VERSION' + +gem: + extends: .ruby + script: + - bundle exec rspec + - bundle exec rake build + - bundle exec rake install + artifacts: + paths: + - pkg/*.gem + diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index 79b2e0d..7484ee5 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -21,5 +21,3 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md - -.gitignore diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..da8ea91 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,358 @@ +.gitignore +.gitlab-ci.yml +.openapi-generator-ignore +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +color_me_shop.gemspec +docs/CancelSaleRequest.md +docs/CategoryApi.md +docs/Customer.md +docs/CustomerApi.md +docs/Delivery.md +docs/DeliveryApi.md +docs/DeliveryChargeByPrefecture.md +docs/DeliveryDateSetting.md +docs/GetCoupon200Response.md +docs/GetCoupons200Response.md +docs/GetCoupons200ResponseShopCouponsInner.md +docs/GetCustomer200Response.md +docs/GetCustomer200ResponseMeta.md +docs/GetCustomers200Response.md +docs/GetDeliveries200Response.md +docs/GetDeliveries200ResponseDeliveriesInner.md +docs/GetDeliveries200ResponseDeliveriesInnerCharge.md +docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.md +docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner.md +docs/GetDeliveryDateSetting200Response.md +docs/GetDeliveryDateSetting200ResponseDeliveryDate.md +docs/GetDeliveryDateSetting200ResponseDeliveryDateDays.md +docs/GetDeliveryDateSetting200ResponseDeliveryDateTimes.md +docs/GetGift200Response.md +docs/GetGift200ResponseGift.md +docs/GetGift200ResponseGiftCard.md +docs/GetGift200ResponseGiftCardTypesInner.md +docs/GetGift200ResponseGiftNoshi.md +docs/GetGift200ResponseGiftNoshiTypesInner.md +docs/GetGift200ResponseGiftWrapping.md +docs/GetGift200ResponseGiftWrappingTypesInner.md +docs/GetPayments200Response.md +docs/GetPayments200ResponsePaymentsInner.md +docs/GetPayments200ResponsePaymentsInnerCard.md +docs/GetPayments200ResponsePaymentsInnerCardBrandsInner.md +docs/GetPayments200ResponsePaymentsInnerCod.md +docs/GetPayments200ResponsePaymentsInnerFinancial.md +docs/GetProductCategories200Response.md +docs/GetProductCategories200ResponseCategoriesInner.md +docs/GetProductCategories200ResponseCategoriesInnerChildrenInner.md +docs/GetProductGroups200Response.md +docs/GetProductGroups200ResponseGroupsInner.md +docs/GetProductVariants200Response.md +docs/GetProducts200Response.md +docs/GetProducts200ResponseProductsInner.md +docs/GetProducts200ResponseProductsInnerCategory.md +docs/GetProducts200ResponseProductsInnerImagesInner.md +docs/GetProducts200ResponseProductsInnerOptionsInner.md +docs/GetProducts200ResponseProductsInnerPickupsInner.md +docs/GetProducts200ResponseProductsInnerVariantsInner.md +docs/GetSale200Response.md +docs/GetSale200ResponseSale.md +docs/GetSale200ResponseSaleAllOfSegment.md +docs/GetSales200Response.md +docs/GetSales200ResponseMeta.md +docs/GetSales200ResponseSalesInner.md +docs/GetSales200ResponseSalesInnerCustomer.md +docs/GetSales200ResponseSalesInnerDetailsInner.md +docs/GetSales200ResponseSalesInnerSaleDeliveriesInner.md +docs/GetSales200ResponseSalesInnerSegment.md +docs/GetSales200ResponseSalesInnerTotals.md +docs/GetShop200Response.md +docs/GetShop200ResponseShop.md +docs/GetStocks200Response.md +docs/GetStocks200ResponseStocksInner.md +docs/GetStocks200ResponseStocksInnerImagesInner.md +docs/GiftApi.md +docs/GroupApi.md +docs/Meta.md +docs/Payment.md +docs/PaymentApi.md +docs/PostCustomers200Response.md +docs/PostCustomersRequest.md +docs/PostCustomersRequestCustomer.md +docs/PostProducts200Response.md +docs/PostProductsRequest.md +docs/PostProductsRequestProduct.md +docs/Product.md +docs/ProductApi.md +docs/ProductCategory.md +docs/ProductCategoryChild.md +docs/ProductCreateRequest.md +docs/ProductGroup.md +docs/ProductOption.md +docs/ProductPickup.md +docs/ProductUpdateRequest.md +docs/ProductVariant.md +docs/PutProductPickup200Response.md +docs/PutProductPickup200ResponsePickup.md +docs/PutProductPickupRequest.md +docs/Sale.md +docs/SaleApi.md +docs/SaleDelivery.md +docs/SaleDetail.md +docs/SendSalesMailRequest.md +docs/SendSalesMailRequestMail.md +docs/Shop.md +docs/ShopApi.md +docs/ShopCoupon.md +docs/ShopCouponApi.md +docs/StatSale200Response.md +docs/StatSale200ResponseSalesStat.md +docs/Stock.md +docs/StockApi.md +docs/UpdateProductRequest.md +docs/UpdateProductRequestProduct.md +docs/UpdateProductRequestProductStocks.md +docs/UpdateProductRequestProductStocksOneOf.md +docs/UpdateProductRequestProductVariantsInner.md +docs/UpdateProductRequestProductVariantsInnerStocks.md +docs/UpdateSale200Response.md +docs/UpdateSaleRequest.md +docs/UpdateSaleRequestSale.md +git_push.sh +lib/color_me_shop.rb +lib/color_me_shop/api/category_api.rb +lib/color_me_shop/api/customer_api.rb +lib/color_me_shop/api/delivery_api.rb +lib/color_me_shop/api/gift_api.rb +lib/color_me_shop/api/group_api.rb +lib/color_me_shop/api/payment_api.rb +lib/color_me_shop/api/product_api.rb +lib/color_me_shop/api/sale_api.rb +lib/color_me_shop/api/shop_api.rb +lib/color_me_shop/api/shop_coupon_api.rb +lib/color_me_shop/api/stock_api.rb +lib/color_me_shop/api_client.rb +lib/color_me_shop/api_error.rb +lib/color_me_shop/configuration.rb +lib/color_me_shop/models/cancel_sale_request.rb +lib/color_me_shop/models/customer.rb +lib/color_me_shop/models/delivery.rb +lib/color_me_shop/models/delivery_charge_by_prefecture.rb +lib/color_me_shop/models/delivery_date_setting.rb +lib/color_me_shop/models/get_coupon200_response.rb +lib/color_me_shop/models/get_coupons200_response.rb +lib/color_me_shop/models/get_coupons200_response_shop_coupons_inner.rb +lib/color_me_shop/models/get_customer200_response.rb +lib/color_me_shop/models/get_customer200_response_meta.rb +lib/color_me_shop/models/get_customers200_response.rb +lib/color_me_shop/models/get_deliveries200_response.rb +lib/color_me_shop/models/get_deliveries200_response_deliveries_inner.rb +lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge.rb +lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner.rb +lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner.rb +lib/color_me_shop/models/get_delivery_date_setting200_response.rb +lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date.rb +lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date_days.rb +lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date_times.rb +lib/color_me_shop/models/get_gift200_response.rb +lib/color_me_shop/models/get_gift200_response_gift.rb +lib/color_me_shop/models/get_gift200_response_gift_card.rb +lib/color_me_shop/models/get_gift200_response_gift_card_types_inner.rb +lib/color_me_shop/models/get_gift200_response_gift_noshi.rb +lib/color_me_shop/models/get_gift200_response_gift_noshi_types_inner.rb +lib/color_me_shop/models/get_gift200_response_gift_wrapping.rb +lib/color_me_shop/models/get_gift200_response_gift_wrapping_types_inner.rb +lib/color_me_shop/models/get_payments200_response.rb +lib/color_me_shop/models/get_payments200_response_payments_inner.rb +lib/color_me_shop/models/get_payments200_response_payments_inner_card.rb +lib/color_me_shop/models/get_payments200_response_payments_inner_card_brands_inner.rb +lib/color_me_shop/models/get_payments200_response_payments_inner_cod.rb +lib/color_me_shop/models/get_payments200_response_payments_inner_financial.rb +lib/color_me_shop/models/get_product_categories200_response.rb +lib/color_me_shop/models/get_product_categories200_response_categories_inner.rb +lib/color_me_shop/models/get_product_categories200_response_categories_inner_children_inner.rb +lib/color_me_shop/models/get_product_groups200_response.rb +lib/color_me_shop/models/get_product_groups200_response_groups_inner.rb +lib/color_me_shop/models/get_product_variants200_response.rb +lib/color_me_shop/models/get_products200_response.rb +lib/color_me_shop/models/get_products200_response_products_inner.rb +lib/color_me_shop/models/get_products200_response_products_inner_category.rb +lib/color_me_shop/models/get_products200_response_products_inner_images_inner.rb +lib/color_me_shop/models/get_products200_response_products_inner_options_inner.rb +lib/color_me_shop/models/get_products200_response_products_inner_pickups_inner.rb +lib/color_me_shop/models/get_products200_response_products_inner_variants_inner.rb +lib/color_me_shop/models/get_sale200_response.rb +lib/color_me_shop/models/get_sale200_response_sale.rb +lib/color_me_shop/models/get_sale200_response_sale_all_of_segment.rb +lib/color_me_shop/models/get_sales200_response.rb +lib/color_me_shop/models/get_sales200_response_meta.rb +lib/color_me_shop/models/get_sales200_response_sales_inner.rb +lib/color_me_shop/models/get_sales200_response_sales_inner_customer.rb +lib/color_me_shop/models/get_sales200_response_sales_inner_details_inner.rb +lib/color_me_shop/models/get_sales200_response_sales_inner_sale_deliveries_inner.rb +lib/color_me_shop/models/get_sales200_response_sales_inner_segment.rb +lib/color_me_shop/models/get_sales200_response_sales_inner_totals.rb +lib/color_me_shop/models/get_shop200_response.rb +lib/color_me_shop/models/get_shop200_response_shop.rb +lib/color_me_shop/models/get_stocks200_response.rb +lib/color_me_shop/models/get_stocks200_response_stocks_inner.rb +lib/color_me_shop/models/get_stocks200_response_stocks_inner_images_inner.rb +lib/color_me_shop/models/meta.rb +lib/color_me_shop/models/payment.rb +lib/color_me_shop/models/post_customers200_response.rb +lib/color_me_shop/models/post_customers_request.rb +lib/color_me_shop/models/post_customers_request_customer.rb +lib/color_me_shop/models/post_products200_response.rb +lib/color_me_shop/models/post_products_request.rb +lib/color_me_shop/models/post_products_request_product.rb +lib/color_me_shop/models/product.rb +lib/color_me_shop/models/product_category.rb +lib/color_me_shop/models/product_category_child.rb +lib/color_me_shop/models/product_create_request.rb +lib/color_me_shop/models/product_group.rb +lib/color_me_shop/models/product_option.rb +lib/color_me_shop/models/product_pickup.rb +lib/color_me_shop/models/product_update_request.rb +lib/color_me_shop/models/product_variant.rb +lib/color_me_shop/models/put_product_pickup200_response.rb +lib/color_me_shop/models/put_product_pickup200_response_pickup.rb +lib/color_me_shop/models/put_product_pickup_request.rb +lib/color_me_shop/models/sale.rb +lib/color_me_shop/models/sale_delivery.rb +lib/color_me_shop/models/sale_detail.rb +lib/color_me_shop/models/send_sales_mail_request.rb +lib/color_me_shop/models/send_sales_mail_request_mail.rb +lib/color_me_shop/models/shop.rb +lib/color_me_shop/models/shop_coupon.rb +lib/color_me_shop/models/stat_sale200_response.rb +lib/color_me_shop/models/stat_sale200_response_sales_stat.rb +lib/color_me_shop/models/stock.rb +lib/color_me_shop/models/update_product_request.rb +lib/color_me_shop/models/update_product_request_product.rb +lib/color_me_shop/models/update_product_request_product_stocks.rb +lib/color_me_shop/models/update_product_request_product_stocks_one_of.rb +lib/color_me_shop/models/update_product_request_product_variants_inner.rb +lib/color_me_shop/models/update_product_request_product_variants_inner_stocks.rb +lib/color_me_shop/models/update_sale200_response.rb +lib/color_me_shop/models/update_sale_request.rb +lib/color_me_shop/models/update_sale_request_sale.rb +lib/color_me_shop/version.rb +spec/api/category_api_spec.rb +spec/api/customer_api_spec.rb +spec/api/delivery_api_spec.rb +spec/api/gift_api_spec.rb +spec/api/group_api_spec.rb +spec/api/payment_api_spec.rb +spec/api/product_api_spec.rb +spec/api/sale_api_spec.rb +spec/api/shop_api_spec.rb +spec/api/shop_coupon_api_spec.rb +spec/api/stock_api_spec.rb +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/models/cancel_sale_request_spec.rb +spec/models/customer_spec.rb +spec/models/delivery_charge_by_prefecture_spec.rb +spec/models/delivery_date_setting_spec.rb +spec/models/delivery_spec.rb +spec/models/get_coupon200_response_spec.rb +spec/models/get_coupons200_response_shop_coupons_inner_spec.rb +spec/models/get_coupons200_response_spec.rb +spec/models/get_customer200_response_meta_spec.rb +spec/models/get_customer200_response_spec.rb +spec/models/get_customers200_response_spec.rb +spec/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner_spec.rb +spec/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner_spec.rb +spec/models/get_deliveries200_response_deliveries_inner_charge_spec.rb +spec/models/get_deliveries200_response_deliveries_inner_spec.rb +spec/models/get_deliveries200_response_spec.rb +spec/models/get_delivery_date_setting200_response_delivery_date_days_spec.rb +spec/models/get_delivery_date_setting200_response_delivery_date_spec.rb +spec/models/get_delivery_date_setting200_response_delivery_date_times_spec.rb +spec/models/get_delivery_date_setting200_response_spec.rb +spec/models/get_gift200_response_gift_card_spec.rb +spec/models/get_gift200_response_gift_card_types_inner_spec.rb +spec/models/get_gift200_response_gift_noshi_spec.rb +spec/models/get_gift200_response_gift_noshi_types_inner_spec.rb +spec/models/get_gift200_response_gift_spec.rb +spec/models/get_gift200_response_gift_wrapping_spec.rb +spec/models/get_gift200_response_gift_wrapping_types_inner_spec.rb +spec/models/get_gift200_response_spec.rb +spec/models/get_payments200_response_payments_inner_card_brands_inner_spec.rb +spec/models/get_payments200_response_payments_inner_card_spec.rb +spec/models/get_payments200_response_payments_inner_cod_spec.rb +spec/models/get_payments200_response_payments_inner_financial_spec.rb +spec/models/get_payments200_response_payments_inner_spec.rb +spec/models/get_payments200_response_spec.rb +spec/models/get_product_categories200_response_categories_inner_children_inner_spec.rb +spec/models/get_product_categories200_response_categories_inner_spec.rb +spec/models/get_product_categories200_response_spec.rb +spec/models/get_product_groups200_response_groups_inner_spec.rb +spec/models/get_product_groups200_response_spec.rb +spec/models/get_product_variants200_response_spec.rb +spec/models/get_products200_response_products_inner_category_spec.rb +spec/models/get_products200_response_products_inner_images_inner_spec.rb +spec/models/get_products200_response_products_inner_options_inner_spec.rb +spec/models/get_products200_response_products_inner_pickups_inner_spec.rb +spec/models/get_products200_response_products_inner_spec.rb +spec/models/get_products200_response_products_inner_variants_inner_spec.rb +spec/models/get_products200_response_spec.rb +spec/models/get_sale200_response_sale_all_of_segment_spec.rb +spec/models/get_sale200_response_sale_spec.rb +spec/models/get_sale200_response_spec.rb +spec/models/get_sales200_response_meta_spec.rb +spec/models/get_sales200_response_sales_inner_customer_spec.rb +spec/models/get_sales200_response_sales_inner_details_inner_spec.rb +spec/models/get_sales200_response_sales_inner_sale_deliveries_inner_spec.rb +spec/models/get_sales200_response_sales_inner_segment_spec.rb +spec/models/get_sales200_response_sales_inner_spec.rb +spec/models/get_sales200_response_sales_inner_totals_spec.rb +spec/models/get_sales200_response_spec.rb +spec/models/get_shop200_response_shop_spec.rb +spec/models/get_shop200_response_spec.rb +spec/models/get_stocks200_response_spec.rb +spec/models/get_stocks200_response_stocks_inner_images_inner_spec.rb +spec/models/get_stocks200_response_stocks_inner_spec.rb +spec/models/meta_spec.rb +spec/models/payment_spec.rb +spec/models/post_customers200_response_spec.rb +spec/models/post_customers_request_customer_spec.rb +spec/models/post_customers_request_spec.rb +spec/models/post_products200_response_spec.rb +spec/models/post_products_request_product_spec.rb +spec/models/post_products_request_spec.rb +spec/models/product_category_child_spec.rb +spec/models/product_category_spec.rb +spec/models/product_create_request_spec.rb +spec/models/product_group_spec.rb +spec/models/product_option_spec.rb +spec/models/product_pickup_spec.rb +spec/models/product_spec.rb +spec/models/product_update_request_spec.rb +spec/models/product_variant_spec.rb +spec/models/put_product_pickup200_response_pickup_spec.rb +spec/models/put_product_pickup200_response_spec.rb +spec/models/put_product_pickup_request_spec.rb +spec/models/sale_delivery_spec.rb +spec/models/sale_detail_spec.rb +spec/models/sale_spec.rb +spec/models/send_sales_mail_request_mail_spec.rb +spec/models/send_sales_mail_request_spec.rb +spec/models/shop_coupon_spec.rb +spec/models/shop_spec.rb +spec/models/stat_sale200_response_sales_stat_spec.rb +spec/models/stat_sale200_response_spec.rb +spec/models/stock_spec.rb +spec/models/update_product_request_product_spec.rb +spec/models/update_product_request_product_stocks_one_of_spec.rb +spec/models/update_product_request_product_stocks_spec.rb +spec/models/update_product_request_product_variants_inner_spec.rb +spec/models/update_product_request_product_variants_inner_stocks_spec.rb +spec/models/update_product_request_spec.rb +spec/models/update_sale200_response_spec.rb +spec/models/update_sale_request_sale_spec.rb +spec/models/update_sale_request_spec.rb +spec/spec_helper.rb diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 4395ff5..0f78c31 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +7.2.0-SNAPSHOT \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index 9bc9d34..d32b2b1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ # This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) # Automatically generated by OpenAPI Generator (https://openapi-generator.tech) AllCops: - TargetRubyVersion: 2.2 + TargetRubyVersion: 2.4 # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop # to ignore them, so only the ones explicitly set in this file are enabled. DisabledByDefault: true @@ -14,12 +14,6 @@ AllCops: Style/AndOr: Enabled: true -# Do not use braces for hash literals when they are the last argument of a -# method call. -Style/BracesAroundHashParameters: - Enabled: true - EnforcedStyle: context_dependent - # Align `when` with `case`. Layout/CaseIndentation: Enabled: true @@ -46,7 +40,7 @@ Layout/EmptyLinesAroundMethodBody: Layout/EmptyLinesAroundModuleBody: Enabled: true -Layout/FirstParameterIndentation: +Layout/FirstArgumentIndentation: Enabled: true # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. @@ -57,7 +51,7 @@ Style/HashSyntax: # extra level of indentation. Layout/IndentationConsistency: Enabled: true - EnforcedStyle: rails + EnforcedStyle: indented_internal_methods # Two spaces, no tabs (for indentation). Layout/IndentationWidth: @@ -119,11 +113,11 @@ Layout/SpaceInsideParens: # EnforcedStyle: single_quotes # Detect hard tabs, no hard tabs. -Layout/Tab: +Layout/IndentationStyle: Enabled: true # Blank lines should not have any spaces. -Layout/TrailingBlankLines: +Layout/TrailingEmptyLines: Enabled: true # No trailing whitespace. @@ -131,12 +125,12 @@ Layout/TrailingWhitespace: Enabled: false # Use quotes for string literals when they are enough. -Style/UnneededPercentQ: +Style/RedundantPercentQ: Enabled: true # Align `end` with the matching keyword or starting expression except for # assignments, where it should be aligned with the LHS. -Lint/EndAlignment: +Layout/EndAlignment: Enabled: true EnforcedStyleAlignWith: variable AutoCorrect: true diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..eab736c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: ruby +cache: bundler +rvm: + - 2.7 + - 3.0 + - 3.1 +script: + - bundle install --path vendor/bundle + - bundle exec rspec + - gem build color_me_shop.gemspec + - gem install ./color_me_shop-1.1.0.gem diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 0663c6d..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,27 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## 1.2.0.rc1 - -### Changed - -- [Support Ruby 3.0 and 3.1](https://github.com/pepabo/colormeshop-ruby/pull/10) -- [Support Ruby 3.2](https://github.com/pepabo/colormeshop-ruby/pull/11) - -### Fixed - -- [Use Addressable::URI.escape because CGI.escape is only for query params](https://github.com/pepabo/colormeshop-ruby/pull/12) - -## 1.1.1 - 2023-02-24 - -### Added - -- [get customersにlimit, offsetパラメータを追加](https://github.com/pepabo/colormeshop-ruby/pull/6) - -### Changed - -- [jsonのバージョン制約を緩和する](https://github.com/pepabo/colormeshop-ruby/pull/7) -- [一時的にRuby 2だけをサポートする](https://github.com/pepabo/colormeshop-ruby/pull/8) diff --git a/Gemfile b/Gemfile index 7690059..c2e3127 100644 --- a/Gemfile +++ b/Gemfile @@ -3,5 +3,7 @@ source 'https://rubygems.org' gemspec group :development, :test do - gem 'rake' + gem 'rake', '~> 13.0.1' + gem 'pry-byebug' + gem 'rubocop', '~> 0.66.0' end diff --git a/README.md b/README.md index f4691be..5d154fa 100644 --- a/README.md +++ b/README.md @@ -4,25 +4,27 @@ ColorMeShop - the Ruby gem for the カラーミーショップ API # カラーミーショップ API -[カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 - ## 利用手順 -はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 +### OAuthアプリケーションの登録 + +デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 + +次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 +スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 -次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 -スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 +### 認可 -その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 +カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| -|`client_id`|アプリケーション詳細画面で確認できるクライアントID| -|`response_type`|\"code\"という文字列| +|`client_id`|アプリ詳細画面で確認できるクライアントID| +|`response_type`|\"code\"を指定| |`scope`| 別表参照| -|`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| +|`redirect_uri`|アプリ登録時に入力したリダイレクトURI| -`scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 +`scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| @@ -30,21 +32,21 @@ ColorMeShop - the Ruby gem for the カラーミーショップ API |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| +|`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` -https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products +https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` -初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 -承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 +初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 -承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 +ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 -アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 -末尾のパスが認可コードになっています。 +アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 +認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE @@ -52,19 +54,20 @@ https://api.shop-pro.jp/oauth/authorize/AUTH_CODE 認可コードの有効期限は発行から10分間です。 -最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 +### 認可コードをアクセストークンに交換 + +以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| -|`client_id`|アプリケーション詳細画面に表示されているクライアントID| -|`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| +|`client_id`|アプリ詳細画面に表示されているクライアントID| +|`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| -|`grant_type`|\"authorization_code\"という文字列| -|`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| +|`grant_type`|\"authorization_code\"を指定| +|`redirect_uri`|アプリ登録時に入力したリダイレクトURI| +curlによるリクエストの例を以下に示します。 ```console -# curl での例 - $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ @@ -74,7 +77,7 @@ $ curl -X POST \\ 'https://api.shop-pro.jp/oauth/token' ``` -リクエストが成功すると、以下のようなJSONが返ってきます。 +リクエストが成功すると、以下のようなJSONが返却されます ```json { @@ -84,25 +87,23 @@ $ curl -X POST \\ } ``` -アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 +アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 -取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 +### APIの利用 -```console -# curlの例 +取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 +```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー -カラーミーショップAPI v1では - -- エラーコード -- エラーメッセージ -- ステータスコード +カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 -の配列でエラーを表現します。以下に例を示します。 +- `code` エラーコード +- `message` エラーメッセージ +- `status` ステータスコード ```json { @@ -116,13 +117,72 @@ $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.s } ``` +## 都道府県コードについて +APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。 + +
+ 都道府県コード一覧 + + |id|都道府県| + |---|---| + |1|北海道| + |2|青森県| + |3|岩手県| + |4|秋田県| + |5|宮城県| + |6|山形県| + |7|福島県| + |8|茨城県| + |9|栃木県| + |10|群馬県| + |11|埼玉県| + |12|千葉県| + |13|東京都| + |14|神奈川県| + |15|新潟県| + |16|福井県| + |17|石川県| + |18|富山県| + |19|静岡県| + |20|山梨県| + |21|長野県| + |22|愛知県| + |23|岐阜県| + |24|三重県| + |25|和歌山県| + |26|滋賀県| + |27|奈良県| + |28|京都府| + |29|大阪府| + |30|兵庫県| + |31|岡山県| + |32|広島県| + |33|鳥取県| + |34|島根県| + |35|山口県| + |36|香川県| + |37|徳島県| + |38|愛媛県| + |39|高知県| + |40|福岡県| + |41|佐賀県| + |42|長崎県| + |43|大分県| + |44|熊本県| + |45|宮崎県| + |46|鹿児島県| + |47|沖縄県| + |48|海外| + +
+ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 1.0.0 - Package version: 1.1.0 - Build package: org.openapitools.codegen.languages.RubyClientCodegen -For more information, please visit [https://shop-pro.jp/?mode=inq](https://shop-pro.jp/?mode=inq) +For more information, please visit [https://developer.shop-pro.jp](https://developer.shop-pro.jp) ## Installation @@ -139,6 +199,7 @@ Then either install the gem locally: ```shell gem install ./color_me_shop-1.1.0.gem ``` + (for development, run `gem install --dev ./color_me_shop-1.1.0.gem` to install the development dependencies) or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/). @@ -164,6 +225,7 @@ ruby -Ilib script.rb ## Getting Started Please follow the [installation](#installation) procedure and then run the following code: + ```ruby # Load the gem require 'color_me_shop' @@ -172,6 +234,8 @@ require 'color_me_shop' ColorMeShop.configure do |config| # Configure OAuth2 access token for authorization: OAuth2 config.access_token = 'YOUR ACCESS TOKEN' + # Configure a proc to get access tokens in lieu of the static access_token configuration + config.access_token_getter = -> { 'YOUR TOKEN GETTER PROC' } end api_instance = ColorMeShop::CategoryApi.new @@ -192,77 +256,148 @@ All URIs are relative to *https://api.shop-pro.jp* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*ColorMeShop::CategoryApi* | [**get_product_categories**](docs/CategoryApi.md#get_product_categories) | **GET** /v1/categories.json | 商品カテゴリー一覧を取得 -*ColorMeShop::ChargeApi* | [**activate_application_charge**](docs/ChargeApi.md#activate_application_charge) | **POST** /v1/application_charges/{applicationChargeId}/activate.json | スポット課金データをアクティベートする -*ColorMeShop::ChargeApi* | [**activate_recurring_application_charge**](docs/ChargeApi.md#activate_recurring_application_charge) | **POST** /v1/recurring_application_charges/{recurringApplicationChargeId}/activate.json | 月額課金データをアクティベートする -*ColorMeShop::ChargeApi* | [**cancel_recurring_application_charge**](docs/ChargeApi.md#cancel_recurring_application_charge) | **POST** /v1/recurring_application_charges/{recurringApplicationChargeId}/cancel.json | 月額課金データをキャンセルする -*ColorMeShop::ChargeApi* | [**get_application_charge**](docs/ChargeApi.md#get_application_charge) | **GET** /v1/application_charges/{applicationChargeId}.json | スポット課金データの取得 -*ColorMeShop::ChargeApi* | [**get_application_charges**](docs/ChargeApi.md#get_application_charges) | **GET** /v1/application_charges.json | スポット課金一覧の取得 -*ColorMeShop::ChargeApi* | [**get_recurring_application_charge**](docs/ChargeApi.md#get_recurring_application_charge) | **GET** /v1/recurring_application_charges/{recurringApplicationChargeId}.json | 月額課金データの取得 -*ColorMeShop::ChargeApi* | [**get_recurring_application_charges**](docs/ChargeApi.md#get_recurring_application_charges) | **GET** /v1/recurring_application_charges.json | 月額課金一覧の取得 -*ColorMeShop::ChargeApi* | [**post_application_charge**](docs/ChargeApi.md#post_application_charge) | **POST** /v1/application_charges.json | スポット課金データの作成 -*ColorMeShop::ChargeApi* | [**post_recurring_application_charge**](docs/ChargeApi.md#post_recurring_application_charge) | **POST** /v1/recurring_application_charges.json | 月額課金データの作成 -*ColorMeShop::CustomerApi* | [**get_customer**](docs/CustomerApi.md#get_customer) | **GET** /v1/customers/{customerId}.json | 顧客データの取得 -*ColorMeShop::CustomerApi* | [**get_customers**](docs/CustomerApi.md#get_customers) | **GET** /v1/customers.json | 顧客データのリストを取得 -*ColorMeShop::CustomerApi* | [**post_customers**](docs/CustomerApi.md#post_customers) | **POST** /v1/customers.json | 顧客データを追加 -*ColorMeShop::DeliveryApi* | [**get_deliveries**](docs/DeliveryApi.md#get_deliveries) | **GET** /v1/deliveries.json | 配送方法一覧を取得 -*ColorMeShop::DeliveryApi* | [**get_delivery_date_setting**](docs/DeliveryApi.md#get_delivery_date_setting) | **GET** /v1/deliveries/date.json | 配送日時設定を取得 -*ColorMeShop::EtcApi* | [**delete_device_token**](docs/EtcApi.md#delete_device_token) | **DELETE** /v1/device_tokens/{token}.json | デバイストークンの削除 -*ColorMeShop::GiftApi* | [**get_gift**](docs/GiftApi.md#get_gift) | **GET** /v1/gift.json | ギフト設定を取得 -*ColorMeShop::GroupApi* | [**get_product_groups**](docs/GroupApi.md#get_product_groups) | **GET** /v1/groups.json | 商品グループ一覧を取得 -*ColorMeShop::PaymentApi* | [**get_payments**](docs/PaymentApi.md#get_payments) | **GET** /v1/payments.json | 決済設定の一覧を取得 -*ColorMeShop::ProductApi* | [**delete_product_pickup**](docs/ProductApi.md#delete_product_pickup) | **DELETE** /v1/products/{productId}/pickups/{pickupType}.json | おすすめ商品情報の削除 -*ColorMeShop::ProductApi* | [**get_product**](docs/ProductApi.md#get_product) | **GET** /v1/products/{productId}.json | 商品データの取得 -*ColorMeShop::ProductApi* | [**get_products**](docs/ProductApi.md#get_products) | **GET** /v1/products.json | 商品一覧の取得 -*ColorMeShop::ProductApi* | [**post_product_pickup**](docs/ProductApi.md#post_product_pickup) | **POST** /v1/products/{productId}/pickups.json | おすすめ商品情報の追加 -*ColorMeShop::ProductApi* | [**update_product**](docs/ProductApi.md#update_product) | **PUT** /v1/products/{productId}.json | 商品データの更新 -*ColorMeShop::SaleApi* | [**cancel_sale**](docs/SaleApi.md#cancel_sale) | **PUT** /v1/sales/{saleId}/cancel.json | 受注のキャンセル -*ColorMeShop::SaleApi* | [**get_sale**](docs/SaleApi.md#get_sale) | **GET** /v1/sales/{saleId}.json | 受注データの取得 -*ColorMeShop::SaleApi* | [**get_sales**](docs/SaleApi.md#get_sales) | **GET** /v1/sales.json | 受注データのリストを取得 -*ColorMeShop::SaleApi* | [**send_sales_mail**](docs/SaleApi.md#send_sales_mail) | **POST** /v1/sales/{saleId}/mails.json | メールの送信 -*ColorMeShop::SaleApi* | [**stat_sale**](docs/SaleApi.md#stat_sale) | **GET** /v1/sales/stat.json | 売上集計の取得 -*ColorMeShop::SaleApi* | [**update_sale**](docs/SaleApi.md#update_sale) | **PUT** /v1/sales/{saleId}.json | 受注データの更新 -*ColorMeShop::ScriptApi* | [**create_script_tag**](docs/ScriptApi.md#create_script_tag) | **POST** /v1/script_tags.json | スクリプトタグの作成 -*ColorMeShop::ScriptApi* | [**delete_script_tag**](docs/ScriptApi.md#delete_script_tag) | **DELETE** /v1/script_tags/{scriptTagId}.json | スクリプトタグの削除 -*ColorMeShop::ScriptApi* | [**get_script_tag**](docs/ScriptApi.md#get_script_tag) | **GET** /v1/script_tags/{scriptTagId}.json | スクリプトタグの取得 -*ColorMeShop::ScriptApi* | [**get_script_tags**](docs/ScriptApi.md#get_script_tags) | **GET** /v1/script_tags.json | スクリプトタグの取得 -*ColorMeShop::ScriptApi* | [**update_script_tag**](docs/ScriptApi.md#update_script_tag) | **PUT** /v1/script_tags/{scriptTagId}.json | スクリプトタグの更新 -*ColorMeShop::ShopApi* | [**get_shop**](docs/ShopApi.md#get_shop) | **GET** /v1/shop.json | ショップ情報の取得 -*ColorMeShop::StockApi* | [**get_stocks**](docs/StockApi.md#get_stocks) | **GET** /v1/stocks.json | 在庫情報の取得 +*ColorMeShop::CategoryApi* | [**get_product_categories**](docs/CategoryApi.md#get_product_categories) | **GET** /v1/categories | 商品カテゴリー一覧を取得 +*ColorMeShop::CustomerApi* | [**get_customer**](docs/CustomerApi.md#get_customer) | **GET** /v1/customers/{customer_id} | 顧客データの取得 +*ColorMeShop::CustomerApi* | [**get_customers**](docs/CustomerApi.md#get_customers) | **GET** /v1/customers | 顧客データのリストを取得 +*ColorMeShop::CustomerApi* | [**post_customers**](docs/CustomerApi.md#post_customers) | **POST** /v1/customers | 顧客データを追加 +*ColorMeShop::DeliveryApi* | [**get_deliveries**](docs/DeliveryApi.md#get_deliveries) | **GET** /v1/deliveries | 配送方法一覧を取得 +*ColorMeShop::DeliveryApi* | [**get_delivery_date_setting**](docs/DeliveryApi.md#get_delivery_date_setting) | **GET** /v1/deliveries/date | 配送日時設定を取得 +*ColorMeShop::GiftApi* | [**get_gift**](docs/GiftApi.md#get_gift) | **GET** /v1/gift | ギフト設定を取得 +*ColorMeShop::GroupApi* | [**get_product_groups**](docs/GroupApi.md#get_product_groups) | **GET** /v1/groups | 商品グループ一覧を取得 +*ColorMeShop::PaymentApi* | [**get_payments**](docs/PaymentApi.md#get_payments) | **GET** /v1/payments | 決済設定の一覧を取得 +*ColorMeShop::ProductApi* | [**delete_product_pickup**](docs/ProductApi.md#delete_product_pickup) | **DELETE** /v1/products/{product_id}/pickups/{pickup_type} | おすすめ商品情報の削除 +*ColorMeShop::ProductApi* | [**get_product**](docs/ProductApi.md#get_product) | **GET** /v1/products/{product_id} | 商品データの取得 +*ColorMeShop::ProductApi* | [**get_product_variants**](docs/ProductApi.md#get_product_variants) | **GET** /v1/products/{product_id}/variants | 商品オプション一覧の取得 +*ColorMeShop::ProductApi* | [**get_products**](docs/ProductApi.md#get_products) | **GET** /v1/products | 商品一覧の取得 +*ColorMeShop::ProductApi* | [**post_product_pickup**](docs/ProductApi.md#post_product_pickup) | **POST** /v1/products/{product_id}/pickups | おすすめ商品情報の追加 +*ColorMeShop::ProductApi* | [**post_products**](docs/ProductApi.md#post_products) | **POST** /v1/products | 商品データの追加 +*ColorMeShop::ProductApi* | [**put_product_pickup**](docs/ProductApi.md#put_product_pickup) | **PUT** /v1/products/{product_id}/pickups | おすすめ商品情報の更新 +*ColorMeShop::ProductApi* | [**update_product**](docs/ProductApi.md#update_product) | **PUT** /v1/products/{product_id} | 商品データの更新 +*ColorMeShop::SaleApi* | [**cancel_sale**](docs/SaleApi.md#cancel_sale) | **PUT** /v1/sales/{sale_id}/cancel | 受注のキャンセル +*ColorMeShop::SaleApi* | [**get_sale**](docs/SaleApi.md#get_sale) | **GET** /v1/sales/{sale_id} | 受注データの取得 +*ColorMeShop::SaleApi* | [**get_sales**](docs/SaleApi.md#get_sales) | **GET** /v1/sales | 受注データのリストを取得 +*ColorMeShop::SaleApi* | [**send_sales_mail**](docs/SaleApi.md#send_sales_mail) | **POST** /v1/sales/{sale_id}/mails | メールの送信 +*ColorMeShop::SaleApi* | [**stat_sale**](docs/SaleApi.md#stat_sale) | **GET** /v1/sales/stat | 売上集計の取得 +*ColorMeShop::SaleApi* | [**update_sale**](docs/SaleApi.md#update_sale) | **PUT** /v1/sales/{sale_id} | 受注データの更新 +*ColorMeShop::ShopApi* | [**get_shop**](docs/ShopApi.md#get_shop) | **GET** /v1/shop | ショップ情報の取得 +*ColorMeShop::ShopCouponApi* | [**get_coupon**](docs/ShopCouponApi.md#get_coupon) | **GET** /v1/shop_coupons/{coupon_id} | ショップクーポンの取得 +*ColorMeShop::ShopCouponApi* | [**get_coupons**](docs/ShopCouponApi.md#get_coupons) | **GET** /v1/shop_coupons | ショップクーポン一覧取得 +*ColorMeShop::StockApi* | [**get_stocks**](docs/StockApi.md#get_stocks) | **GET** /v1/stocks | 在庫情報の取得 ## Documentation for Models - - [ColorMeShop::ApplicationCharge](docs/ApplicationCharge.md) - - [ColorMeShop::ApplicationChargeCreateResponse](docs/ApplicationChargeCreateResponse.md) + - [ColorMeShop::CancelSaleRequest](docs/CancelSaleRequest.md) - [ColorMeShop::Customer](docs/Customer.md) - [ColorMeShop::Delivery](docs/Delivery.md) - [ColorMeShop::DeliveryChargeByPrefecture](docs/DeliveryChargeByPrefecture.md) - [ColorMeShop::DeliveryDateSetting](docs/DeliveryDateSetting.md) + - [ColorMeShop::GetCoupon200Response](docs/GetCoupon200Response.md) + - [ColorMeShop::GetCoupons200Response](docs/GetCoupons200Response.md) + - [ColorMeShop::GetCoupons200ResponseShopCouponsInner](docs/GetCoupons200ResponseShopCouponsInner.md) + - [ColorMeShop::GetCustomer200Response](docs/GetCustomer200Response.md) + - [ColorMeShop::GetCustomer200ResponseMeta](docs/GetCustomer200ResponseMeta.md) + - [ColorMeShop::GetCustomers200Response](docs/GetCustomers200Response.md) + - [ColorMeShop::GetDeliveries200Response](docs/GetDeliveries200Response.md) + - [ColorMeShop::GetDeliveries200ResponseDeliveriesInner](docs/GetDeliveries200ResponseDeliveriesInner.md) + - [ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge](docs/GetDeliveries200ResponseDeliveriesInnerCharge.md) + - [ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner](docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.md) + - [ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner](docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner.md) + - [ColorMeShop::GetDeliveryDateSetting200Response](docs/GetDeliveryDateSetting200Response.md) + - [ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate](docs/GetDeliveryDateSetting200ResponseDeliveryDate.md) + - [ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays](docs/GetDeliveryDateSetting200ResponseDeliveryDateDays.md) + - [ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes](docs/GetDeliveryDateSetting200ResponseDeliveryDateTimes.md) + - [ColorMeShop::GetGift200Response](docs/GetGift200Response.md) + - [ColorMeShop::GetGift200ResponseGift](docs/GetGift200ResponseGift.md) + - [ColorMeShop::GetGift200ResponseGiftCard](docs/GetGift200ResponseGiftCard.md) + - [ColorMeShop::GetGift200ResponseGiftCardTypesInner](docs/GetGift200ResponseGiftCardTypesInner.md) + - [ColorMeShop::GetGift200ResponseGiftNoshi](docs/GetGift200ResponseGiftNoshi.md) + - [ColorMeShop::GetGift200ResponseGiftNoshiTypesInner](docs/GetGift200ResponseGiftNoshiTypesInner.md) + - [ColorMeShop::GetGift200ResponseGiftWrapping](docs/GetGift200ResponseGiftWrapping.md) + - [ColorMeShop::GetGift200ResponseGiftWrappingTypesInner](docs/GetGift200ResponseGiftWrappingTypesInner.md) + - [ColorMeShop::GetPayments200Response](docs/GetPayments200Response.md) + - [ColorMeShop::GetPayments200ResponsePaymentsInner](docs/GetPayments200ResponsePaymentsInner.md) + - [ColorMeShop::GetPayments200ResponsePaymentsInnerCard](docs/GetPayments200ResponsePaymentsInnerCard.md) + - [ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner](docs/GetPayments200ResponsePaymentsInnerCardBrandsInner.md) + - [ColorMeShop::GetPayments200ResponsePaymentsInnerCod](docs/GetPayments200ResponsePaymentsInnerCod.md) + - [ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial](docs/GetPayments200ResponsePaymentsInnerFinancial.md) + - [ColorMeShop::GetProductCategories200Response](docs/GetProductCategories200Response.md) + - [ColorMeShop::GetProductCategories200ResponseCategoriesInner](docs/GetProductCategories200ResponseCategoriesInner.md) + - [ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner](docs/GetProductCategories200ResponseCategoriesInnerChildrenInner.md) + - [ColorMeShop::GetProductGroups200Response](docs/GetProductGroups200Response.md) + - [ColorMeShop::GetProductGroups200ResponseGroupsInner](docs/GetProductGroups200ResponseGroupsInner.md) + - [ColorMeShop::GetProductVariants200Response](docs/GetProductVariants200Response.md) + - [ColorMeShop::GetProducts200Response](docs/GetProducts200Response.md) + - [ColorMeShop::GetProducts200ResponseProductsInner](docs/GetProducts200ResponseProductsInner.md) + - [ColorMeShop::GetProducts200ResponseProductsInnerCategory](docs/GetProducts200ResponseProductsInnerCategory.md) + - [ColorMeShop::GetProducts200ResponseProductsInnerImagesInner](docs/GetProducts200ResponseProductsInnerImagesInner.md) + - [ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner](docs/GetProducts200ResponseProductsInnerOptionsInner.md) + - [ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner](docs/GetProducts200ResponseProductsInnerPickupsInner.md) + - [ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner](docs/GetProducts200ResponseProductsInnerVariantsInner.md) + - [ColorMeShop::GetSale200Response](docs/GetSale200Response.md) + - [ColorMeShop::GetSale200ResponseSale](docs/GetSale200ResponseSale.md) + - [ColorMeShop::GetSale200ResponseSaleAllOfSegment](docs/GetSale200ResponseSaleAllOfSegment.md) + - [ColorMeShop::GetSales200Response](docs/GetSales200Response.md) + - [ColorMeShop::GetSales200ResponseMeta](docs/GetSales200ResponseMeta.md) + - [ColorMeShop::GetSales200ResponseSalesInner](docs/GetSales200ResponseSalesInner.md) + - [ColorMeShop::GetSales200ResponseSalesInnerCustomer](docs/GetSales200ResponseSalesInnerCustomer.md) + - [ColorMeShop::GetSales200ResponseSalesInnerDetailsInner](docs/GetSales200ResponseSalesInnerDetailsInner.md) + - [ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner](docs/GetSales200ResponseSalesInnerSaleDeliveriesInner.md) + - [ColorMeShop::GetSales200ResponseSalesInnerSegment](docs/GetSales200ResponseSalesInnerSegment.md) + - [ColorMeShop::GetSales200ResponseSalesInnerTotals](docs/GetSales200ResponseSalesInnerTotals.md) + - [ColorMeShop::GetShop200Response](docs/GetShop200Response.md) + - [ColorMeShop::GetShop200ResponseShop](docs/GetShop200ResponseShop.md) + - [ColorMeShop::GetStocks200Response](docs/GetStocks200Response.md) + - [ColorMeShop::GetStocks200ResponseStocksInner](docs/GetStocks200ResponseStocksInner.md) + - [ColorMeShop::GetStocks200ResponseStocksInnerImagesInner](docs/GetStocks200ResponseStocksInnerImagesInner.md) - [ColorMeShop::Meta](docs/Meta.md) - [ColorMeShop::Payment](docs/Payment.md) + - [ColorMeShop::PostCustomers200Response](docs/PostCustomers200Response.md) + - [ColorMeShop::PostCustomersRequest](docs/PostCustomersRequest.md) + - [ColorMeShop::PostCustomersRequestCustomer](docs/PostCustomersRequestCustomer.md) + - [ColorMeShop::PostProducts200Response](docs/PostProducts200Response.md) + - [ColorMeShop::PostProductsRequest](docs/PostProductsRequest.md) + - [ColorMeShop::PostProductsRequestProduct](docs/PostProductsRequestProduct.md) - [ColorMeShop::Product](docs/Product.md) - [ColorMeShop::ProductCategory](docs/ProductCategory.md) + - [ColorMeShop::ProductCategoryChild](docs/ProductCategoryChild.md) + - [ColorMeShop::ProductCreateRequest](docs/ProductCreateRequest.md) - [ColorMeShop::ProductGroup](docs/ProductGroup.md) - [ColorMeShop::ProductOption](docs/ProductOption.md) - [ColorMeShop::ProductPickup](docs/ProductPickup.md) - [ColorMeShop::ProductUpdateRequest](docs/ProductUpdateRequest.md) - [ColorMeShop::ProductVariant](docs/ProductVariant.md) - - [ColorMeShop::RecurringApplicationCharge](docs/RecurringApplicationCharge.md) - - [ColorMeShop::RecurringApplicationChargeCreateResponse](docs/RecurringApplicationChargeCreateResponse.md) + - [ColorMeShop::PutProductPickup200Response](docs/PutProductPickup200Response.md) + - [ColorMeShop::PutProductPickup200ResponsePickup](docs/PutProductPickup200ResponsePickup.md) + - [ColorMeShop::PutProductPickupRequest](docs/PutProductPickupRequest.md) - [ColorMeShop::Sale](docs/Sale.md) - [ColorMeShop::SaleDelivery](docs/SaleDelivery.md) - [ColorMeShop::SaleDetail](docs/SaleDetail.md) - - [ColorMeShop::ScriptTag](docs/ScriptTag.md) + - [ColorMeShop::SendSalesMailRequest](docs/SendSalesMailRequest.md) + - [ColorMeShop::SendSalesMailRequestMail](docs/SendSalesMailRequestMail.md) - [ColorMeShop::Shop](docs/Shop.md) + - [ColorMeShop::ShopCoupon](docs/ShopCoupon.md) + - [ColorMeShop::StatSale200Response](docs/StatSale200Response.md) + - [ColorMeShop::StatSale200ResponseSalesStat](docs/StatSale200ResponseSalesStat.md) - [ColorMeShop::Stock](docs/Stock.md) + - [ColorMeShop::UpdateProductRequest](docs/UpdateProductRequest.md) + - [ColorMeShop::UpdateProductRequestProduct](docs/UpdateProductRequestProduct.md) + - [ColorMeShop::UpdateProductRequestProductStocks](docs/UpdateProductRequestProductStocks.md) + - [ColorMeShop::UpdateProductRequestProductStocksOneOf](docs/UpdateProductRequestProductStocksOneOf.md) + - [ColorMeShop::UpdateProductRequestProductVariantsInner](docs/UpdateProductRequestProductVariantsInner.md) + - [ColorMeShop::UpdateProductRequestProductVariantsInnerStocks](docs/UpdateProductRequestProductVariantsInnerStocks.md) + - [ColorMeShop::UpdateSale200Response](docs/UpdateSale200Response.md) + - [ColorMeShop::UpdateSaleRequest](docs/UpdateSaleRequest.md) + - [ColorMeShop::UpdateSaleRequestSale](docs/UpdateSaleRequestSale.md) ## Documentation for Authorization +Authentication schemes defined for the API: ### OAuth2 + - **Type**: OAuth - **Flow**: accessCode - **Authorization URL**: https://api.shop-pro.jp/oauth/authorize @@ -271,4 +406,5 @@ Class | Method | HTTP request | Description - write_products: 在庫データを更新 - read_sales: 受注・顧客データを参照 - write_sales: 受注データを更新 + - read_shop_coupons: ショップクーポンを参照 diff --git a/color_me_shop.gemspec b/color_me_shop.gemspec index 87a7e4a..812dbcd 100644 --- a/color_me_shop.gemspec +++ b/color_me_shop.gemspec @@ -1,3 +1,17 @@ +# -*- encoding: utf-8 -*- + +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + $:.push File.expand_path("../lib", __FILE__) require "color_me_shop/version" @@ -10,16 +24,13 @@ Gem::Specification.new do |s| s.homepage = "https://shop-pro.jp" s.summary = "カラーミーショップ API Ruby Gem" s.description = "カラーミーショップAPIのRubyクライアントです。" - s.license = 'MIT' - s.required_ruby_version = ">= 2.6" + s.license = "MIT" + s.required_ruby_version = ">= 2.7" + s.metadata = {} - s.add_runtime_dependency 'addressable' s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1' - s.add_runtime_dependency 'json' s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0' - s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1' - s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3' s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? } s.test_files = `find spec/*`.split("\n") diff --git a/docs/ApplicationCharge.md b/docs/ApplicationCharge.md deleted file mode 100644 index e2719de..0000000 --- a/docs/ApplicationCharge.md +++ /dev/null @@ -1,15 +0,0 @@ -# ColorMeShop::ApplicationCharge - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 課金ID | [optional] -**account_id** | **String** | アカウントID | [optional] -**oauth_application_id** | **Integer** | アプリケーションID | [optional] -**application_charge_plan_id** | **Integer** | 課金プランID | [optional] -**return_url** | **String** | ショップオーナー様が課金の許可/拒否を行った後に遷移するURL | [optional] -**status** | **String** | ステータス | [optional] -**make_date** | **Integer** | 作成日時 | [optional] -**update_date** | **Integer** | 更新日時 | [optional] - - diff --git a/docs/ApplicationChargeCreateResponse.md b/docs/ApplicationChargeCreateResponse.md deleted file mode 100644 index 7c6b8d3..0000000 --- a/docs/ApplicationChargeCreateResponse.md +++ /dev/null @@ -1,16 +0,0 @@ -# ColorMeShop::ApplicationChargeCreateResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 課金ID | [optional] -**account_id** | **String** | アカウントID | [optional] -**oauth_application_id** | **Integer** | アプリケーションID | [optional] -**application_charge_plan_id** | **Integer** | 課金プランID | [optional] -**return_url** | **String** | ショップオーナー様が課金の許可/拒否を行った後に遷移するURL | [optional] -**confirmation_url** | **String** | ショップオーナー様が課金のOK/NGを行う確認画面ページのURLです。 URLには課金IDとsignatureを含んでいます。 | [optional] -**status** | **String** | ステータス | [optional] -**make_date** | **Integer** | 作成日時 | [optional] -**update_date** | **Integer** | 更新日時 | [optional] - - diff --git a/docs/CancelSaleRequest.md b/docs/CancelSaleRequest.md new file mode 100644 index 0000000..79f120d --- /dev/null +++ b/docs/CancelSaleRequest.md @@ -0,0 +1,18 @@ +# ColorMeShop::CancelSaleRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **restock** | **Boolean** | `true`の場合、在庫管理している商品について、購入された分の在庫数を充当する | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::CancelSaleRequest.new( + restock: null +) +``` + diff --git a/docs/CategoryApi.md b/docs/CategoryApi.md index 29a98e4..fed0416 100644 --- a/docs/CategoryApi.md +++ b/docs/CategoryApi.md @@ -2,19 +2,23 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_product_categories**](CategoryApi.md#get_product_categories) | **GET** /v1/categories.json | 商品カテゴリー一覧を取得 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_product_categories**](CategoryApi.md#get_product_categories) | **GET** /v1/categories | 商品カテゴリー一覧を取得 | -# **get_product_categories** -> Object get_product_categories +## get_product_categories + +> get_product_categories 商品カテゴリー一覧を取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -25,20 +29,39 @@ end api_instance = ColorMeShop::CategoryApi.new begin - #商品カテゴリー一覧を取得 + # 商品カテゴリー一覧を取得 result = api_instance.get_product_categories p result rescue ColorMeShop::ApiError => e - puts "Exception when calling CategoryApi->get_product_categories: #{e}" + puts "Error when calling CategoryApi->get_product_categories: #{e}" +end +``` + +#### Using the get_product_categories_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_product_categories_with_http_info + +```ruby +begin + # 商品カテゴリー一覧を取得 + data, status_code, headers = api_instance.get_product_categories_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling CategoryApi->get_product_categories_with_http_info: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type -**Object** +[**GetProductCategories200Response**](GetProductCategories200Response.md) ### Authorization @@ -46,8 +69,6 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json - - +- **Content-Type**: Not defined +- **Accept**: application/json diff --git a/docs/ChargeApi.md b/docs/ChargeApi.md deleted file mode 100644 index a252a79..0000000 --- a/docs/ChargeApi.md +++ /dev/null @@ -1,475 +0,0 @@ -# ColorMeShop::ChargeApi - -All URIs are relative to *https://api.shop-pro.jp* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**activate_application_charge**](ChargeApi.md#activate_application_charge) | **POST** /v1/application_charges/{applicationChargeId}/activate.json | スポット課金データをアクティベートする -[**activate_recurring_application_charge**](ChargeApi.md#activate_recurring_application_charge) | **POST** /v1/recurring_application_charges/{recurringApplicationChargeId}/activate.json | 月額課金データをアクティベートする -[**cancel_recurring_application_charge**](ChargeApi.md#cancel_recurring_application_charge) | **POST** /v1/recurring_application_charges/{recurringApplicationChargeId}/cancel.json | 月額課金データをキャンセルする -[**get_application_charge**](ChargeApi.md#get_application_charge) | **GET** /v1/application_charges/{applicationChargeId}.json | スポット課金データの取得 -[**get_application_charges**](ChargeApi.md#get_application_charges) | **GET** /v1/application_charges.json | スポット課金一覧の取得 -[**get_recurring_application_charge**](ChargeApi.md#get_recurring_application_charge) | **GET** /v1/recurring_application_charges/{recurringApplicationChargeId}.json | 月額課金データの取得 -[**get_recurring_application_charges**](ChargeApi.md#get_recurring_application_charges) | **GET** /v1/recurring_application_charges.json | 月額課金一覧の取得 -[**post_application_charge**](ChargeApi.md#post_application_charge) | **POST** /v1/application_charges.json | スポット課金データの作成 -[**post_recurring_application_charge**](ChargeApi.md#post_recurring_application_charge) | **POST** /v1/recurring_application_charges.json | 月額課金データの作成 - - -# **activate_application_charge** -> Object activate_application_charge(application_charge_id) - -スポット課金データをアクティベートする - -スポット課金データをアクティベートするAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -application_charge_id = 56 # Integer | - -begin - #スポット課金データをアクティベートする - result = api_instance.activate_application_charge(application_charge_id) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->activate_application_charge: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **application_charge_id** | **Integer**| | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **activate_recurring_application_charge** -> Object activate_recurring_application_charge(recurring_application_charge_id) - -月額課金データをアクティベートする - -月額課金データをアクティベートするAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -recurring_application_charge_id = 56 # Integer | - -begin - #月額課金データをアクティベートする - result = api_instance.activate_recurring_application_charge(recurring_application_charge_id) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->activate_recurring_application_charge: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **recurring_application_charge_id** | **Integer**| | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **cancel_recurring_application_charge** -> Object cancel_recurring_application_charge(recurring_application_charge_id) - -月額課金データをキャンセルする - -月額課金データをキャンセルするAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -recurring_application_charge_id = 56 # Integer | - -begin - #月額課金データをキャンセルする - result = api_instance.cancel_recurring_application_charge(recurring_application_charge_id) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->cancel_recurring_application_charge: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **recurring_application_charge_id** | **Integer**| | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **get_application_charge** -> Object get_application_charge(application_charge_id) - -スポット課金データの取得 - -スポット課金データを取得するAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -application_charge_id = 56 # Integer | - -begin - #スポット課金データの取得 - result = api_instance.get_application_charge(application_charge_id) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->get_application_charge: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **application_charge_id** | **Integer**| | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **get_application_charges** -> Object get_application_charges(opts) - -スポット課金一覧の取得 - -スポット課金一覧を取得するAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -opts = { - limit: 56, # Integer | レスポンスの件数を指定します。指定がない場合は10件。最大50件。 - since_id: 56 # Integer | 指定した課金ID以降のデータを返します。 -} - -begin - #スポット課金一覧の取得 - result = api_instance.get_application_charges(opts) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->get_application_charges: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **Integer**| レスポンスの件数を指定します。指定がない場合は10件。最大50件。 | [optional] - **since_id** | **Integer**| 指定した課金ID以降のデータを返します。 | [optional] - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **get_recurring_application_charge** -> Object get_recurring_application_charge(recurring_application_charge_id) - -月額課金データの取得 - -月額課金データを取得するAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -recurring_application_charge_id = 56 # Integer | - -begin - #月額課金データの取得 - result = api_instance.get_recurring_application_charge(recurring_application_charge_id) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->get_recurring_application_charge: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **recurring_application_charge_id** | **Integer**| | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **get_recurring_application_charges** -> Object get_recurring_application_charges(opts) - -月額課金一覧の取得 - -月額課金一覧を取得するAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -opts = { - limit: 56, # Integer | レスポンスの件数を指定します。指定がない場合は10件。最大50件。 - since_id: 56 # Integer | 指定した課金ID以降のデータを返します。 -} - -begin - #月額課金一覧の取得 - result = api_instance.get_recurring_application_charges(opts) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->get_recurring_application_charges: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **Integer**| レスポンスの件数を指定します。指定がない場合は10件。最大50件。 | [optional] - **since_id** | **Integer**| 指定した課金ID以降のデータを返します。 | [optional] - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **post_application_charge** -> Object post_application_charge(unknown_base_type) - -スポット課金データの作成 - -スポット課金データを作成するAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -unknown_base_type = ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | - -begin - #スポット課金データの作成 - result = api_instance.post_application_charge(unknown_base_type) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->post_application_charge: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - - -# **post_recurring_application_charge** -> Object post_recurring_application_charge(unknown_base_type) - -月額課金データの作成 - -月額課金データを作成するAPIです。 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ChargeApi.new -unknown_base_type = ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | - -begin - #月額課金データの作成 - result = api_instance.post_recurring_application_charge(unknown_base_type) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ChargeApi->post_recurring_application_charge: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - - diff --git a/docs/Customer.md b/docs/Customer.md index af2fe84..d57a586 100644 --- a/docs/Customer.md +++ b/docs/Customer.md @@ -1,27 +1,66 @@ # ColorMeShop::Customer ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 顧客ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**name** | **String** | 顧客の名前 | [optional] -**furigana** | **String** | 名前のフリガナ | [optional] -**hojin** | **String** | 法人名 | [optional] -**busho** | **String** | 部署名 | [optional] -**sex** | **String** | 性別 | [optional] -**postal** | **String** | 郵便番号 | [optional] -**pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47 | [optional] -**pref_name** | **String** | 都道府県名 | [optional] -**address1** | **String** | 住所1 | [optional] -**address2** | **String** | 住所2 | [optional] -**mail** | **String** | メールアドレス | [optional] -**tel** | **String** | 電話番号 | [optional] -**fax** | **String** | FAX番号 | [optional] -**tel_mobile** | **String** | 携帯電話番号 | [optional] -**memo** | **String** | 備考 | [optional] -**points** | **Integer** | 保有ポイント数 | [optional] -**member** | **BOOLEAN** | 会員登録済みであるか否か | [optional] -**sales_count** | **Integer** | これまでの購入回数 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 顧客ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 顧客の名前 | [optional] | +| **furigana** | **String** | 名前のフリガナ | [optional] | +| **hojin** | **String** | 法人名 | [optional] | +| **busho** | **String** | 部署名 | [optional] | +| **sex** | **String** | 性別 | [optional] | +| **birthday** | **String** | 誕生日 | [optional] | +| **postal** | **String** | 郵便番号 | [optional] | +| **pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47 | [optional] | +| **pref_name** | **String** | 都道府県名 | [optional] | +| **address1** | **String** | 住所1 | [optional] | +| **address2** | **String** | 住所2 | [optional] | +| **mail** | **String** | メールアドレス | [optional] | +| **tel** | **String** | 電話番号 | [optional] | +| **fax** | **String** | FAX番号 | [optional] | +| **tel_mobile** | **String** | 携帯電話番号 | [optional] | +| **other** | **String** | 備考 | [optional] | +| **points** | **Integer** | 保有ポイント数 | [optional] | +| **member** | **Boolean** | 会員登録済みであるか否か | [optional] | +| **sales_count** | **Integer** | これまでの購入回数 | [optional] | +| **receive_mail_magazine** | **Boolean** | メルマガ受信可否 | [optional] | +| **answer_free_form1** | **String** | フリー項目1の入力内容 | [optional] | +| **answer_free_form2** | **String** | フリー項目2の入力内容 | [optional] | +| **answer_free_form3** | **String** | フリー項目3の入力内容 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::Customer.new( + id: 998273, + account_id: PA01234567, + name: カラーミー太郎, + furigana: カラーミータロウ, + hojin: GMOペパボ株式会社, + busho: EC事業部, + sex: male, + birthday: 1999-01-01, + postal: 1578512, + pref_id: 13, + pref_name: 東京都, + address1: 渋谷区桜丘町26-1, + address2: セルリアンタワー, + mail: example@pepabo.com, + tel: null, + fax: null, + tel_mobile: 080-1234-1234, + other: null, + points: 216, + member: true, + sales_count: 3, + receive_mail_magazine: true, + answer_free_form1: これはフリー項目1の入力内容です, + answer_free_form2: これはフリー項目2の入力内容です, + answer_free_form3: これはフリー項目3の入力内容です +) +``` diff --git a/docs/CustomerApi.md b/docs/CustomerApi.md index ee61bf0..4cc7c19 100644 --- a/docs/CustomerApi.md +++ b/docs/CustomerApi.md @@ -2,21 +2,25 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_customer**](CustomerApi.md#get_customer) | **GET** /v1/customers/{customerId}.json | 顧客データの取得 -[**get_customers**](CustomerApi.md#get_customers) | **GET** /v1/customers.json | 顧客データのリストを取得 -[**post_customers**](CustomerApi.md#post_customers) | **POST** /v1/customers.json | 顧客データを追加 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_customer**](CustomerApi.md#get_customer) | **GET** /v1/customers/{customer_id} | 顧客データの取得 | +| [**get_customers**](CustomerApi.md#get_customers) | **GET** /v1/customers | 顧客データのリストを取得 | +| [**post_customers**](CustomerApi.md#post_customers) | **POST** /v1/customers | 顧客データを追加 | -# **get_customer** -> Object get_customer(customer_id) +## get_customer + +> get_customer(customer_id) 顧客データの取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -28,23 +32,41 @@ api_instance = ColorMeShop::CustomerApi.new customer_id = 56 # Integer | begin - #顧客データの取得 + # 顧客データの取得 result = api_instance.get_customer(customer_id) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling CustomerApi->get_customer: #{e}" + puts "Error when calling CustomerApi->get_customer: #{e}" +end +``` + +#### Using the get_customer_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_customer_with_http_info(customer_id) + +```ruby +begin + # 顧客データの取得 + data, status_code, headers = api_instance.get_customer_with_http_info(customer_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling CustomerApi->get_customer_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **customer_id** | **Integer**| | +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer_id** | **Integer** | | | ### Return type -**Object** +[**GetCustomer200Response**](GetCustomer200Response.md) ### Authorization @@ -52,19 +74,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## get_customers -# **get_customers** -> Object get_customers(opts) +> get_customers(opts) 顧客データのリストを取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -76,45 +101,71 @@ api_instance = ColorMeShop::CustomerApi.new opts = { ids: 'ids_example', # String | 顧客IDで検索。カンマ区切りで複数指定可能 name: 'name_example', # String | 顧客名で部分一致検索 - furigana: 'furigana_example', # String | 顧客フリガナがで部分一致検索 + furigana: 'furigana_example', # String | 顧客フリガナで部分一致検索 mail: 'mail_example', # String | 顧客メールアドレスで部分一致検索 postal: 'postal_example', # String | 顧客の郵便番号で部分一致検索 tel: 'tel_example', # String | 顧客の電話番号で部分一致検索 - mobile: true, # BOOLEAN | `true`なら会員登録済みの顧客から検索 + sex: 'male', # String | 顧客の性別で検索 - `male`: 男性 - `female`: 女性 + member: true, # Boolean | `true`なら会員登録済みの顧客から検索 + receive_mail_magazine: true, # Boolean | メルマガ受信可否で検索 make_date_min: 'make_date_min_example', # String | 指定日時以降に登録された顧客から検索 make_date_max: 'make_date_max_example', # String | 指定日時以前に登録された顧客から検索 update_date_min: 'update_date_min_example', # String | 指定日時以降に更新された顧客から検索 - update_date_max: 'update_date_max_example' # String | 指定日時以降に更新された顧客から検索 + update_date_max: 'update_date_max_example', # String | 指定日時以前に更新された顧客から検索 + limit: 56, # Integer | レスポンスの件数を指定。指定がない場合は10。最大100 + offset: 56 # Integer | 指定した数値+1件目以降のデータを返す } begin - #顧客データのリストを取得 + # 顧客データのリストを取得 result = api_instance.get_customers(opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling CustomerApi->get_customers: #{e}" + puts "Error when calling CustomerApi->get_customers: #{e}" +end +``` + +#### Using the get_customers_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_customers_with_http_info(opts) + +```ruby +begin + # 顧客データのリストを取得 + data, status_code, headers = api_instance.get_customers_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling CustomerApi->get_customers_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ids** | **String**| 顧客IDで検索。カンマ区切りで複数指定可能 | [optional] - **name** | **String**| 顧客名で部分一致検索 | [optional] - **furigana** | **String**| 顧客フリガナがで部分一致検索 | [optional] - **mail** | **String**| 顧客メールアドレスで部分一致検索 | [optional] - **postal** | **String**| 顧客の郵便番号で部分一致検索 | [optional] - **tel** | **String**| 顧客の電話番号で部分一致検索 | [optional] - **mobile** | **BOOLEAN**| `true`なら会員登録済みの顧客から検索 | [optional] - **make_date_min** | **String**| 指定日時以降に登録された顧客から検索 | [optional] - **make_date_max** | **String**| 指定日時以前に登録された顧客から検索 | [optional] - **update_date_min** | **String**| 指定日時以降に更新された顧客から検索 | [optional] - **update_date_max** | **String**| 指定日時以降に更新された顧客から検索 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **String** | 顧客IDで検索。カンマ区切りで複数指定可能 | [optional] | +| **name** | **String** | 顧客名で部分一致検索 | [optional] | +| **furigana** | **String** | 顧客フリガナで部分一致検索 | [optional] | +| **mail** | **String** | 顧客メールアドレスで部分一致検索 | [optional] | +| **postal** | **String** | 顧客の郵便番号で部分一致検索 | [optional] | +| **tel** | **String** | 顧客の電話番号で部分一致検索 | [optional] | +| **sex** | **String** | 顧客の性別で検索 - `male`: 男性 - `female`: 女性 | [optional] | +| **member** | **Boolean** | `true`なら会員登録済みの顧客から検索 | [optional] | +| **receive_mail_magazine** | **Boolean** | メルマガ受信可否で検索 | [optional] | +| **make_date_min** | **String** | 指定日時以降に登録された顧客から検索 | [optional] | +| **make_date_max** | **String** | 指定日時以前に登録された顧客から検索 | [optional] | +| **update_date_min** | **String** | 指定日時以降に更新された顧客から検索 | [optional] | +| **update_date_max** | **String** | 指定日時以前に更新された顧客から検索 | [optional] | +| **limit** | **Integer** | レスポンスの件数を指定。指定がない場合は10。最大100 | [optional] | +| **offset** | **Integer** | 指定した数値+1件目以降のデータを返す | [optional] | ### Return type -**Object** +[**GetCustomers200Response**](GetCustomers200Response.md) ### Authorization @@ -122,19 +173,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## post_customers -# **post_customers** -> Object post_customers(unknown_base_type) +> post_customers(opts) 顧客データを追加 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -143,26 +197,46 @@ ColorMeShop.configure do |config| end api_instance = ColorMeShop::CustomerApi.new -unknown_base_type = ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | +opts = { + post_customers_request: ColorMeShop::PostCustomersRequest.new # PostCustomersRequest | +} begin - #顧客データを追加 - result = api_instance.post_customers(unknown_base_type) + # 顧客データを追加 + result = api_instance.post_customers(opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling CustomerApi->post_customers: #{e}" + puts "Error when calling CustomerApi->post_customers: #{e}" +end +``` + +#### Using the post_customers_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> post_customers_with_http_info(opts) + +```ruby +begin + # 顧客データを追加 + data, status_code, headers = api_instance.post_customers_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling CustomerApi->post_customers_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **post_customers_request** | [**PostCustomersRequest**](PostCustomersRequest.md) | | [optional] | ### Return type -**Object** +[**PostCustomers200Response**](PostCustomers200Response.md) ### Authorization @@ -170,8 +244,6 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - - +- **Content-Type**: application/json +- **Accept**: application/json diff --git a/docs/Delivery.md b/docs/Delivery.md index 2f38c8e..12df246 100644 --- a/docs/Delivery.md +++ b/docs/Delivery.md @@ -1,26 +1,64 @@ # ColorMeShop::Delivery ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 配送方法ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**name** | **String** | 配送方法名 | [optional] -**image_url** | **String** | 配送方法画像URL | [optional] -**charge_free_type** | **String** | 配送料が無料になる基準 - `not_free`: 有料 - `free`: 無料 - `free_to_limit`: 注文金額が一定以上の場合は無料 | [optional] -**charge_free_limit** | **Integer** | 配送料が無料になる金額。`charge_free_type`が`free_to_limit`の場合のみ意味を持つ | [optional] -**charge_type** | **String** | 配送料の計算方法 - `fixed`: 固定額 - `by_price`: 注文金額によって決定 - `by_area`: 配送先都道府県によって決定 - `by_weight`: 商品重量によって決定 | [optional] -**charge** | **Object** | 配送料設定の詳細。上記の`charge_free_type`や`charge_type`に基づいて、この中から配送料が決定される | [optional] -**tax_included** | **BOOLEAN** | 送料が税込み料金であるか否か | [optional] -**slip_number_use** | **BOOLEAN** | 配送伝票番号設定を使用するか否か | [optional] -**slip_number_url** | **String** | 配送伝票番号確認URL | [optional] -**memo** | **String** | 配送方法の説明 | [optional] -**memo2** | **String** | フィーチャーフォン向けショップ用の配送方法説明 | [optional] -**sort** | **Integer** | 表示順 | [optional] -**display_state** | **String** | 表示状態 | [optional] -**preferred_date_use** | **BOOLEAN** | 配送希望日を指定可能か | [optional] -**preferred_period_use** | **BOOLEAN** | 配送時間帯を指定可能か | [optional] -**make_date** | **Integer** | 配送方法作成日時 | [optional] -**update_date** | **Integer** | 配送方法更新日時 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 配送方法ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 配送方法名 | [optional] | +| **method_type** | **String** | 配送方法区分 - `other`: そのほか - `yamato`: クロネコヤマト - `yamato_pickup`: ヤマト自宅外受け取り - `sagawa`: 佐川急便 - `jp`: 日本郵便 | [optional] | +| **image_url** | **String** | 配送方法画像URL | [optional] | +| **charge_free_type** | **String** | 配送料が無料になる基準 - `not_free`: 有料 - `free`: 無料 - `free_to_limit`: 注文金額が一定以上の場合は無料 | [optional] | +| **charge_free_limit** | **Integer** | 配送料が無料になる金額。`charge_free_type`が`free_to_limit`の場合のみ意味を持つ | [optional] | +| **charge_type** | **String** | 配送料の計算方法 - `fixed`: 固定額 - `by_price`: 注文金額によって決定 - `by_area`: 配送先都道府県によって決定 - `by_weight`: 商品重量によって決定 | [optional] | +| **charge** | [**GetDeliveries200ResponseDeliveriesInnerCharge**](GetDeliveries200ResponseDeliveriesInnerCharge.md) | | [optional] | +| **tax_included** | **Boolean** | 送料が税込み料金であるか否か | [optional] | +| **slip_number_use** | **Boolean** | 配送伝票番号設定を使用するか否か | [optional] | +| **slip_number_url** | **String** | 配送伝票番号確認URL | [optional] | +| **memo** | **String** | 配送方法の説明 | [optional] | +| **memo2** | **String** | フィーチャーフォン向けショップ用の配送方法説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **display_state** | **String** | 表示状態 | [optional] | +| **preferred_date_use** | **Boolean** | 配送希望日を指定可能か | [optional] | +| **preferred_period_use** | **Boolean** | 配送時間帯を指定可能か | [optional] | +| **unavailable_payment_ids** | **Array<Integer>** | 利用不可決済方法の配列 | [optional] | +| **make_date** | **Integer** | 配送方法作成日時 | [optional] | +| **update_date** | **Integer** | 配送方法更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::Delivery.new( + id: 113922, + account_id: PA01234567, + name: メール便, + method_type: null, + image_url: null, + charge_free_type: null, + charge_free_limit: null, + charge_type: null, + charge: null, + tax_included: false, + slip_number_use: true, + slip_number_url: http://example.co.jp/okurijo-search, + memo: 申し訳ございませんが、商品の配送は日本国内のみとなります。何卒ご了承下さい。 + +Please note that we do not ship abroad. +, + memo2: ■ 申し訳ございませんが、商品の配送は日本国内のみとなります。何卒ご了承下さい。 + +■ Please note that we do not ship abroad. +, + sort: 1, + display_state: showing, + preferred_date_use: true, + preferred_period_use: false, + unavailable_payment_ids: [600001,600002], + make_date: 1465784944, + update_date: 1494496809 +) +``` diff --git a/docs/DeliveryApi.md b/docs/DeliveryApi.md index 5aa09b1..6d6f7b4 100644 --- a/docs/DeliveryApi.md +++ b/docs/DeliveryApi.md @@ -2,20 +2,24 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_deliveries**](DeliveryApi.md#get_deliveries) | **GET** /v1/deliveries.json | 配送方法一覧を取得 -[**get_delivery_date_setting**](DeliveryApi.md#get_delivery_date_setting) | **GET** /v1/deliveries/date.json | 配送日時設定を取得 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_deliveries**](DeliveryApi.md#get_deliveries) | **GET** /v1/deliveries | 配送方法一覧を取得 | +| [**get_delivery_date_setting**](DeliveryApi.md#get_delivery_date_setting) | **GET** /v1/deliveries/date | 配送日時設定を取得 | -# **get_deliveries** -> Object get_deliveries +## get_deliveries + +> get_deliveries 配送方法一覧を取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -26,20 +30,39 @@ end api_instance = ColorMeShop::DeliveryApi.new begin - #配送方法一覧を取得 + # 配送方法一覧を取得 result = api_instance.get_deliveries p result rescue ColorMeShop::ApiError => e - puts "Exception when calling DeliveryApi->get_deliveries: #{e}" + puts "Error when calling DeliveryApi->get_deliveries: #{e}" +end +``` + +#### Using the get_deliveries_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_deliveries_with_http_info + +```ruby +begin + # 配送方法一覧を取得 + data, status_code, headers = api_instance.get_deliveries_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling DeliveryApi->get_deliveries_with_http_info: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type -**Object** +[**GetDeliveries200Response**](GetDeliveries200Response.md) ### Authorization @@ -47,19 +70,22 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## get_delivery_date_setting -# **get_delivery_date_setting** -> Object get_delivery_date_setting +> get_delivery_date_setting 配送日時設定を取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -70,20 +96,39 @@ end api_instance = ColorMeShop::DeliveryApi.new begin - #配送日時設定を取得 + # 配送日時設定を取得 result = api_instance.get_delivery_date_setting p result rescue ColorMeShop::ApiError => e - puts "Exception when calling DeliveryApi->get_delivery_date_setting: #{e}" + puts "Error when calling DeliveryApi->get_delivery_date_setting: #{e}" +end +``` + +#### Using the get_delivery_date_setting_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_delivery_date_setting_with_http_info + +```ruby +begin + # 配送日時設定を取得 + data, status_code, headers = api_instance.get_delivery_date_setting_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling DeliveryApi->get_delivery_date_setting_with_http_info: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type -**Object** +[**GetDeliveryDateSetting200Response**](GetDeliveryDateSetting200Response.md) ### Authorization @@ -91,8 +136,6 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json - - +- **Content-Type**: Not defined +- **Accept**: application/json diff --git a/docs/DeliveryChargeByPrefecture.md b/docs/DeliveryChargeByPrefecture.md index 3f567d9..25686b7 100644 --- a/docs/DeliveryChargeByPrefecture.md +++ b/docs/DeliveryChargeByPrefecture.md @@ -1,10 +1,22 @@ # ColorMeShop::DeliveryChargeByPrefecture ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47、海外が48 | [optional] -**pref_name** | **String** | 都道府県名 | [optional] -**charge** | **Integer** | 配送料 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47、海外が48 | [optional] | +| **pref_name** | **String** | 都道府県名 | [optional] | +| **charge** | **Integer** | 配送料 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::DeliveryChargeByPrefecture.new( + pref_id: 13, + pref_name: 東京都, + charge: 300 +) +``` diff --git a/docs/DeliveryDateSetting.md b/docs/DeliveryDateSetting.md index 9141894..893df4a 100644 --- a/docs/DeliveryDateSetting.md +++ b/docs/DeliveryDateSetting.md @@ -1,12 +1,26 @@ # ColorMeShop::DeliveryDateSetting ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account_id** | **String** | ショップアカウントID | [optional] -**days** | **Object** | 配送希望日の設定 | [optional] -**times** | **Object** | 配送時間帯の設定 | [optional] -**make_date** | **Integer** | 配送日時設定作成日時 | [optional] -**update_date** | **Integer** | 配送日時設定更新日時 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **days** | [**GetDeliveryDateSetting200ResponseDeliveryDateDays**](GetDeliveryDateSetting200ResponseDeliveryDateDays.md) | | [optional] | +| **times** | [**GetDeliveryDateSetting200ResponseDeliveryDateTimes**](GetDeliveryDateSetting200ResponseDeliveryDateTimes.md) | | [optional] | +| **make_date** | **Integer** | 配送日時設定作成日時 | [optional] | +| **update_date** | **Integer** | 配送日時設定更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::DeliveryDateSetting.new( + account_id: PA01234567, + days: null, + times: null, + make_date: 1465784944, + update_date: 1494496809 +) +``` diff --git a/docs/EtcApi.md b/docs/EtcApi.md deleted file mode 100644 index a5c6c4f..0000000 --- a/docs/EtcApi.md +++ /dev/null @@ -1,56 +0,0 @@ -# ColorMeShop::EtcApi - -All URIs are relative to *https://api.shop-pro.jp* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete_device_token**](EtcApi.md#delete_device_token) | **DELETE** /v1/device_tokens/{token}.json | デバイストークンの削除 - - -# **delete_device_token** -> delete_device_token(token) - -デバイストークンの削除 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::EtcApi.new -token = 'token_example' # String | - -begin - #デバイストークンの削除 - api_instance.delete_device_token(token) -rescue ColorMeShop::ApiError => e - puts "Exception when calling EtcApi->delete_device_token: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **token** | **String**| | - -### Return type - -nil (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - - - diff --git a/docs/GetCoupon200Response.md b/docs/GetCoupon200Response.md new file mode 100644 index 0000000..86b8fab --- /dev/null +++ b/docs/GetCoupon200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetCoupon200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **shop_coupon** | [**GetCoupons200ResponseShopCouponsInner**](GetCoupons200ResponseShopCouponsInner.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetCoupon200Response.new( + shop_coupon: null +) +``` + diff --git a/docs/GetCoupons200Response.md b/docs/GetCoupons200Response.md new file mode 100644 index 0000000..09b06d2 --- /dev/null +++ b/docs/GetCoupons200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetCoupons200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **shop_coupons** | [**Array<GetCoupons200ResponseShopCouponsInner>**](GetCoupons200ResponseShopCouponsInner.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetCoupons200Response.new( + shop_coupons: null +) +``` + diff --git a/docs/GetCoupons200ResponseShopCouponsInner.md b/docs/GetCoupons200ResponseShopCouponsInner.md new file mode 100644 index 0000000..84582c0 --- /dev/null +++ b/docs/GetCoupons200ResponseShopCouponsInner.md @@ -0,0 +1,44 @@ +# ColorMeShop::GetCoupons200ResponseShopCouponsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | Coupon ID | [optional] | +| **name** | **String** | クーポン名 | [optional] | +| **code** | **String** | クーポンコード | [optional] | +| **coupon_type** | **String** | クーポン種別 - `amount`: 定額 - `rate`: 定率 - `delivery_charge`: 送料無料 | [optional] | +| **discount_amount** | **Integer** | 割引金額または割引率 | [optional] | +| **minimum_amount** | **Integer** | 利用最低額 | [optional] | +| **starts_at** | **Integer** | 利用開始日 | [optional] | +| **ends_at** | **Integer** | 利用終了日 | [optional] | +| **total_usage_limit** | **Integer** | 総利用可能数 | [optional] | +| **usage_limit** | **String** | ユーザ毎の利用可能数 - `indisposable`: 無制限 - `disposable`: 一度のみ | [optional] | +| **group_limit_type** | **String** | 商品グループによる制限 - `none`: 無制限 - `including`: 含む - `excluding`: 除外 | [optional] | +| **status** | **String** | クーポンの利用可否 - `unavailable`: 利用不可 - `available`: 利用可能 | [optional] | +| **created_at** | **Integer** | 作成日時 | [optional] | +| **updated_at** | **Integer** | 更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetCoupons200ResponseShopCouponsInner.new( + id: 187239, + name: 100円割引, + code: descount100, + coupon_type: null, + discount_amount: 50, + minimum_amount: 1000, + starts_at: 1465784934, + ends_at: 1465784934, + total_usage_limit: 10, + usage_limit: null, + group_limit_type: null, + status: null, + created_at: 1465784934, + updated_at: 1465784934 +) +``` + diff --git a/docs/GetCustomer200Response.md b/docs/GetCustomer200Response.md new file mode 100644 index 0000000..a0014ea --- /dev/null +++ b/docs/GetCustomer200Response.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetCustomer200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer** | [**GetSales200ResponseSalesInnerCustomer**](GetSales200ResponseSalesInnerCustomer.md) | | [optional] | +| **meta** | [**GetCustomer200ResponseMeta**](GetCustomer200ResponseMeta.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetCustomer200Response.new( + customer: null, + meta: null +) +``` + diff --git a/docs/GetCustomer200ResponseMeta.md b/docs/GetCustomer200ResponseMeta.md new file mode 100644 index 0000000..a4447bb --- /dev/null +++ b/docs/GetCustomer200ResponseMeta.md @@ -0,0 +1,22 @@ +# ColorMeShop::GetCustomer200ResponseMeta + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total** | **Integer** | | [optional] | +| **limit** | **Integer** | | [optional] | +| **offset** | **Integer** | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetCustomer200ResponseMeta.new( + total: null, + limit: null, + offset: null +) +``` + diff --git a/docs/GetCustomers200Response.md b/docs/GetCustomers200Response.md new file mode 100644 index 0000000..990a5e2 --- /dev/null +++ b/docs/GetCustomers200Response.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetCustomers200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customers** | [**Array<GetSales200ResponseSalesInnerCustomer>**](GetSales200ResponseSalesInnerCustomer.md) | | [optional] | +| **meta** | [**GetSales200ResponseMeta**](GetSales200ResponseMeta.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetCustomers200Response.new( + customers: null, + meta: null +) +``` + diff --git a/docs/GetDeliveries200Response.md b/docs/GetDeliveries200Response.md new file mode 100644 index 0000000..d537229 --- /dev/null +++ b/docs/GetDeliveries200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetDeliveries200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **deliveries** | [**Array<GetDeliveries200ResponseDeliveriesInner>**](GetDeliveries200ResponseDeliveriesInner.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetDeliveries200Response.new( + deliveries: null +) +``` + diff --git a/docs/GetDeliveries200ResponseDeliveriesInner.md b/docs/GetDeliveries200ResponseDeliveriesInner.md new file mode 100644 index 0000000..59ec7c1 --- /dev/null +++ b/docs/GetDeliveries200ResponseDeliveriesInner.md @@ -0,0 +1,64 @@ +# ColorMeShop::GetDeliveries200ResponseDeliveriesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 配送方法ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 配送方法名 | [optional] | +| **method_type** | **String** | 配送方法区分 - `other`: そのほか - `yamato`: クロネコヤマト - `yamato_pickup`: ヤマト自宅外受け取り - `sagawa`: 佐川急便 - `jp`: 日本郵便 | [optional] | +| **image_url** | **String** | 配送方法画像URL | [optional] | +| **charge_free_type** | **String** | 配送料が無料になる基準 - `not_free`: 有料 - `free`: 無料 - `free_to_limit`: 注文金額が一定以上の場合は無料 | [optional] | +| **charge_free_limit** | **Integer** | 配送料が無料になる金額。`charge_free_type`が`free_to_limit`の場合のみ意味を持つ | [optional] | +| **charge_type** | **String** | 配送料の計算方法 - `fixed`: 固定額 - `by_price`: 注文金額によって決定 - `by_area`: 配送先都道府県によって決定 - `by_weight`: 商品重量によって決定 | [optional] | +| **charge** | [**GetDeliveries200ResponseDeliveriesInnerCharge**](GetDeliveries200ResponseDeliveriesInnerCharge.md) | | [optional] | +| **tax_included** | **Boolean** | 送料が税込み料金であるか否か | [optional] | +| **slip_number_use** | **Boolean** | 配送伝票番号設定を使用するか否か | [optional] | +| **slip_number_url** | **String** | 配送伝票番号確認URL | [optional] | +| **memo** | **String** | 配送方法の説明 | [optional] | +| **memo2** | **String** | フィーチャーフォン向けショップ用の配送方法説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **display_state** | **String** | 表示状態 | [optional] | +| **preferred_date_use** | **Boolean** | 配送希望日を指定可能か | [optional] | +| **preferred_period_use** | **Boolean** | 配送時間帯を指定可能か | [optional] | +| **unavailable_payment_ids** | **Array<Integer>** | 利用不可決済方法の配列 | [optional] | +| **make_date** | **Integer** | 配送方法作成日時 | [optional] | +| **update_date** | **Integer** | 配送方法更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetDeliveries200ResponseDeliveriesInner.new( + id: 113922, + account_id: PA01234567, + name: メール便, + method_type: null, + image_url: null, + charge_free_type: null, + charge_free_limit: null, + charge_type: null, + charge: null, + tax_included: false, + slip_number_use: true, + slip_number_url: http://example.co.jp/okurijo-search, + memo: 申し訳ございませんが、商品の配送は日本国内のみとなります。何卒ご了承下さい。 + +Please note that we do not ship abroad. +, + memo2: ■ 申し訳ございませんが、商品の配送は日本国内のみとなります。何卒ご了承下さい。 + +■ Please note that we do not ship abroad. +, + sort: 1, + display_state: showing, + preferred_date_use: true, + preferred_period_use: false, + unavailable_payment_ids: [600001,600002], + make_date: 1465784944, + update_date: 1494496809 +) +``` + diff --git a/docs/GetDeliveries200ResponseDeliveriesInnerCharge.md b/docs/GetDeliveries200ResponseDeliveriesInnerCharge.md new file mode 100644 index 0000000..d1dff78 --- /dev/null +++ b/docs/GetDeliveries200ResponseDeliveriesInnerCharge.md @@ -0,0 +1,32 @@ +# ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **delivery_id** | **Integer** | 配送方法ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **charge_fixed** | **Integer** | 配送料が固定の場合の金額 | [optional] | +| **charge_ranges_by_price** | **Array<Array<Integer>>** | 配送料が変わる決済金額の区分 `[3000, 100]`であれば、3000円以下の場合、手数料は100円であることを表す | [optional] | +| **charge_max_price** | **Integer** | `charge_ranges_by_price`に設定されている区分以上の金額の場合の手数料 | [optional] | +| **charge_ranges_by_area** | [**Array<GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner>**](GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.md) | 都道府県ごとの配送料 | [optional] | +| **charge_ranges_by_weight** | **Array<Array<GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner>>** | 配送料が変わる重量の区分 以下の値の場合、 - 1000g未満の商品を青森県に届ける際の配送料は300円 - 3000g未満の商品を青森県に届ける際の配送料は500円 であることを表す。 ```json [ [ 1000, [ { \"pref_id\": 2, \"pref_name\": \"青森県\", \"charge\": 300 } ] ], [ 3000, [ { \"pref_id\": 2, \"pref_name\": \"青森県\", \"charge\": 500 } ] ] ] ``` | [optional] | +| **charge_ranges_max_weight** | [**Array<GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner>**](GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.md) | `charge_ranges_by_weight`に設定されている区分以上の重量の場合の手数料 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge.new( + delivery_id: 113922, + account_id: PA01234567, + charge_fixed: 300, + charge_ranges_by_price: [[3000,100],[5000,200]], + charge_max_price: 500, + charge_ranges_by_area: null, + charge_ranges_by_weight: null, + charge_ranges_max_weight: null +) +``` + diff --git a/docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.md b/docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.md new file mode 100644 index 0000000..b055f3d --- /dev/null +++ b/docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.md @@ -0,0 +1,22 @@ +# ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47、海外が48 | [optional] | +| **pref_name** | **String** | 都道府県名 | [optional] | +| **charge** | **Integer** | 配送料 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.new( + pref_id: 13, + pref_name: 東京都, + charge: 300 +) +``` + diff --git a/docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner.md b/docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner.md new file mode 100644 index 0000000..f6d7b66 --- /dev/null +++ b/docs/GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner.md @@ -0,0 +1,49 @@ +# ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'color_me_shop' + +ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner.openapi_one_of +# => +# [ +# :'GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner', +# :'Integer' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'color_me_shop' + +ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner.build(data) +# => # + +ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner` +- `Integer` +- `nil` (if no type matches) + diff --git a/docs/GetDeliveryDateSetting200Response.md b/docs/GetDeliveryDateSetting200Response.md new file mode 100644 index 0000000..1a0fa03 --- /dev/null +++ b/docs/GetDeliveryDateSetting200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetDeliveryDateSetting200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **delivery_date** | [**GetDeliveryDateSetting200ResponseDeliveryDate**](GetDeliveryDateSetting200ResponseDeliveryDate.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetDeliveryDateSetting200Response.new( + delivery_date: null +) +``` + diff --git a/docs/GetDeliveryDateSetting200ResponseDeliveryDate.md b/docs/GetDeliveryDateSetting200ResponseDeliveryDate.md new file mode 100644 index 0000000..a6ed70b --- /dev/null +++ b/docs/GetDeliveryDateSetting200ResponseDeliveryDate.md @@ -0,0 +1,26 @@ +# ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **days** | [**GetDeliveryDateSetting200ResponseDeliveryDateDays**](GetDeliveryDateSetting200ResponseDeliveryDateDays.md) | | [optional] | +| **times** | [**GetDeliveryDateSetting200ResponseDeliveryDateTimes**](GetDeliveryDateSetting200ResponseDeliveryDateTimes.md) | | [optional] | +| **make_date** | **Integer** | 配送日時設定作成日時 | [optional] | +| **update_date** | **Integer** | 配送日時設定更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate.new( + account_id: PA01234567, + days: null, + times: null, + make_date: 1465784944, + update_date: 1494496809 +) +``` + diff --git a/docs/GetDeliveryDateSetting200ResponseDeliveryDateDays.md b/docs/GetDeliveryDateSetting200ResponseDeliveryDateDays.md new file mode 100644 index 0000000..7ad219e --- /dev/null +++ b/docs/GetDeliveryDateSetting200ResponseDeliveryDateDays.md @@ -0,0 +1,26 @@ +# ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **enabled** | **Boolean** | 配送希望日選択が有効であるか | [optional] | +| **default** | **Integer** | デフォルトで選択される希望日。注文日からn日後の数値 | [optional] | +| **min** | **Integer** | 選択できる最も早い配送日。注文日からn日後の数値 | [optional] | +| **max** | **Integer** | 選択できる最も遅い配送日。注文日からn日後の数値 | [optional] | +| **comment** | **String** | 配送希望日に関する注意事項 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays.new( + enabled: null, + default: 2, + min: 2, + max: 7, + comment: 繁忙期は1〜2営業日遅れる場合がございます。 +) +``` + diff --git a/docs/GetDeliveryDateSetting200ResponseDeliveryDateTimes.md b/docs/GetDeliveryDateSetting200ResponseDeliveryDateTimes.md new file mode 100644 index 0000000..7a69702 --- /dev/null +++ b/docs/GetDeliveryDateSetting200ResponseDeliveryDateTimes.md @@ -0,0 +1,24 @@ +# ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **enabled** | **Boolean** | 配送時間帯選択が有効であるか | [optional] | +| **periods** | **Array<String>** | 配送時間帯の選択肢の配列 | [optional] | +| **comment** | **String** | 配送時間帯に関する注意事項 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes.new( + enabled: null, + periods: ["午前中","12時〜14時","14時〜16時"], + comment: 年末年始やお盆の時期等は、ご希望の時間に届かない場合がございます。 +ご了承下さい。 + +) +``` + diff --git a/docs/GetGift200Response.md b/docs/GetGift200Response.md new file mode 100644 index 0000000..66610cf --- /dev/null +++ b/docs/GetGift200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetGift200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **gift** | [**GetGift200ResponseGift**](GetGift200ResponseGift.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetGift200Response.new( + gift: null +) +``` + diff --git a/docs/GetGift200ResponseGift.md b/docs/GetGift200ResponseGift.md new file mode 100644 index 0000000..7b0a9ed --- /dev/null +++ b/docs/GetGift200ResponseGift.md @@ -0,0 +1,30 @@ +# ColorMeShop::GetGift200ResponseGift + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | | [optional] | +| **enabled** | **Boolean** | | [optional] | +| **noshi** | [**GetGift200ResponseGiftNoshi**](GetGift200ResponseGiftNoshi.md) | | [optional] | +| **card** | [**GetGift200ResponseGiftCard**](GetGift200ResponseGiftCard.md) | | [optional] | +| **wrapping** | [**GetGift200ResponseGiftWrapping**](GetGift200ResponseGiftWrapping.md) | | [optional] | +| **make_date** | **Integer** | | [optional] | +| **update_date** | **Integer** | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetGift200ResponseGift.new( + account_id: PA01234567, + enabled: null, + noshi: null, + card: null, + wrapping: null, + make_date: 1494496895, + update_date: 1499827564 +) +``` + diff --git a/docs/GetGift200ResponseGiftCard.md b/docs/GetGift200ResponseGiftCard.md new file mode 100644 index 0000000..baf45e2 --- /dev/null +++ b/docs/GetGift200ResponseGiftCard.md @@ -0,0 +1,24 @@ +# ColorMeShop::GetGift200ResponseGiftCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **enabled** | **Boolean** | | [optional] | +| **text_enabled** | **Boolean** | | [optional] | +| **types** | [**Array<GetGift200ResponseGiftCardTypesInner>**](GetGift200ResponseGiftCardTypesInner.md) | | [optional] | +| **comment** | **String** | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetGift200ResponseGiftCard.new( + enabled: null, + text_enabled: null, + types: null, + comment: 「ハートマーク」など、携帯の機種依存文字や絵文字は文字化けしてしまう可能性がございます。予めご了承いただけますようお願い申し上げます。 +) +``` + diff --git a/docs/GetGift200ResponseGiftCardTypesInner.md b/docs/GetGift200ResponseGiftCardTypesInner.md new file mode 100644 index 0000000..e2f0204 --- /dev/null +++ b/docs/GetGift200ResponseGiftCardTypesInner.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetGift200ResponseGiftCardTypesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | +| **charge** | **Integer** | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetGift200ResponseGiftCardTypesInner.new( + name: メッセージカード, + charge: 120 +) +``` + diff --git a/docs/GetGift200ResponseGiftNoshi.md b/docs/GetGift200ResponseGiftNoshi.md new file mode 100644 index 0000000..7ad26fe --- /dev/null +++ b/docs/GetGift200ResponseGiftNoshi.md @@ -0,0 +1,26 @@ +# ColorMeShop::GetGift200ResponseGiftNoshi + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **enabled** | **Boolean** | | [optional] | +| **text_enabled** | **Boolean** | | [optional] | +| **text_charge** | **Integer** | | [optional] | +| **types** | [**Array<GetGift200ResponseGiftNoshiTypesInner>**](GetGift200ResponseGiftNoshiTypesInner.md) | | [optional] | +| **comment** | **String** | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetGift200ResponseGiftNoshi.new( + enabled: null, + text_enabled: null, + text_charge: null, + types: null, + comment: 熨斗のお名前の印字をご希望の場合、以下の「備考欄」にてご指示ください。ご指示がない場合は、お名前の印字無しにてお届けいたします。 +) +``` + diff --git a/docs/GetGift200ResponseGiftNoshiTypesInner.md b/docs/GetGift200ResponseGiftNoshiTypesInner.md new file mode 100644 index 0000000..304c25e --- /dev/null +++ b/docs/GetGift200ResponseGiftNoshiTypesInner.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetGift200ResponseGiftNoshiTypesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | +| **charge** | **Integer** | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetGift200ResponseGiftNoshiTypesInner.new( + name: 御結婚御祝, + charge: 200 +) +``` + diff --git a/docs/GetGift200ResponseGiftWrapping.md b/docs/GetGift200ResponseGiftWrapping.md new file mode 100644 index 0000000..56e6712 --- /dev/null +++ b/docs/GetGift200ResponseGiftWrapping.md @@ -0,0 +1,22 @@ +# ColorMeShop::GetGift200ResponseGiftWrapping + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **enabled** | **Boolean** | | [optional] | +| **types** | [**Array<GetGift200ResponseGiftWrappingTypesInner>**](GetGift200ResponseGiftWrappingTypesInner.md) | | [optional] | +| **comment** | **String** | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetGift200ResponseGiftWrapping.new( + enabled: null, + types: null, + comment: ギフトに対応していない商品を合わせてご注文の場合、以下の備考欄に、ラッピング対応商品のご指示をお願いいたします。 +) +``` + diff --git a/docs/GetGift200ResponseGiftWrappingTypesInner.md b/docs/GetGift200ResponseGiftWrappingTypesInner.md new file mode 100644 index 0000000..6fceedd --- /dev/null +++ b/docs/GetGift200ResponseGiftWrappingTypesInner.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetGift200ResponseGiftWrappingTypesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | | [optional] | +| **charge** | **Integer** | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetGift200ResponseGiftWrappingTypesInner.new( + name: ギフトラッピング, + charge: 300 +) +``` + diff --git a/docs/GetPayments200Response.md b/docs/GetPayments200Response.md new file mode 100644 index 0000000..c612440 --- /dev/null +++ b/docs/GetPayments200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetPayments200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **payments** | [**Array<GetPayments200ResponsePaymentsInner>**](GetPayments200ResponsePaymentsInner.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetPayments200Response.new( + payments: null +) +``` + diff --git a/docs/GetPayments200ResponsePaymentsInner.md b/docs/GetPayments200ResponsePaymentsInner.md new file mode 100644 index 0000000..6bd318a --- /dev/null +++ b/docs/GetPayments200ResponsePaymentsInner.md @@ -0,0 +1,52 @@ +# ColorMeShop::GetPayments200ResponsePaymentsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 決済方法ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 決済名 | [optional] | +| **fee** | **Integer** | 決済手数料 | [optional] | +| **ip_code** | **String** | GMOイプシロン等との契約コード | [optional] | +| **memo** | **String** | 説明 | [optional] | +| **order_end_note** | **String** | 説明 | [optional] | +| **memo_mobile** | **String** | フィーチャーフォン向けショップ用の説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **image_url** | **String** | 決済画像URL | [optional] | +| **type** | **Integer** | 決済タイプを表す数値。 |type|決済| |---|---| |0|代引き| |1|銀行振込| |2|郵便振替| |3|クレジット(ZEUS)| |4|クロネコ@ペイメント| |5|NP後払い| |6|クレジット(イプシロン)| |7|コンビニ決済(イプシロン)| |8|カラーミークレジット| |9|その他決済| |10|ウェブマネー| |11|イーバンクデビット| |12|ネット銀行(イプシロン)| |13|電子マネー(イプシロン)| |14|ATM・コンビニ・ネット銀行決済(ペイジェント)| |15|Do-Link決済(イプシロン)| |16|ペイジー(イプシロン)| |17|後払い.com| |18|ジャパンネット銀行(送料無料キャンペーン)| |19|クロネコwebコレクト| |20|PayPal(イプシロン)| |21|Yahoo!ウォレット(イプシロン)| |22|全額ポイント利用| |23|スマートフォンキャリア決済(イプシロン)| |24|GMO PG マルチペイメントクレジットカード| |25|住信SBIネット銀行(イプシロン)| |26|GMO後払い(イプシロン)| |27|GMO後払い(GMOペイメントサービス)| |28| - | |29|ATM(ペイジー)(ペイジェント)| |30|カード(ペイジェント)| |31|コンビニ番号方式(ペイジェント)| |32|インターネットバンキング(ペイジェント)| |33|PayPal(ペイパル)| |34|SMBC GMO PAYMENTクレジットカード| |35|Amazon Pay(イプシロン)| |36|楽天ペイ(オンライン決済)| |37|銀行振込(バーチャル口座)(イプシロン)| |38|Amazon Pay(アマゾンペイ)| |39|クレジットカード(SGシステム)| |40|LINE Pay(イプシロン)| |41|PayPal Commerce Platform(ペイパル)| |42|PayPay(イプシロン)| |43|Amazon Pay V2(アマゾンペイ)| |44|Amazon Pay V2(イプシロン)| |45|Square対面決済| | [optional] | +| **display** | **Boolean** | 表示設定。`true`なら表示される | [optional] | +| **use_mobile** | **Boolean** | フィーチャーフォン向けショップでの表示設定 | [optional] | +| **make_date** | **Integer** | 決済作成日時 | [optional] | +| **update_date** | **Integer** | 決済更新日時 | [optional] | +| **cod** | [**GetPayments200ResponsePaymentsInnerCod**](GetPayments200ResponsePaymentsInnerCod.md) | | [optional] | +| **card** | [**GetPayments200ResponsePaymentsInnerCard**](GetPayments200ResponsePaymentsInnerCard.md) | | [optional] | +| **financial** | [**GetPayments200ResponsePaymentsInnerFinancial**](GetPayments200ResponsePaymentsInnerFinancial.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetPayments200ResponsePaymentsInner.new( + id: 751, + account_id: PA01234567, + name: 銀行振り込み, + fee: 300, + ip_code: 12345678, + memo: 購入後、振込口座情報をメールにて差し上げます。, + order_end_note: null, + memo_mobile: 購入後、振込口座情報をメールにて差し上げます。, + sort: 1, + image_url: null, + type: 33, + display: true, + use_mobile: true, + make_date: 1495007163, + update_date: 1495007163, + cod: null, + card: null, + financial: null +) +``` + diff --git a/docs/GetPayments200ResponsePaymentsInnerCard.md b/docs/GetPayments200ResponsePaymentsInnerCard.md new file mode 100644 index 0000000..7b4cf76 --- /dev/null +++ b/docs/GetPayments200ResponsePaymentsInnerCard.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetPayments200ResponsePaymentsInnerCard + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **brands** | [**Array<GetPayments200ResponsePaymentsInnerCardBrandsInner>**](GetPayments200ResponsePaymentsInnerCardBrandsInner.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetPayments200ResponsePaymentsInnerCard.new( + brands: null +) +``` + diff --git a/docs/GetPayments200ResponsePaymentsInnerCardBrandsInner.md b/docs/GetPayments200ResponsePaymentsInnerCardBrandsInner.md new file mode 100644 index 0000000..04e1785 --- /dev/null +++ b/docs/GetPayments200ResponsePaymentsInnerCardBrandsInner.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | ブランドID | [optional] | +| **name** | **String** | ブランド名 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner.new( + id: 2, + name: VISA +) +``` + diff --git a/docs/GetPayments200ResponsePaymentsInnerCod.md b/docs/GetPayments200ResponsePaymentsInnerCod.md new file mode 100644 index 0000000..bdb5fd6 --- /dev/null +++ b/docs/GetPayments200ResponsePaymentsInnerCod.md @@ -0,0 +1,24 @@ +# ColorMeShop::GetPayments200ResponsePaymentsInnerCod + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **changeable** | **Boolean** | 手数料が決済金額によって変わるか否か | [optional] | +| **fees** | **Array<Array<Integer>>** | 手数料が変わる決済金額の区分 `[3000, 100]`であれば、3000円以下の場合、手数料は100円であることを表す | [optional] | +| **fee_max** | **Integer** | `fees`に設定されている区分以上の金額の場合の手数料 | [optional] | +| **changeable_by_total** | **Boolean** | 手数料計算に用いる決済総額を用いるか否か - `true`: 決済総額で計算 - `false`: 商品合計額で計算 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetPayments200ResponsePaymentsInnerCod.new( + changeable: true, + fees: [[3000,100],[5000,200]], + fee_max: 500, + changeable_by_total: true +) +``` + diff --git a/docs/GetPayments200ResponsePaymentsInnerFinancial.md b/docs/GetPayments200ResponsePaymentsInnerFinancial.md new file mode 100644 index 0000000..07ee1de --- /dev/null +++ b/docs/GetPayments200ResponsePaymentsInnerFinancial.md @@ -0,0 +1,26 @@ +# ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | 金融機関名 | [optional] | +| **branch_name** | **String** | 支店名 | [optional] | +| **kouza_type** | **String** | 講座種別 - `saving`: 普通 - `checking`: 当座 | [optional] | +| **kouza_number** | **String** | 口座番号 | [optional] | +| **kouza_name** | **String** | 口座名義 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial.new( + name: サンプル銀行, + branch_name: サンプル支店, + kouza_type: saving, + kouza_number: 1234567890, + kouza_name: サンプル太郎 +) +``` + diff --git a/docs/GetProductCategories200Response.md b/docs/GetProductCategories200Response.md new file mode 100644 index 0000000..36a7e25 --- /dev/null +++ b/docs/GetProductCategories200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetProductCategories200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **categories** | [**Array<GetProductCategories200ResponseCategoriesInner>**](GetProductCategories200ResponseCategoriesInner.md) | 商品カテゴリー情報一覧 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProductCategories200Response.new( + categories: null +) +``` + diff --git a/docs/GetProductCategories200ResponseCategoriesInner.md b/docs/GetProductCategories200ResponseCategoriesInner.md new file mode 100644 index 0000000..82d62af --- /dev/null +++ b/docs/GetProductCategories200ResponseCategoriesInner.md @@ -0,0 +1,38 @@ +# ColorMeShop::GetProductCategories200ResponseCategoriesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id_big** | **Integer** | 大カテゴリーID | [optional] | +| **id_small** | **Integer** | 小カテゴリーID。大カテゴリーのことを表している場合は0 | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 商品カテゴリー名 | [optional] | +| **image_url** | **String** | 商品カテゴリー画像URL | [optional] | +| **expl** | **String** | 商品カテゴリー説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `members_only`: 会員にのみ掲載 | [optional] | +| **make_date** | **Integer** | 商品カテゴリー作成日時 | [optional] | +| **update_date** | **Integer** | 商品カテゴリー更新日時 | [optional] | +| **children** | [**Array<GetProductCategories200ResponseCategoriesInnerChildrenInner>**](GetProductCategories200ResponseCategoriesInnerChildrenInner.md) | 子カテゴリー | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProductCategories200ResponseCategoriesInner.new( + id_big: 9923, + id_small: 0, + account_id: PA01234567, + name: Tシャツ, + image_url: null, + expl: null, + sort: 2, + display_state: showing, + make_date: 1465784944, + update_date: 1494496809, + children: [] +) +``` + diff --git a/docs/GetProductCategories200ResponseCategoriesInnerChildrenInner.md b/docs/GetProductCategories200ResponseCategoriesInnerChildrenInner.md new file mode 100644 index 0000000..2a17f87 --- /dev/null +++ b/docs/GetProductCategories200ResponseCategoriesInnerChildrenInner.md @@ -0,0 +1,36 @@ +# ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id_big** | **Integer** | 大カテゴリーID | [optional] | +| **id_small** | **Integer** | 小カテゴリーID。大カテゴリーのことを表している場合は0 | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 商品カテゴリー名 | [optional] | +| **image_url** | **String** | 商品カテゴリー画像URL | [optional] | +| **expl** | **String** | 商品カテゴリー説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `members_only`: 会員にのみ掲載 | [optional] | +| **make_date** | **Integer** | 商品カテゴリー作成日時 | [optional] | +| **update_date** | **Integer** | 商品カテゴリー更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner.new( + id_big: 9923, + id_small: 0, + account_id: PA01234567, + name: Tシャツ, + image_url: null, + expl: null, + sort: 2, + display_state: showing, + make_date: 1465784944, + update_date: 1494496809 +) +``` + diff --git a/docs/GetProductGroups200Response.md b/docs/GetProductGroups200Response.md new file mode 100644 index 0000000..cbf9be0 --- /dev/null +++ b/docs/GetProductGroups200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetProductGroups200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **groups** | [**Array<GetProductGroups200ResponseGroupsInner>**](GetProductGroups200ResponseGroupsInner.md) | グループ情報一覧 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProductGroups200Response.new( + groups: null +) +``` + diff --git a/docs/GetProductGroups200ResponseGroupsInner.md b/docs/GetProductGroups200ResponseGroupsInner.md new file mode 100644 index 0000000..206989d --- /dev/null +++ b/docs/GetProductGroups200ResponseGroupsInner.md @@ -0,0 +1,32 @@ +# ColorMeShop::GetProductGroups200ResponseGroupsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 商品グループID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 商品グループ名 | [optional] | +| **image_url** | **String** | 商品グループ画像URL | [optional] | +| **expl** | **String** | 商品グループ説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **parent_group_id** | **Integer** | 親の商品グループID | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProductGroups200ResponseGroupsInner.new( + id: 9923, + account_id: PA01234567, + name: 夏物, + image_url: null, + expl: 暑い夏を涼しく乗り切る、当店イチオシの夏物衣類, + sort: 2, + display_state: showing, + parent_group_id: 9923 +) +``` + diff --git a/docs/GetProductVariants200Response.md b/docs/GetProductVariants200Response.md new file mode 100644 index 0000000..b3c7195 --- /dev/null +++ b/docs/GetProductVariants200Response.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetProductVariants200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **variants** | [**Array<GetProducts200ResponseProductsInnerVariantsInner>**](GetProducts200ResponseProductsInnerVariantsInner.md) | | [optional] | +| **meta** | [**GetSales200ResponseMeta**](GetSales200ResponseMeta.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProductVariants200Response.new( + variants: null, + meta: null +) +``` + diff --git a/docs/GetProducts200Response.md b/docs/GetProducts200Response.md new file mode 100644 index 0000000..3badeb8 --- /dev/null +++ b/docs/GetProducts200Response.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetProducts200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **products** | [**Array<GetProducts200ResponseProductsInner>**](GetProducts200ResponseProductsInner.md) | | [optional] | +| **meta** | [**GetSales200ResponseMeta**](GetSales200ResponseMeta.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProducts200Response.new( + products: null, + meta: null +) +``` + diff --git a/docs/GetProducts200ResponseProductsInner.md b/docs/GetProducts200ResponseProductsInner.md new file mode 100644 index 0000000..628a966 --- /dev/null +++ b/docs/GetProducts200ResponseProductsInner.md @@ -0,0 +1,115 @@ +# ColorMeShop::GetProducts200ResponseProductsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **id** | **Integer** | 商品ID | [optional] | +| **name** | **String** | 商品名 | [optional] | +| **stocks** | **Integer** | 在庫数 | [optional] | +| **stock_managed** | **Boolean** | 在庫管理するか否か | [optional] | +| **few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] | +| **model_number** | **String** | 型番 | [optional] | +| **category** | [**GetProducts200ResponseProductsInnerCategory**](GetProducts200ResponseProductsInnerCategory.md) | | [optional] | +| **group_ids** | **Array<Integer>** | 商品が属するグループのIDの配列 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **sales_price** | **Integer** | 販売価格 | [optional] | +| **sales_price_including_tax** | **Integer** | 消費税込販売価格 | [optional] | +| **sales_price_tax** | **Integer** | 消費税額 | [optional] | +| **price** | **Integer** | 定価 | [optional] | +| **members_price** | **Integer** | 会員価格 | [optional] | +| **members_price_including_tax** | **Integer** | 消費税込会員価格 | [optional] | +| **members_price_tax** | **Integer** | 会員価格の消費税額 | [optional] | +| **cost** | **Integer** | 原価 | [optional] | +| **delivery_charge** | **Integer** | 個別送料 | [optional] | +| **cool_charge** | **Integer** | クール便の追加料金 | [optional] | +| **unavailable_payment_ids** | **Array<Integer>** | 利用不可決済方法の配列 | [optional] | +| **unavailable_delivery_ids** | **Array<Integer>** | 利用不可配送方法の配列 | [optional] | +| **min_num** | **Integer** | 最小購入数量 | [optional] | +| **max_num** | **Integer** | 最大購入数量 | [optional] | +| **sale_start_date** | **Integer** | 掲載開始時刻 | [optional] | +| **sale_end_date** | **Integer** | 掲載終了時刻 | [optional] | +| **unit** | **String** | 単位 | [optional] | +| **weight** | **Integer** | 重量(グラム単位) | [optional] | +| **soldout_display** | **Boolean** | 売り切れているときもショップに表示するか | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **simple_expl** | **String** | 簡易説明 | [optional] | +| **expl** | **String** | 商品説明 | [optional] | +| **mobile_expl** | **String** | フィーチャーフォン向けショップの商品説明 | [optional] | +| **smartphone_expl** | **String** | スマホ向けショップの商品説明 | [optional] | +| **make_date** | **Integer** | 商品作成日時 | [optional] | +| **update_date** | **Integer** | 商品更新日時 | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **image_url** | **String** | メインの商品画像URL | [optional] | +| **mobile_image_url** | **String** | メインの商品画像のモバイル用URL | [optional] | +| **thumbnail_image_url** | **String** | メインの商品画像のサムネイルURL | [optional] | +| **images** | [**Array<GetProducts200ResponseProductsInnerImagesInner>**](GetProducts200ResponseProductsInnerImagesInner.md) | メインの商品画像以外の3つの画像に関する、PC用とモバイル用の画像URL | [optional] | +| **options** | [**Array<GetProducts200ResponseProductsInnerOptionsInner>**](GetProducts200ResponseProductsInnerOptionsInner.md) | 選択できるオプションの一覧 | [optional] | +| **variants** | [**Array<GetProducts200ResponseProductsInnerVariantsInner>**](GetProducts200ResponseProductsInnerVariantsInner.md) | オプションのバリエーション一覧 | [optional] | +| **pickups** | [**Array<GetProducts200ResponseProductsInnerPickupsInner>**](GetProducts200ResponseProductsInnerPickupsInner.md) | おすすめ商品情報 ※おすすめ商品種別が「3: 新着商品」の情報は、「[新着商品管理](https://shop-pro.jp/manual/new_item_lst)」が「手動モード」の場合のみ取得できます。 | [optional] | +| **digital_conent** | **Boolean** | デジタルコンテンツ商品かどうか | [optional] | +| **regular_purchase** | **Boolean** | 定期購入商品かどうか | [optional] | +| **tax_reduced** | **Boolean** | 軽減税率対象なら `true` | [optional] | +| **without_shipping** | **Boolean** | 配送不要商品なら `true` | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProducts200ResponseProductsInner.new( + account_id: PA01234567, + id: 1342332, + name: Tシャツ, + stocks: 20, + stock_managed: false, + few_num: 5, + model_number: T-223, + category: null, + group_ids: [5456,62098], + display_state: showing, + sales_price: 1980, + sales_price_including_tax: 2178, + sales_price_tax: 198, + price: null, + members_price: 1680, + members_price_including_tax: 1848, + members_price_tax: 168, + cost: null, + delivery_charge: null, + cool_charge: null, + unavailable_payment_ids: [600001,600002], + unavailable_delivery_ids: [400001,400002], + min_num: null, + max_num: null, + sale_start_date: null, + sale_end_date: null, + unit: null, + weight: null, + soldout_display: true, + sort: 2, + simple_expl: 素材にこだわってつくった、弊社の人気商品です。, + expl: 綿100%のこだわりTシャツです。 + +肌触りや吸水性の良さにみなさま驚かれます。弊社の人気商品です。 +, + mobile_expl: null, + smartphone_expl: null, + make_date: 1465784934, + update_date: 1494496895, + memo: , + image_url: https://img07.shop-pro.jp/XXX/XX/product/123.jpg?20130319164314, + mobile_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_mb.jpg?20130319164314, + thumbnail_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_th.jpg?20130319164314, + images: null, + options: null, + variants: null, + pickups: null, + digital_conent: false, + regular_purchase: false, + tax_reduced: false, + without_shipping: false +) +``` + diff --git a/docs/GetProducts200ResponseProductsInnerCategory.md b/docs/GetProducts200ResponseProductsInnerCategory.md new file mode 100644 index 0000000..e262ef3 --- /dev/null +++ b/docs/GetProducts200ResponseProductsInnerCategory.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetProducts200ResponseProductsInnerCategory + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id_big** | **Integer** | 大カテゴリーID | [optional] | +| **id_small** | **Integer** | 小カテゴリーID | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProducts200ResponseProductsInnerCategory.new( + id_big: 13223, + id_small: 18447 +) +``` + diff --git a/docs/GetProducts200ResponseProductsInnerImagesInner.md b/docs/GetProducts200ResponseProductsInnerImagesInner.md new file mode 100644 index 0000000..9f89b0a --- /dev/null +++ b/docs/GetProducts200ResponseProductsInnerImagesInner.md @@ -0,0 +1,22 @@ +# ColorMeShop::GetProducts200ResponseProductsInnerImagesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **src** | **String** | 画像URL | [optional] | +| **position** | **Integer** | 表示順 | [optional] | +| **mobile** | **Boolean** | モバイル用であるか否か | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProducts200ResponseProductsInnerImagesInner.new( + src: null, + position: null, + mobile: null +) +``` + diff --git a/docs/GetProducts200ResponseProductsInnerOptionsInner.md b/docs/GetProducts200ResponseProductsInnerOptionsInner.md new file mode 100644 index 0000000..d81f651 --- /dev/null +++ b/docs/GetProducts200ResponseProductsInnerOptionsInner.md @@ -0,0 +1,30 @@ +# ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | オプションID | [optional] | +| **product_id** | **Integer** | 商品ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | オプション名 | [optional] | +| **values** | **Array<String>** | オプション値の配列 | [optional] | +| **make_date** | **Integer** | オプション作成日時 | [optional] | +| **update_date** | **Integer** | オプション更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner.new( + id: 539903, + product_id: 1342332, + account_id: PA01234567, + name: 色, + values: ["赤","白"], + make_date: 1465784944, + update_date: 1494496809 +) +``` + diff --git a/docs/GetProducts200ResponseProductsInnerPickupsInner.md b/docs/GetProducts200ResponseProductsInnerPickupsInner.md new file mode 100644 index 0000000..0e28816 --- /dev/null +++ b/docs/GetProducts200ResponseProductsInnerPickupsInner.md @@ -0,0 +1,24 @@ +# ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pickup_type** | **Integer** | おすすめ商品情報種別 | [optional] | +| **order_num** | **Integer** | 商品の表示順 | [optional] | +| **make_date** | **Integer** | 作成日時 | [optional] | +| **update_date** | **Integer** | 更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner.new( + pickup_type: 0, + order_num: 0, + make_date: 1465784944, + update_date: 1494496809 +) +``` + diff --git a/docs/GetProducts200ResponseProductsInnerVariantsInner.md b/docs/GetProducts200ResponseProductsInnerVariantsInner.md new file mode 100644 index 0000000..ac378e6 --- /dev/null +++ b/docs/GetProducts200ResponseProductsInnerVariantsInner.md @@ -0,0 +1,48 @@ +# ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **Integer** | 商品ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **option1_value** | **String** | オプション1の値 | [optional] | +| **option2_value** | **String** | オプション2の値 | [optional] | +| **title** | **String** | オプション1とオプション2の名前を\" x \"で結合した表示名。オプションが1つしか設定されていない場合はそのオプションの名前に等しい | [optional] | +| **stocks** | **Integer** | 在庫数 | [optional] | +| **few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] | +| **model_number** | **String** | 型番 | [optional] | +| **option_price** | **Integer** | 販売価格 | [optional] | +| **option_price_including_tax** | **Integer** | 消費税込販売価格 | [optional] | +| **option_price_tax** | **Integer** | 消費税額 | [optional] | +| **option_members_price** | **Integer** | 会員価格 | [optional] | +| **option_members_price_including_tax** | **Integer** | 消費税込会員価格 | [optional] | +| **option_members_price_tax** | **Integer** | 会員価格の消費税額 | [optional] | +| **make_date** | **Integer** | オプション作成日時 | [optional] | +| **update_date** | **Integer** | オプション更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner.new( + product_id: 1342332, + account_id: PA01234567, + option1_value: 赤, + option2_value: S, + title: 赤 x S, + stocks: 20, + few_num: 5, + model_number: T-RED-S-223, + option_price: 1980, + option_price_including_tax: 2178, + option_price_tax: 198, + option_members_price: 100, + option_members_price_including_tax: 110, + option_members_price_tax: 10, + make_date: 1465784944, + update_date: 1494496809 +) +``` + diff --git a/docs/GetSale200Response.md b/docs/GetSale200Response.md new file mode 100644 index 0000000..c3d1957 --- /dev/null +++ b/docs/GetSale200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetSale200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sale** | [**GetSale200ResponseSale**](GetSale200ResponseSale.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSale200Response.new( + sale: null +) +``` + diff --git a/docs/GetSale200ResponseSale.md b/docs/GetSale200ResponseSale.md new file mode 100644 index 0000000..43b6ddb --- /dev/null +++ b/docs/GetSale200ResponseSale.md @@ -0,0 +1,102 @@ +# ColorMeShop::GetSale200ResponseSale + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 売上ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **make_date** | **Integer** | 受注日時 | [optional] | +| **update_date** | **Integer** | 受注更新日時 | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **payment_id** | **Integer** | 使用された決済方法ID | [optional] | +| **mobile** | **Boolean** | モバイルからの注文であるか否か | [optional] | +| **paid** | **Boolean** | 入金済みであるか否か | [optional] | +| **delivered** | **Boolean** | 発送済みである否か | [optional] | +| **canceled** | **Boolean** | キャンセル済みであるか否か | [optional] | +| **accepted_mail_state** | **String** | 受注メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **paid_mail_state** | **String** | 入金メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **delivered_mail_state** | **String** | 発送メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **accepted_mail_sent_date** | **Integer** | 受注メールの送信日時 | [optional] | +| **paid_mail_sent_date** | **Integer** | 入金メールの送信日時 | [optional] | +| **delivered_mail_sent_date** | **Integer** | 発送メールの送信日時 | [optional] | +| **point_state** | **String** | ショップポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **gmo_point_state** | **String** | GMOポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **yahoo_point_state** | **String** | Yahooポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **product_total_price** | **Integer** | 商品の合計金額 | [optional] | +| **delivery_total_charge** | **Integer** | 配送料 | [optional] | +| **fee** | **Integer** | 決済手数料 | [optional] | +| **tax** | **Integer** | 商品合計金額に対する消費税 | [optional] | +| **noshi_total_charge** | **Integer** | 熨斗料金 | [optional] | +| **card_total_charge** | **Integer** | メッセージカード料金 | [optional] | +| **wrapping_total_charge** | **Integer** | ラッピング料金 | [optional] | +| **point_discount** | **Integer** | ショップポイントによる割引額 | [optional] | +| **gmo_point_discount** | **Integer** | GMOポイントによる割引額 | [optional] | +| **other_discount** | **Integer** | その他、クーポン等による割引額 | [optional] | +| **other_discount_name** | **String** | その他割引の名称 | [optional] | +| **total_price** | **Integer** | 注文総額 | [optional] | +| **granted_points** | **Integer** | 付与されたショップポイント数 | [optional] | +| **use_points** | **Integer** | 使用されたショップポイント数 | [optional] | +| **granted_gmo_points** | **Integer** | 付与されたGMOポイント数 | [optional] | +| **use_gmo_points** | **Integer** | 使用されたGMOポイント数 | [optional] | +| **granted_yahoo_points** | **Integer** | 付与されたYahooポイント数 | [optional] | +| **use_yahoo_points** | **Integer** | 使用されたYahooポイント数 | [optional] | +| **external_order_id** | **String** | 外部システムで発行された決済識別番号 該当受注の決済が、楽天ペイ(オンライン決済)、LINE Pay、PayPal Commerce Platform、Amazon Pay、Amazon Pay V2、Square対面決済のいずれかである場合、その決済の決済識別番号を返します。 それ以外の決済に関しては空文字列を返します。 | [optional] | +| **customer** | [**GetSales200ResponseSalesInnerCustomer**](GetSales200ResponseSalesInnerCustomer.md) | | [optional] | +| **details** | [**Array<GetSales200ResponseSalesInnerDetailsInner>**](GetSales200ResponseSalesInnerDetailsInner.md) | | [optional] | +| **sale_deliveries** | [**Array<GetSales200ResponseSalesInnerSaleDeliveriesInner>**](GetSales200ResponseSalesInnerSaleDeliveriesInner.md) | | [optional] | +| **segment** | [**GetSale200ResponseSaleAllOfSegment**](GetSale200ResponseSaleAllOfSegment.md) | | [optional] | +| **totals** | [**GetSales200ResponseSalesInnerTotals**](GetSales200ResponseSalesInnerTotals.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSale200ResponseSale.new( + id: 4434233, + account_id: PAXXXXXXXX, + make_date: 1465784934, + update_date: 1494496895, + memo: null, + payment_id: 751, + mobile: false, + paid: true, + delivered: true, + canceled: false, + accepted_mail_state: null, + paid_mail_state: null, + delivered_mail_state: null, + accepted_mail_sent_date: 1363152822, + paid_mail_sent_date: 1363153288, + delivered_mail_sent_date: 1363154591, + point_state: null, + gmo_point_state: null, + yahoo_point_state: null, + product_total_price: 1000, + delivery_total_charge: 350, + fee: 300, + tax: 80, + noshi_total_charge: 0, + card_total_charge: 200, + wrapping_total_charge: 0, + point_discount: 0, + gmo_point_discount: 0, + other_discount: 0, + other_discount_name: , + total_price: 1930, + granted_points: 100, + use_points: 0, + granted_gmo_points: 0, + use_gmo_points: 0, + granted_yahoo_points: 0, + use_yahoo_points: 0, + external_order_id: ABC0123456789, + customer: null, + details: null, + sale_deliveries: null, + segment: null, + totals: null +) +``` + diff --git a/docs/GetSale200ResponseSaleAllOfSegment.md b/docs/GetSale200ResponseSaleAllOfSegment.md new file mode 100644 index 0000000..41f1836 --- /dev/null +++ b/docs/GetSale200ResponseSaleAllOfSegment.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetSale200ResponseSaleAllOfSegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **siblings_sale_ids** | **Array<Integer>** | 分割された受注ID | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSale200ResponseSaleAllOfSegment.new( + siblings_sale_ids: [4434233,4434234] +) +``` + diff --git a/docs/GetSales200Response.md b/docs/GetSales200Response.md new file mode 100644 index 0000000..8221df2 --- /dev/null +++ b/docs/GetSales200Response.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetSales200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sales** | [**Array<GetSales200ResponseSalesInner>**](GetSales200ResponseSalesInner.md) | | [optional] | +| **meta** | [**GetSales200ResponseMeta**](GetSales200ResponseMeta.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSales200Response.new( + sales: null, + meta: null +) +``` + diff --git a/docs/GetSales200ResponseMeta.md b/docs/GetSales200ResponseMeta.md new file mode 100644 index 0000000..23b000a --- /dev/null +++ b/docs/GetSales200ResponseMeta.md @@ -0,0 +1,22 @@ +# ColorMeShop::GetSales200ResponseMeta + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total** | **Integer** | トータルの件数 | [optional] | +| **limit** | **Integer** | 実効limit | [optional] | +| **offset** | **Integer** | 実効offset | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSales200ResponseMeta.new( + total: 300, + limit: 50, + offset: 200 +) +``` + diff --git a/docs/GetSales200ResponseSalesInner.md b/docs/GetSales200ResponseSalesInner.md new file mode 100644 index 0000000..207424e --- /dev/null +++ b/docs/GetSales200ResponseSalesInner.md @@ -0,0 +1,102 @@ +# ColorMeShop::GetSales200ResponseSalesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 売上ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **make_date** | **Integer** | 受注日時 | [optional] | +| **update_date** | **Integer** | 受注更新日時 | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **payment_id** | **Integer** | 使用された決済方法ID | [optional] | +| **mobile** | **Boolean** | モバイルからの注文であるか否か | [optional] | +| **paid** | **Boolean** | 入金済みであるか否か | [optional] | +| **delivered** | **Boolean** | 発送済みである否か | [optional] | +| **canceled** | **Boolean** | キャンセル済みであるか否か | [optional] | +| **accepted_mail_state** | **String** | 受注メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **paid_mail_state** | **String** | 入金メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **delivered_mail_state** | **String** | 発送メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **accepted_mail_sent_date** | **Integer** | 受注メールの送信日時 | [optional] | +| **paid_mail_sent_date** | **Integer** | 入金メールの送信日時 | [optional] | +| **delivered_mail_sent_date** | **Integer** | 発送メールの送信日時 | [optional] | +| **point_state** | **String** | ショップポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **gmo_point_state** | **String** | GMOポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **yahoo_point_state** | **String** | Yahooポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **product_total_price** | **Integer** | 商品の合計金額 | [optional] | +| **delivery_total_charge** | **Integer** | 配送料 | [optional] | +| **fee** | **Integer** | 決済手数料 | [optional] | +| **tax** | **Integer** | 商品合計金額に対する消費税 | [optional] | +| **noshi_total_charge** | **Integer** | 熨斗料金 | [optional] | +| **card_total_charge** | **Integer** | メッセージカード料金 | [optional] | +| **wrapping_total_charge** | **Integer** | ラッピング料金 | [optional] | +| **point_discount** | **Integer** | ショップポイントによる割引額 | [optional] | +| **gmo_point_discount** | **Integer** | GMOポイントによる割引額 | [optional] | +| **other_discount** | **Integer** | その他、クーポン等による割引額 | [optional] | +| **other_discount_name** | **String** | その他割引の名称 | [optional] | +| **total_price** | **Integer** | 注文総額 | [optional] | +| **granted_points** | **Integer** | 付与されたショップポイント数 | [optional] | +| **use_points** | **Integer** | 使用されたショップポイント数 | [optional] | +| **granted_gmo_points** | **Integer** | 付与されたGMOポイント数 | [optional] | +| **use_gmo_points** | **Integer** | 使用されたGMOポイント数 | [optional] | +| **granted_yahoo_points** | **Integer** | 付与されたYahooポイント数 | [optional] | +| **use_yahoo_points** | **Integer** | 使用されたYahooポイント数 | [optional] | +| **external_order_id** | **String** | 外部システムで発行された決済識別番号 該当受注の決済が、楽天ペイ(オンライン決済)、LINE Pay、PayPal Commerce Platform、Amazon Pay、Amazon Pay V2、Square対面決済のいずれかである場合、その決済の決済識別番号を返します。 それ以外の決済に関しては空文字列を返します。 | [optional] | +| **customer** | [**GetSales200ResponseSalesInnerCustomer**](GetSales200ResponseSalesInnerCustomer.md) | | [optional] | +| **details** | [**Array<GetSales200ResponseSalesInnerDetailsInner>**](GetSales200ResponseSalesInnerDetailsInner.md) | | [optional] | +| **sale_deliveries** | [**Array<GetSales200ResponseSalesInnerSaleDeliveriesInner>**](GetSales200ResponseSalesInnerSaleDeliveriesInner.md) | | [optional] | +| **segment** | [**GetSales200ResponseSalesInnerSegment**](GetSales200ResponseSalesInnerSegment.md) | | [optional] | +| **totals** | [**GetSales200ResponseSalesInnerTotals**](GetSales200ResponseSalesInnerTotals.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSales200ResponseSalesInner.new( + id: 4434233, + account_id: PAXXXXXXXX, + make_date: 1465784934, + update_date: 1494496895, + memo: null, + payment_id: 751, + mobile: false, + paid: true, + delivered: true, + canceled: false, + accepted_mail_state: null, + paid_mail_state: null, + delivered_mail_state: null, + accepted_mail_sent_date: 1363152822, + paid_mail_sent_date: 1363153288, + delivered_mail_sent_date: 1363154591, + point_state: null, + gmo_point_state: null, + yahoo_point_state: null, + product_total_price: 1000, + delivery_total_charge: 350, + fee: 300, + tax: 80, + noshi_total_charge: 0, + card_total_charge: 200, + wrapping_total_charge: 0, + point_discount: 0, + gmo_point_discount: 0, + other_discount: 0, + other_discount_name: , + total_price: 1930, + granted_points: 100, + use_points: 0, + granted_gmo_points: 0, + use_gmo_points: 0, + granted_yahoo_points: 0, + use_yahoo_points: 0, + external_order_id: ABC0123456789, + customer: null, + details: null, + sale_deliveries: null, + segment: null, + totals: null +) +``` + diff --git a/docs/GetSales200ResponseSalesInnerCustomer.md b/docs/GetSales200ResponseSalesInnerCustomer.md new file mode 100644 index 0000000..6bba506 --- /dev/null +++ b/docs/GetSales200ResponseSalesInnerCustomer.md @@ -0,0 +1,66 @@ +# ColorMeShop::GetSales200ResponseSalesInnerCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 顧客ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 顧客の名前 | [optional] | +| **furigana** | **String** | 名前のフリガナ | [optional] | +| **hojin** | **String** | 法人名 | [optional] | +| **busho** | **String** | 部署名 | [optional] | +| **sex** | **String** | 性別 | [optional] | +| **birthday** | **String** | 誕生日 | [optional] | +| **postal** | **String** | 郵便番号 | [optional] | +| **pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47 | [optional] | +| **pref_name** | **String** | 都道府県名 | [optional] | +| **address1** | **String** | 住所1 | [optional] | +| **address2** | **String** | 住所2 | [optional] | +| **mail** | **String** | メールアドレス | [optional] | +| **tel** | **String** | 電話番号 | [optional] | +| **fax** | **String** | FAX番号 | [optional] | +| **tel_mobile** | **String** | 携帯電話番号 | [optional] | +| **other** | **String** | 備考 | [optional] | +| **points** | **Integer** | 保有ポイント数 | [optional] | +| **member** | **Boolean** | 会員登録済みであるか否か | [optional] | +| **sales_count** | **Integer** | これまでの購入回数 | [optional] | +| **receive_mail_magazine** | **Boolean** | メルマガ受信可否 | [optional] | +| **answer_free_form1** | **String** | フリー項目1の入力内容 | [optional] | +| **answer_free_form2** | **String** | フリー項目2の入力内容 | [optional] | +| **answer_free_form3** | **String** | フリー項目3の入力内容 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSales200ResponseSalesInnerCustomer.new( + id: 998273, + account_id: PA01234567, + name: カラーミー太郎, + furigana: カラーミータロウ, + hojin: GMOペパボ株式会社, + busho: EC事業部, + sex: male, + birthday: 1999-01-01, + postal: 1578512, + pref_id: 13, + pref_name: 東京都, + address1: 渋谷区桜丘町26-1, + address2: セルリアンタワー, + mail: example@pepabo.com, + tel: null, + fax: null, + tel_mobile: 080-1234-1234, + other: null, + points: 216, + member: true, + sales_count: 3, + receive_mail_magazine: true, + answer_free_form1: これはフリー項目1の入力内容です, + answer_free_form2: これはフリー項目2の入力内容です, + answer_free_form3: これはフリー項目3の入力内容です +) +``` + diff --git a/docs/GetSales200ResponseSalesInnerDetailsInner.md b/docs/GetSales200ResponseSalesInnerDetailsInner.md new file mode 100644 index 0000000..03bed59 --- /dev/null +++ b/docs/GetSales200ResponseSalesInnerDetailsInner.md @@ -0,0 +1,58 @@ +# ColorMeShop::GetSales200ResponseSalesInnerDetailsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 受注明細ID | [optional] | +| **sale_id** | **Integer** | 売上ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **product_id** | **Integer** | 商品ID | [optional] | +| **sale_delivery_id** | **Integer** | お届け先ID | [optional] | +| **option1_value** | **String** | オプション1の値(最新の商品情報) | [optional] | +| **option2_value** | **String** | オプション2の値(最新の商品情報) | [optional] | +| **option1_index** | **Integer** | オプション1の値の選択肢中の位置 | [optional] | +| **option2_index** | **Integer** | オプション2の値の選択肢中の位置 | [optional] | +| **product_model_number** | **String** | 型番 | [optional] | +| **product_name** | **String** | 商品名(最新の商品情報) | [optional] | +| **pristine_product_full_name** | **String** | 商品名とオプション名(注文時の商品情報) | [optional] | +| **product_cost** | **Integer** | 商品原価 | [optional] | +| **product_image_url** | **String** | 商品画像URL | [optional] | +| **product_thumbnail_image_url** | **String** | サムネイル用商品画像URL | [optional] | +| **product_mobile_image_url** | **String** | モバイル用商品画像URL | [optional] | +| **price** | **Integer** | 商品販売価格 | [optional] | +| **price_with_tax** | **Integer** | 税込み商品価格 | [optional] | +| **product_num** | **Integer** | 商品点数 | [optional] | +| **unit** | **String** | 単位 | [optional] | +| **subtotal_price** | **Integer** | 商品小計。販売価格と点数の積 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSales200ResponseSalesInnerDetailsInner.new( + id: 44344599, + sale_id: 4434233, + account_id: PA01234567, + product_id: 1342332, + sale_delivery_id: 1173289, + option1_value: 赤, + option2_value: Sサイズ, + option1_index: 0, + option2_index: 0, + product_model_number: T-RED-S-223, + product_name: Tシャツ, + pristine_product_full_name: Tシャツ(カラー:赤、サイズ:Sサイズ), + product_cost: 1000, + product_image_url: https://img07.shop-pro.jp/XXX/XX/product/123.jpg?20130319164314, + product_thumbnail_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_th.jpg?20130319164314, + product_mobile_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_mb.jpg?20130319164314, + price: 1680, + price_with_tax: 1814, + product_num: 1, + unit: 枚, + subtotal_price: 1814 +) +``` + diff --git a/docs/GetSales200ResponseSalesInnerSaleDeliveriesInner.md b/docs/GetSales200ResponseSalesInnerSaleDeliveriesInner.md new file mode 100644 index 0000000..22af59f --- /dev/null +++ b/docs/GetSales200ResponseSalesInnerSaleDeliveriesInner.md @@ -0,0 +1,72 @@ +# ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | お届け先ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **sale_id** | **Integer** | 売上ID | [optional] | +| **delivery_id** | **Integer** | 使用された配送方法ID | [optional][readonly] | +| **detail_ids** | **Array<Integer>** | この配送に含まれる受注明細IDの配列 | [optional] | +| **name** | **String** | 宛名 | [optional] | +| **furigana** | **String** | 宛名のフリガナ | [optional] | +| **postal** | **String** | 郵便番号 | [optional] | +| **pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47 | [optional] | +| **pref_name** | **String** | 都道府県名 | [optional] | +| **address1** | **String** | 住所1 | [optional] | +| **address2** | **String** | 住所2 | [optional] | +| **tel** | **String** | 電話番号 | [optional] | +| **preferred_date** | **String** | 配送希望日 | [optional] | +| **preferred_period** | **String** | 配送希望時間帯 | [optional] | +| **slip_number** | **String** | 配送伝票番号 | [optional] | +| **noshi_text** | **String** | 熨斗の文言 | [optional] | +| **noshi_charge** | **Integer** | 熨斗の料金 | [optional] | +| **card_name** | **String** | メッセージカードの表示名 | [optional] | +| **card_text** | **String** | メッセージカードのテキスト | [optional] | +| **card_charge** | **Integer** | メッセージカードの料金 | [optional] | +| **wrapping_name** | **String** | ラッピングの表示名 | [optional] | +| **wrapping_charge** | **Integer** | ラッピングの料金 | [optional] | +| **delivery_charge** | **Integer** | 配送料 | [optional] | +| **total_charge** | **Integer** | 配送料・手数料の小計 | [optional] | +| **tracking_url** | **String** | 配送状況確認URL | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **delivered** | **Boolean** | 発送済みであるか否か | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner.new( + id: 1173289, + account_id: PA01234567, + sale_id: 4434233, + delivery_id: 113922, + detail_ids: [44344599], + name: ペパボ太郎, + furigana: ペパボタロウ, + postal: 1508512, + pref_id: 13, + pref_name: 東京都, + address1: 渋谷区桜丘町26-1, + address2: セルリアンタワー, + tel: null, + preferred_date: 2017-05-21, + preferred_period: 午前中, + slip_number: 1234-5678-9012, + noshi_text: 寿, + noshi_charge: 100, + card_name: バースデーカード, + card_text: おめでとう, + card_charge: 150, + wrapping_name: ギフト用ラッピング(ピンク), + wrapping_charge: 200, + delivery_charge: 350, + total_charge: 800, + tracking_url: https://example.com/delivery_state?id=111-222-33333, + memo: null, + delivered: false +) +``` + diff --git a/docs/GetSales200ResponseSalesInnerSegment.md b/docs/GetSales200ResponseSalesInnerSegment.md new file mode 100644 index 0000000..d3b0125 --- /dev/null +++ b/docs/GetSales200ResponseSalesInnerSegment.md @@ -0,0 +1,36 @@ +# ColorMeShop::GetSales200ResponseSalesInnerSegment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 分割された受注内のID | [optional] | +| **name** | **String** | 区分名 | [optional] | +| **parent_sale_id** | **Integer** | 親受注のID。 該当の受注が分割されていない場合、自身の受注IDを返します。 | [optional] | +| **splitted** | **Boolean** | 該当の受注が分割されているか否か | [optional] | +| **product_total_price** | **Integer** | 分割された受注の商品の合計金額 | [optional] | +| **delivery_total_charge** | **Integer** | 分割された受注の配送料の合計 | [optional] | +| **total_price** | **Integer** | 分割された受注金額の総計 | [optional] | +| **noshi_total_charge** | **Integer** | 分割された受注の熨斗料金の合計 | [optional] | +| **card_total_charge** | **Integer** | 分割された受注のメッセージカード料金の合計 | [optional] | +| **wrapping_total_charge** | **Integer** | 分割された受注のラッピング料金の合計 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSales200ResponseSalesInnerSegment.new( + id: 1, + name: null, + parent_sale_id: 4434233, + splitted: null, + product_total_price: 2000, + delivery_total_charge: 700, + total_price: 2700, + noshi_total_charge: 0, + card_total_charge: 200, + wrapping_total_charge: 0 +) +``` + diff --git a/docs/GetSales200ResponseSalesInnerTotals.md b/docs/GetSales200ResponseSalesInnerTotals.md new file mode 100644 index 0000000..d574307 --- /dev/null +++ b/docs/GetSales200ResponseSalesInnerTotals.md @@ -0,0 +1,28 @@ +# ColorMeShop::GetSales200ResponseSalesInnerTotals + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **normal_tax_amount** | **Integer** | 受注における通常税率(10%)の消費税 | [optional] | +| **reduced_tax_amount** | **Integer** | 受注における軽減税率(8%)の消費税 | [optional] | +| **discount_amount_for_normal_tax** | **Integer** | 通常税率(10%)の適用金額を対象としたの割引額 | [optional] | +| **discount_amount_for_reduced_tax** | **Integer** | 軽減税率(8%)の適用金額を対象としたの割引額 | [optional] | +| **total_price_with_normal_tax** | **Integer** | 通常税率(10%)の適用金額の税込合計額 | [optional] | +| **total_price_with_reduced_tax** | **Integer** | 軽減税率(8%)の適用金額の税込合計額 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetSales200ResponseSalesInnerTotals.new( + normal_tax_amount: 90, + reduced_tax_amount: 13, + discount_amount_for_normal_tax: 171, + discount_amount_for_reduced_tax: 29, + total_price_with_normal_tax: 989, + total_price_with_reduced_tax: 171 +) +``` + diff --git a/docs/GetShop200Response.md b/docs/GetShop200Response.md new file mode 100644 index 0000000..dfa0635 --- /dev/null +++ b/docs/GetShop200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::GetShop200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **shop** | [**GetShop200ResponseShop**](GetShop200ResponseShop.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetShop200Response.new( + shop: null +) +``` + diff --git a/docs/GetShop200ResponseShop.md b/docs/GetShop200ResponseShop.md new file mode 100644 index 0000000..3e8856b --- /dev/null +++ b/docs/GetShop200ResponseShop.md @@ -0,0 +1,90 @@ +# ColorMeShop::GetShop200ResponseShop + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | ショップアカウントID | [optional] | +| **state** | **String** | アカウント状態 | [optional] | +| **domain_plan** | **String** | ドメインプラン | [optional] | +| **contract_plan** | **String** | 契約プラン | [optional] | +| **contract_start_date** | **Integer** | 契約開始日時 | [optional] | +| **contract_end_date** | **Integer** | 契約終了日時 | [optional] | +| **contract_term** | **Integer** | 契約期間 | [optional] | +| **last_login_date** | **Integer** | 最終ログイン日時 | [optional] | +| **setup_date** | **Integer** | 申し込み完了日時 | [optional] | +| **make_date** | **Integer** | アカウント作成日時 | [optional] | +| **url** | **String** | ショップURL | [optional] | +| **open_state** | **String** | 開店状態 | [optional] | +| **mobile_open_state** | **String** | モバイルショップ開店状態 | [optional] | +| **login_id** | **String** | ログインID | [optional] | +| **name1** | **String** | 登録者氏名(姓) | [optional] | +| **name2** | **String** | 登録者氏名(名) | [optional] | +| **name1_kana** | **String** | 登録者氏名カナ(姓) | [optional] | +| **name2_kana** | **String** | 登録者氏名カナ(名) | [optional] | +| **hojin** | **String** | 法人名 | [optional] | +| **hojin_kana** | **String** | 法人名カナ | [optional] | +| **user_mail** | **String** | 登録者メールアドレス | [optional] | +| **tel** | **String** | 登録者電話番号 | [optional] | +| **fax** | **String** | 登録者FAX番号 | [optional] | +| **postal** | **String** | 郵便番号 | [optional] | +| **pref_id** | **Integer** | 都道府県ID | [optional] | +| **pref_name** | **String** | 都道府県名 | [optional] | +| **address1** | **String** | 住所1 | [optional] | +| **address2** | **String** | 住所2 | [optional] | +| **title** | **String** | ショップ名 | [optional] | +| **title_short** | **String** | メールタイトル用ショップ名 | [optional] | +| **shop_mail_1** | **String** | 管理者メールアドレス | [optional] | +| **shop_mail_2** | **String** | 管理者携帯メールアドレス | [optional] | +| **tax_type** | **String** | 消費税の内税・外税設定 | [optional] | +| **tax** | **Integer** | 消費税率 | [optional] | +| **tax_rounding_method** | **String** | 消費税の切り捨て、切り上げ設定 | [optional] | +| **reduce_tax_rate** | **Integer** | 軽減税率 | [optional] | +| **shop_logo_url** | **String** | ショップロゴ画像のURL | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetShop200ResponseShop.new( + id: PAXXXXXXXX, + state: null, + domain_plan: null, + contract_plan: null, + contract_start_date: 1546268400, + contract_end_date: 1577718000, + contract_term: 12, + last_login_date: 1570750709, + setup_date: 1511747460, + make_date: 1511747460, + url: https://example.shop-pro.jp, + open_state: null, + mobile_open_state: null, + login_id: testshop, + name1: 山田, + name2: 太郎, + name1_kana: ヤマダ, + name2_kana: タロウ, + hojin: , + hojin_kana: , + user_mail: tarou@example.com, + tel: 11-1111-1111, + fax: null, + postal: 1508512, + pref_id: 13, + pref_name: 東京都, + address1: 渋谷区桜丘町, + address2: 26-1 セルリアンタワー, + title: テスト商店, + title_short: テスト商店, + shop_mail_1: shop@example.com, + shop_mail_2: shop-phone@example.com, + tax_type: null, + tax: 10, + tax_rounding_method: null, + reduce_tax_rate: 8, + shop_logo_url: https://img00.shop-pro.jp/PA00000/001/PA00000001.png?cmsp_timestamp=20201201214110 +) +``` + diff --git a/docs/GetStocks200Response.md b/docs/GetStocks200Response.md new file mode 100644 index 0000000..4742f42 --- /dev/null +++ b/docs/GetStocks200Response.md @@ -0,0 +1,20 @@ +# ColorMeShop::GetStocks200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **stocks** | [**Array<GetStocks200ResponseStocksInner>**](GetStocks200ResponseStocksInner.md) | | [optional] | +| **meta** | [**GetSales200ResponseMeta**](GetSales200ResponseMeta.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetStocks200Response.new( + stocks: null, + meta: null +) +``` + diff --git a/docs/GetStocks200ResponseStocksInner.md b/docs/GetStocks200ResponseStocksInner.md new file mode 100644 index 0000000..ecc84ac --- /dev/null +++ b/docs/GetStocks200ResponseStocksInner.md @@ -0,0 +1,91 @@ +# ColorMeShop::GetStocks200ResponseStocksInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **product_id** | **Integer** | 商品ID | [optional] | +| **name** | **String** | 商品名 | [optional] | +| **option1_value** | **String** | オプション1の値 | [optional] | +| **option2_value** | **String** | オプション2の値 | [optional] | +| **stocks** | **Integer** | 在庫数 | [optional] | +| **few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] | +| **model_number** | **String** | 型番 | [optional] | +| **variant_model_number** | **String** | オプションの型番 | [optional] | +| **category** | [**GetProducts200ResponseProductsInnerCategory**](GetProducts200ResponseProductsInnerCategory.md) | | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **sales_price** | **Integer** | 販売価格 | [optional] | +| **price** | **Integer** | 定価 | [optional] | +| **members_price** | **Integer** | 会員価格 | [optional] | +| **cost** | **Integer** | 原価 | [optional] | +| **delivery_charge** | **Integer** | 個別送料 | [optional] | +| **cool_charge** | **Integer** | クール便の追加料金 | [optional] | +| **min_num** | **Integer** | 最小購入数量 | [optional] | +| **max_num** | **Integer** | 最大購入数量 | [optional] | +| **sale_start_date** | **Integer** | 掲載開始時刻 | [optional] | +| **sale_end_date** | **Integer** | 掲載終了時刻 | [optional] | +| **unit** | **String** | 単位 | [optional] | +| **weight** | **Integer** | 重量(グラム単位) | [optional] | +| **soldout_display** | **Boolean** | 売り切れているときもショップに表示するか | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **simple_expl** | **String** | 簡易説明 | [optional] | +| **expl** | **String** | 商品説明 | [optional] | +| **mobile_expl** | **String** | フィーチャーフォン向けショップの商品説明 | [optional] | +| **smartphone_expl** | **String** | スマホ向けショップの商品説明 | [optional] | +| **make_date** | **Integer** | 商品作成日時 | [optional] | +| **update_date** | **Integer** | 商品更新日時 | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **image_url** | **String** | メインの商品画像URL | [optional] | +| **mobile_image_url** | **String** | メインの商品画像のモバイル用URL | [optional] | +| **thumbnail_image_url** | **String** | メインの商品画像のサムネイルURL | [optional] | +| **images** | [**Array<GetStocks200ResponseStocksInnerImagesInner>**](GetStocks200ResponseStocksInnerImagesInner.md) | メインの商品画像以外の3つの画像に関する、PC用とモバイル用の画像URL | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetStocks200ResponseStocksInner.new( + account_id: PA01234567, + product_id: 1342332, + name: Tシャツ, + option1_value: 白, + option2_value: Sサイズ, + stocks: 20, + few_num: 5, + model_number: T-WHITE-S-223, + variant_model_number: T-WHITE-S-223-WITH-NAME, + category: null, + display_state: showing, + sales_price: 1980, + price: null, + members_price: 1680, + cost: null, + delivery_charge: null, + cool_charge: null, + min_num: null, + max_num: null, + sale_start_date: null, + sale_end_date: null, + unit: 個, + weight: null, + soldout_display: true, + sort: 2, + simple_expl: 素材にこだわってつくった、弊社の人気商品です。, + expl: 綿100%のこだわりTシャツです。 + +肌触りや吸水性の良さにみなさま驚かれます。弊社の人気商品です。 +, + mobile_expl: null, + smartphone_expl: null, + make_date: 1465784934, + update_date: 1494496895, + memo: , + image_url: https://img07.shop-pro.jp/XXX/XX/product/123.jpg?20130319164314, + mobile_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_mb.jpg?20130319164314, + thumbnail_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_th.jpg?20130319164314, + images: null +) +``` + diff --git a/docs/GetStocks200ResponseStocksInnerImagesInner.md b/docs/GetStocks200ResponseStocksInnerImagesInner.md new file mode 100644 index 0000000..b87487a --- /dev/null +++ b/docs/GetStocks200ResponseStocksInnerImagesInner.md @@ -0,0 +1,22 @@ +# ColorMeShop::GetStocks200ResponseStocksInnerImagesInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **src** | **String** | 画像URL | [optional] | +| **position** | **Integer** | 表示順 | [optional] | +| **mobile** | **Boolean** | モバイル用であるか否か | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::GetStocks200ResponseStocksInnerImagesInner.new( + src: https://img07.shop-pro.jp/XXX/XX/product/XXX.jpg?20130319164314, + position: null, + mobile: null +) +``` + diff --git a/docs/GiftApi.md b/docs/GiftApi.md index a86cf2f..cac3d56 100644 --- a/docs/GiftApi.md +++ b/docs/GiftApi.md @@ -2,19 +2,23 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_gift**](GiftApi.md#get_gift) | **GET** /v1/gift.json | ギフト設定を取得 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_gift**](GiftApi.md#get_gift) | **GET** /v1/gift | ギフト設定を取得 | -# **get_gift** -> Object get_gift +## get_gift + +> get_gift ギフト設定を取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -25,20 +29,39 @@ end api_instance = ColorMeShop::GiftApi.new begin - #ギフト設定を取得 + # ギフト設定を取得 result = api_instance.get_gift p result rescue ColorMeShop::ApiError => e - puts "Exception when calling GiftApi->get_gift: #{e}" + puts "Error when calling GiftApi->get_gift: #{e}" +end +``` + +#### Using the get_gift_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_gift_with_http_info + +```ruby +begin + # ギフト設定を取得 + data, status_code, headers = api_instance.get_gift_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling GiftApi->get_gift_with_http_info: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type -**Object** +[**GetGift200Response**](GetGift200Response.md) ### Authorization @@ -46,8 +69,6 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json - - +- **Content-Type**: Not defined +- **Accept**: application/json diff --git a/docs/GroupApi.md b/docs/GroupApi.md index 5b81e61..1e4368d 100644 --- a/docs/GroupApi.md +++ b/docs/GroupApi.md @@ -2,19 +2,23 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_product_groups**](GroupApi.md#get_product_groups) | **GET** /v1/groups.json | 商品グループ一覧を取得 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_product_groups**](GroupApi.md#get_product_groups) | **GET** /v1/groups | 商品グループ一覧を取得 | -# **get_product_groups** -> Object get_product_groups +## get_product_groups + +> get_product_groups 商品グループ一覧を取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -25,20 +29,39 @@ end api_instance = ColorMeShop::GroupApi.new begin - #商品グループ一覧を取得 + # 商品グループ一覧を取得 result = api_instance.get_product_groups p result rescue ColorMeShop::ApiError => e - puts "Exception when calling GroupApi->get_product_groups: #{e}" + puts "Error when calling GroupApi->get_product_groups: #{e}" +end +``` + +#### Using the get_product_groups_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_product_groups_with_http_info + +```ruby +begin + # 商品グループ一覧を取得 + data, status_code, headers = api_instance.get_product_groups_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling GroupApi->get_product_groups_with_http_info: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type -**Object** +[**GetProductGroups200Response**](GetProductGroups200Response.md) ### Authorization @@ -46,8 +69,6 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json - - +- **Content-Type**: Not defined +- **Accept**: application/json diff --git a/docs/Meta.md b/docs/Meta.md index 95416c4..3baa1df 100644 --- a/docs/Meta.md +++ b/docs/Meta.md @@ -1,10 +1,22 @@ # ColorMeShop::Meta ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**total** | **Integer** | トータルの件数 | [optional] -**limit** | **Integer** | 実効limit | [optional] -**offset** | **Integer** | 実効offset | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total** | **Integer** | トータルの件数 | [optional] | +| **limit** | **Integer** | 実効limit | [optional] | +| **offset** | **Integer** | 実効offset | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::Meta.new( + total: 300, + limit: 50, + offset: 200 +) +``` diff --git a/docs/Payment.md b/docs/Payment.md index 4354fe9..f9aa56e 100644 --- a/docs/Payment.md +++ b/docs/Payment.md @@ -1,24 +1,52 @@ # ColorMeShop::Payment ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 決済方法ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**name** | **String** | 決済名 | [optional] -**fee** | **Integer** | 決済手数料 | [optional] -**ip_code** | **String** | GMOイプシロン等との契約コード | [optional] -**memo** | **String** | 説明 | [optional] -**memo_mobile** | **String** | フィーチャーフォン向けショップ用の説明 | [optional] -**sort** | **Integer** | 表示順 | [optional] -**image_url** | **String** | 決済画像URL | [optional] -**type** | **Integer** | 決済タイプを表す数値。 |type|決済| |---|---| |0|代引き| |1|銀行振込| |2|郵便振替| |3|クレジット(ZEUS)| |4|クロネコ@ペイメント| |5|NP後払い| |6|クレジット(イプシロン)| |7|コンビニ決済(イプシロン)| |8|カラーミークレジット| |9|その他決済| |10|ウェブマネー| |11|イーバンクデビット| |12|ネット銀行(イプシロン)| |13|電子マネー(イプシロン)| |14|ATM・コンビニ・ネット銀行決済(ペイジェント)| |15|Do-Link決済(イプシロン)| |16|ペイジー(イプシロン)| |17|後払い.com| |18|ジャパンネット銀行(送料無料キャンペーン)| |19|クロネコwebコレクト| |20|PayPal(イプシロン)| |21|Yahoo!ウォレット(イプシロン)| |22|全額ポイント利用| |23|スマートフォンキャリア決済(イプシロン)| |24|GMO PG マルチペイメントクレジットカード| |25|住信SBIネット銀行(イプシロン)| |26|GMO後払い(イプシロン)| |27|GMO後払い(GMOペイメントサービス)| |28| - | |29|ATM(ペイジー)(ペイジェント)| |30|カード(ペイジェント)| |31|コンビニ番号方式(ペイジェント)| |32|インターネットバンキング(ペイジェント)| |33|PayPal(ペイパル)| |34|SMBC GMO PAYMENTクレジットカード| |35|Amazon Pay| |36|楽天ペイ(オンライン決済)| | [optional] -**display** | **BOOLEAN** | 表示設定。`true`なら表示される | [optional] -**use_mobile** | **BOOLEAN** | フィーチャーフォン向けショップでの表示設定 | [optional] -**make_date** | **Integer** | 決済作成日時 | [optional] -**update_date** | **Integer** | 決済更新日時 | [optional] -**cod** | **Object** | 代引き決済の設定情報。代引き決済の場合のみ存在する | [optional] -**card** | **Object** | クレジットカードの設定情報。クレジットカード決済の場合のみ存在する | [optional] -**financial** | **Object** | 銀行振り込みの設定情報。銀行振り込み決済の場合のみ存在する | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 決済方法ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 決済名 | [optional] | +| **fee** | **Integer** | 決済手数料 | [optional] | +| **ip_code** | **String** | GMOイプシロン等との契約コード | [optional] | +| **memo** | **String** | 説明 | [optional] | +| **order_end_note** | **String** | 説明 | [optional] | +| **memo_mobile** | **String** | フィーチャーフォン向けショップ用の説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **image_url** | **String** | 決済画像URL | [optional] | +| **type** | **Integer** | 決済タイプを表す数値。 |type|決済| |---|---| |0|代引き| |1|銀行振込| |2|郵便振替| |3|クレジット(ZEUS)| |4|クロネコ@ペイメント| |5|NP後払い| |6|クレジット(イプシロン)| |7|コンビニ決済(イプシロン)| |8|カラーミークレジット| |9|その他決済| |10|ウェブマネー| |11|イーバンクデビット| |12|ネット銀行(イプシロン)| |13|電子マネー(イプシロン)| |14|ATM・コンビニ・ネット銀行決済(ペイジェント)| |15|Do-Link決済(イプシロン)| |16|ペイジー(イプシロン)| |17|後払い.com| |18|ジャパンネット銀行(送料無料キャンペーン)| |19|クロネコwebコレクト| |20|PayPal(イプシロン)| |21|Yahoo!ウォレット(イプシロン)| |22|全額ポイント利用| |23|スマートフォンキャリア決済(イプシロン)| |24|GMO PG マルチペイメントクレジットカード| |25|住信SBIネット銀行(イプシロン)| |26|GMO後払い(イプシロン)| |27|GMO後払い(GMOペイメントサービス)| |28| - | |29|ATM(ペイジー)(ペイジェント)| |30|カード(ペイジェント)| |31|コンビニ番号方式(ペイジェント)| |32|インターネットバンキング(ペイジェント)| |33|PayPal(ペイパル)| |34|SMBC GMO PAYMENTクレジットカード| |35|Amazon Pay(イプシロン)| |36|楽天ペイ(オンライン決済)| |37|銀行振込(バーチャル口座)(イプシロン)| |38|Amazon Pay(アマゾンペイ)| |39|クレジットカード(SGシステム)| |40|LINE Pay(イプシロン)| |41|PayPal Commerce Platform(ペイパル)| |42|PayPay(イプシロン)| |43|Amazon Pay V2(アマゾンペイ)| |44|Amazon Pay V2(イプシロン)| |45|Square対面決済| | [optional] | +| **display** | **Boolean** | 表示設定。`true`なら表示される | [optional] | +| **use_mobile** | **Boolean** | フィーチャーフォン向けショップでの表示設定 | [optional] | +| **make_date** | **Integer** | 決済作成日時 | [optional] | +| **update_date** | **Integer** | 決済更新日時 | [optional] | +| **cod** | [**GetPayments200ResponsePaymentsInnerCod**](GetPayments200ResponsePaymentsInnerCod.md) | | [optional] | +| **card** | [**GetPayments200ResponsePaymentsInnerCard**](GetPayments200ResponsePaymentsInnerCard.md) | | [optional] | +| **financial** | [**GetPayments200ResponsePaymentsInnerFinancial**](GetPayments200ResponsePaymentsInnerFinancial.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::Payment.new( + id: 751, + account_id: PA01234567, + name: 銀行振り込み, + fee: 300, + ip_code: 12345678, + memo: 購入後、振込口座情報をメールにて差し上げます。, + order_end_note: null, + memo_mobile: 購入後、振込口座情報をメールにて差し上げます。, + sort: 1, + image_url: null, + type: 33, + display: true, + use_mobile: true, + make_date: 1495007163, + update_date: 1495007163, + cod: null, + card: null, + financial: null +) +``` diff --git a/docs/PaymentApi.md b/docs/PaymentApi.md index 30b345a..9852d5b 100644 --- a/docs/PaymentApi.md +++ b/docs/PaymentApi.md @@ -2,19 +2,23 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_payments**](PaymentApi.md#get_payments) | **GET** /v1/payments.json | 決済設定の一覧を取得 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_payments**](PaymentApi.md#get_payments) | **GET** /v1/payments | 決済設定の一覧を取得 | -# **get_payments** -> Object get_payments +## get_payments + +> get_payments 決済設定の一覧を取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -25,20 +29,39 @@ end api_instance = ColorMeShop::PaymentApi.new begin - #決済設定の一覧を取得 + # 決済設定の一覧を取得 result = api_instance.get_payments p result rescue ColorMeShop::ApiError => e - puts "Exception when calling PaymentApi->get_payments: #{e}" + puts "Error when calling PaymentApi->get_payments: #{e}" +end +``` + +#### Using the get_payments_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_payments_with_http_info + +```ruby +begin + # 決済設定の一覧を取得 + data, status_code, headers = api_instance.get_payments_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling PaymentApi->get_payments_with_http_info: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type -**Object** +[**GetPayments200Response**](GetPayments200Response.md) ### Authorization @@ -46,8 +69,6 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json - - +- **Content-Type**: Not defined +- **Accept**: application/json diff --git a/docs/PostCustomers200Response.md b/docs/PostCustomers200Response.md new file mode 100644 index 0000000..46aa162 --- /dev/null +++ b/docs/PostCustomers200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::PostCustomers200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer** | [**GetSales200ResponseSalesInnerCustomer**](GetSales200ResponseSalesInnerCustomer.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PostCustomers200Response.new( + customer: null +) +``` + diff --git a/docs/PostCustomersRequest.md b/docs/PostCustomersRequest.md new file mode 100644 index 0000000..869a981 --- /dev/null +++ b/docs/PostCustomersRequest.md @@ -0,0 +1,18 @@ +# ColorMeShop::PostCustomersRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **customer** | [**PostCustomersRequestCustomer**](PostCustomersRequestCustomer.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PostCustomersRequest.new( + customer: null +) +``` + diff --git a/docs/PostCustomersRequestCustomer.md b/docs/PostCustomersRequestCustomer.md new file mode 100644 index 0000000..50dac1f --- /dev/null +++ b/docs/PostCustomersRequestCustomer.md @@ -0,0 +1,32 @@ +# ColorMeShop::PostCustomersRequestCustomer + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | 購入者氏名 | [optional] | +| **mail** | **String** | メールアドレス | [optional] | +| **pref_id** | **Integer** | 都道府県id | [optional] | +| **address1** | **String** | 住所 | [optional] | +| **address2** | **String** | 住所(建物名など) | [optional] | +| **tel** | **String** | 電話番号 | [optional] | +| **postal** | **String** | 郵便番号 | [optional] | +| **add_member** | **Boolean** | 会員登録をするか否か | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PostCustomersRequestCustomer.new( + name: null, + mail: null, + pref_id: null, + address1: null, + address2: null, + tel: null, + postal: null, + add_member: null +) +``` + diff --git a/docs/PostProducts200Response.md b/docs/PostProducts200Response.md new file mode 100644 index 0000000..a26db1c --- /dev/null +++ b/docs/PostProducts200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::PostProducts200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product** | [**GetProducts200ResponseProductsInner**](GetProducts200ResponseProductsInner.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PostProducts200Response.new( + product: null +) +``` + diff --git a/docs/PostProductsRequest.md b/docs/PostProductsRequest.md new file mode 100644 index 0000000..692ccc1 --- /dev/null +++ b/docs/PostProductsRequest.md @@ -0,0 +1,18 @@ +# ColorMeShop::PostProductsRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product** | [**PostProductsRequestProduct**](PostProductsRequestProduct.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PostProductsRequest.new( + product: null +) +``` + diff --git a/docs/PostProductsRequestProduct.md b/docs/PostProductsRequestProduct.md new file mode 100644 index 0000000..a2a355c --- /dev/null +++ b/docs/PostProductsRequestProduct.md @@ -0,0 +1,26 @@ +# ColorMeShop::PostProductsRequestProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | 商品名 | [optional] | +| **category_id_big** | **Integer** | 大カテゴリーID | [optional] | +| **sales_price** | **Integer** | 販売価格 フリープランを利用しているショップの場合、最低価格は100円です。 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **tax_reduced** | **Boolean** | `true` の場合は軽減税率対象 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PostProductsRequestProduct.new( + name: null, + category_id_big: 1139, + sales_price: 1600, + display_state: null, + tax_reduced: false +) +``` + diff --git a/docs/Product.md b/docs/Product.md index 345824c..e532d3c 100644 --- a/docs/Product.md +++ b/docs/Product.md @@ -1,44 +1,115 @@ # ColorMeShop::Product ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account_id** | **String** | ショップアカウントID | [optional] -**id** | **Integer** | 商品ID | [optional] -**name** | **String** | 商品名 | [optional] -**stocks** | **Integer** | 在庫数 | [optional] -**stock_managed** | **BOOLEAN** | 在庫管理するか否か | [optional] -**few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] -**model_number** | **String** | 型番 | [optional] -**category** | **Object** | | [optional] -**group_ids** | **Array<Integer>** | 商品が属するグループのIDの配列 | [optional] -**display_state** | **String** | 掲載設定 | [optional] -**sales_price** | **Integer** | 販売価格 | [optional] -**price** | **Integer** | 定価 | [optional] -**members_price** | **Integer** | 会員価格 | [optional] -**cost** | **Integer** | 原価 | [optional] -**delivery_charge** | **Integer** | 個別送料 | [optional] -**min_num** | **Integer** | 最小購入数量 | [optional] -**max_num** | **Integer** | 最大購入数量 | [optional] -**sale_start_date** | **Integer** | 掲載開始時刻 | [optional] -**sale_end_date** | **Integer** | 掲載終了時刻 | [optional] -**unit** | **String** | 単位 | [optional] -**weight** | **Integer** | 重量(グラム単位) | [optional] -**soldout_display** | **BOOLEAN** | 売り切れているときもショップに表示するか | [optional] -**sort** | **Integer** | 表示順 | [optional] -**simple_expl** | **String** | 簡易説明 | [optional] -**expl** | **String** | 商品説明 | [optional] -**mobile_expl** | **String** | フィーチャーフォン向けショップの商品説明 | [optional] -**smartphone_expl** | **String** | スマホ向けショップの商品説明 | [optional] -**make_date** | **Integer** | 商品作成日時 | [optional] -**update_date** | **Integer** | 商品更新日時 | [optional] -**memo** | **String** | 備考 | [optional] -**image_url** | **String** | メインの商品画像URL | [optional] -**mobile_image_url** | **String** | メインの商品画像のモバイル用URL | [optional] -**thumbnail_image_url** | **String** | メインの商品画像のサムネイルURL | [optional] -**images** | **Array<Object>** | メインの商品画像以外の3つの画像に関する、PC用とモバイル用の画像URL | [optional] -**options** | [**Array<ProductOption>**](ProductOption.md) | 選択できるオプションの一覧 | [optional] -**variants** | [**Array<ProductVariant>**](ProductVariant.md) | オプションのバリエーション一覧 | [optional] -**pickups** | **Array<Object>** | おすすめ商品情報 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **id** | **Integer** | 商品ID | [optional] | +| **name** | **String** | 商品名 | [optional] | +| **stocks** | **Integer** | 在庫数 | [optional] | +| **stock_managed** | **Boolean** | 在庫管理するか否か | [optional] | +| **few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] | +| **model_number** | **String** | 型番 | [optional] | +| **category** | [**GetProducts200ResponseProductsInnerCategory**](GetProducts200ResponseProductsInnerCategory.md) | | [optional] | +| **group_ids** | **Array<Integer>** | 商品が属するグループのIDの配列 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **sales_price** | **Integer** | 販売価格 | [optional] | +| **sales_price_including_tax** | **Integer** | 消費税込販売価格 | [optional] | +| **sales_price_tax** | **Integer** | 消費税額 | [optional] | +| **price** | **Integer** | 定価 | [optional] | +| **members_price** | **Integer** | 会員価格 | [optional] | +| **members_price_including_tax** | **Integer** | 消費税込会員価格 | [optional] | +| **members_price_tax** | **Integer** | 会員価格の消費税額 | [optional] | +| **cost** | **Integer** | 原価 | [optional] | +| **delivery_charge** | **Integer** | 個別送料 | [optional] | +| **cool_charge** | **Integer** | クール便の追加料金 | [optional] | +| **unavailable_payment_ids** | **Array<Integer>** | 利用不可決済方法の配列 | [optional] | +| **unavailable_delivery_ids** | **Array<Integer>** | 利用不可配送方法の配列 | [optional] | +| **min_num** | **Integer** | 最小購入数量 | [optional] | +| **max_num** | **Integer** | 最大購入数量 | [optional] | +| **sale_start_date** | **Integer** | 掲載開始時刻 | [optional] | +| **sale_end_date** | **Integer** | 掲載終了時刻 | [optional] | +| **unit** | **String** | 単位 | [optional] | +| **weight** | **Integer** | 重量(グラム単位) | [optional] | +| **soldout_display** | **Boolean** | 売り切れているときもショップに表示するか | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **simple_expl** | **String** | 簡易説明 | [optional] | +| **expl** | **String** | 商品説明 | [optional] | +| **mobile_expl** | **String** | フィーチャーフォン向けショップの商品説明 | [optional] | +| **smartphone_expl** | **String** | スマホ向けショップの商品説明 | [optional] | +| **make_date** | **Integer** | 商品作成日時 | [optional] | +| **update_date** | **Integer** | 商品更新日時 | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **image_url** | **String** | メインの商品画像URL | [optional] | +| **mobile_image_url** | **String** | メインの商品画像のモバイル用URL | [optional] | +| **thumbnail_image_url** | **String** | メインの商品画像のサムネイルURL | [optional] | +| **images** | [**Array<GetProducts200ResponseProductsInnerImagesInner>**](GetProducts200ResponseProductsInnerImagesInner.md) | メインの商品画像以外の3つの画像に関する、PC用とモバイル用の画像URL | [optional] | +| **options** | [**Array<GetProducts200ResponseProductsInnerOptionsInner>**](GetProducts200ResponseProductsInnerOptionsInner.md) | 選択できるオプションの一覧 | [optional] | +| **variants** | [**Array<GetProducts200ResponseProductsInnerVariantsInner>**](GetProducts200ResponseProductsInnerVariantsInner.md) | オプションのバリエーション一覧 | [optional] | +| **pickups** | [**Array<GetProducts200ResponseProductsInnerPickupsInner>**](GetProducts200ResponseProductsInnerPickupsInner.md) | おすすめ商品情報 ※おすすめ商品種別が「3: 新着商品」の情報は、「[新着商品管理](https://shop-pro.jp/manual/new_item_lst)」が「手動モード」の場合のみ取得できます。 | [optional] | +| **digital_conent** | **Boolean** | デジタルコンテンツ商品かどうか | [optional] | +| **regular_purchase** | **Boolean** | 定期購入商品かどうか | [optional] | +| **tax_reduced** | **Boolean** | 軽減税率対象なら `true` | [optional] | +| **without_shipping** | **Boolean** | 配送不要商品なら `true` | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::Product.new( + account_id: PA01234567, + id: 1342332, + name: Tシャツ, + stocks: 20, + stock_managed: false, + few_num: 5, + model_number: T-223, + category: null, + group_ids: [5456,62098], + display_state: showing, + sales_price: 1980, + sales_price_including_tax: 2178, + sales_price_tax: 198, + price: null, + members_price: 1680, + members_price_including_tax: 1848, + members_price_tax: 168, + cost: null, + delivery_charge: null, + cool_charge: null, + unavailable_payment_ids: [600001,600002], + unavailable_delivery_ids: [400001,400002], + min_num: null, + max_num: null, + sale_start_date: null, + sale_end_date: null, + unit: null, + weight: null, + soldout_display: true, + sort: 2, + simple_expl: 素材にこだわってつくった、弊社の人気商品です。, + expl: 綿100%のこだわりTシャツです。 + +肌触りや吸水性の良さにみなさま驚かれます。弊社の人気商品です。 +, + mobile_expl: null, + smartphone_expl: null, + make_date: 1465784934, + update_date: 1494496895, + memo: , + image_url: https://img07.shop-pro.jp/XXX/XX/product/123.jpg?20130319164314, + mobile_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_mb.jpg?20130319164314, + thumbnail_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_th.jpg?20130319164314, + images: null, + options: null, + variants: null, + pickups: null, + digital_conent: false, + regular_purchase: false, + tax_reduced: false, + without_shipping: false +) +``` diff --git a/docs/ProductApi.md b/docs/ProductApi.md index 8c7474b..d7ddedf 100644 --- a/docs/ProductApi.md +++ b/docs/ProductApi.md @@ -2,25 +2,30 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**delete_product_pickup**](ProductApi.md#delete_product_pickup) | **DELETE** /v1/products/{productId}/pickups/{pickupType}.json | おすすめ商品情報の削除 -[**get_product**](ProductApi.md#get_product) | **GET** /v1/products/{productId}.json | 商品データの取得 -[**get_products**](ProductApi.md#get_products) | **GET** /v1/products.json | 商品一覧の取得 -[**post_product_pickup**](ProductApi.md#post_product_pickup) | **POST** /v1/products/{productId}/pickups.json | おすすめ商品情報の追加 -[**update_product**](ProductApi.md#update_product) | **PUT** /v1/products/{productId}.json | 商品データの更新 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**delete_product_pickup**](ProductApi.md#delete_product_pickup) | **DELETE** /v1/products/{product_id}/pickups/{pickup_type} | おすすめ商品情報の削除 | +| [**get_product**](ProductApi.md#get_product) | **GET** /v1/products/{product_id} | 商品データの取得 | +| [**get_product_variants**](ProductApi.md#get_product_variants) | **GET** /v1/products/{product_id}/variants | 商品オプション一覧の取得 | +| [**get_products**](ProductApi.md#get_products) | **GET** /v1/products | 商品一覧の取得 | +| [**post_product_pickup**](ProductApi.md#post_product_pickup) | **POST** /v1/products/{product_id}/pickups | おすすめ商品情報の追加 | +| [**post_products**](ProductApi.md#post_products) | **POST** /v1/products | 商品データの追加 | +| [**put_product_pickup**](ProductApi.md#put_product_pickup) | **PUT** /v1/products/{product_id}/pickups | おすすめ商品情報の更新 | +| [**update_product**](ProductApi.md#update_product) | **PUT** /v1/products/{product_id} | 商品データの更新 | -# **delete_product_pickup** -> Object delete_product_pickup(product_id, pickup_type) +## delete_product_pickup + +> delete_product_pickup(product_id, pickup_type) おすすめ商品情報の削除 商品に付加されたおすすめ商品情報を削除します -### Example +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -33,24 +38,42 @@ product_id = 56 # Integer | 商品ID pickup_type = 56 # Integer | おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) begin - #おすすめ商品情報の削除 + # おすすめ商品情報の削除 result = api_instance.delete_product_pickup(product_id, pickup_type) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling ProductApi->delete_product_pickup: #{e}" + puts "Error when calling ProductApi->delete_product_pickup: #{e}" +end +``` + +#### Using the delete_product_pickup_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_product_pickup_with_http_info(product_id, pickup_type) + +```ruby +begin + # おすすめ商品情報の削除 + data, status_code, headers = api_instance.delete_product_pickup_with_http_info(product_id, pickup_type) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->delete_product_pickup_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **product_id** | **Integer**| 商品ID | - **pickup_type** | **Integer**| おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) | +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **Integer** | 商品ID | | +| **pickup_type** | **Integer** | おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) | | ### Return type -**Object** +[**PutProductPickup200Response**](PutProductPickup200Response.md) ### Authorization @@ -58,19 +81,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## get_product -# **get_product** -> Object get_product(product_id) +> get_product(product_id) 商品データの取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -82,23 +108,120 @@ api_instance = ColorMeShop::ProductApi.new product_id = 56 # Integer | 商品ID begin - #商品データの取得 + # 商品データの取得 result = api_instance.get_product(product_id) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling ProductApi->get_product: #{e}" + puts "Error when calling ProductApi->get_product: #{e}" +end +``` + +#### Using the get_product_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_product_with_http_info(product_id) + +```ruby +begin + # 商品データの取得 + data, status_code, headers = api_instance.get_product_with_http_info(product_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->get_product_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **Integer** | 商品ID | | + +### Return type + +[**PostProducts200Response**](PostProducts200Response.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_product_variants + +> get_product_variants(product_id, opts) + +商品オプション一覧の取得 + + + +### Examples + +```ruby +require 'time' +require 'color_me_shop' +# setup authorization +ColorMeShop.configure do |config| + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = ColorMeShop::ProductApi.new +product_id = 56 # Integer | 商品ID +opts = { + model_number: 'model_number_example', # String | 型番で部分一致検索 + fields: 'fields_example', # String | レスポンスJSONのキーをカンマ区切りで指定 + limit: 56, # Integer | レスポンスの件数を指定。指定がない場合は10。最大50 + offset: 56 # Integer | 指定した数値+1件目以降のデータを返す +} + +begin + # 商品オプション一覧の取得 + result = api_instance.get_product_variants(product_id, opts) + p result +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->get_product_variants: #{e}" +end +``` + +#### Using the get_product_variants_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_product_variants_with_http_info(product_id, opts) + +```ruby +begin + # 商品オプション一覧の取得 + data, status_code, headers = api_instance.get_product_variants_with_http_info(product_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->get_product_variants_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **product_id** | **Integer**| 商品ID | +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **Integer** | 商品ID | | +| **model_number** | **String** | 型番で部分一致検索 | [optional] | +| **fields** | **String** | レスポンスJSONのキーをカンマ区切りで指定 | [optional] | +| **limit** | **Integer** | レスポンスの件数を指定。指定がない場合は10。最大50 | [optional] | +| **offset** | **Integer** | 指定した数値+1件目以降のデータを返す | [optional] | ### Return type -**Object** +[**GetProductVariants200Response**](GetProductVariants200Response.md) ### Authorization @@ -106,19 +229,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## get_products -# **get_products** -> Object get_products(opts) +> get_products(opts) 商品一覧の取得 -### Example +商品一覧を取得します。 オプションやバリエーションの数が多い場合、レスポンスの返却に時間がかかる場合があります。 `fields` リクエストパラメータで必要なキーを指定することを推奨します。 + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -131,54 +257,74 @@ opts = { ids: 'ids_example', # String | 商品IDで検索。カンマ区切りにすることで複数検索が可能 category_id_big: 56, # Integer | 大カテゴリーIDで検索 category_id_small: 56, # Integer | 小カテゴリーIDで検索 + group_ids: 56, # Integer | グループIDで検索。カンマ区切りにすることで複数検索が可能 model_number: 'model_number_example', # String | 型番で部分一致検索 name: 'name_example', # String | 商品名で部分一致検索 - display_state: 'display_state_example', # String | 掲載設定で検索 - stocks: 56, # Integer | 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、合計在庫数で検索される - stock_managed: true, # BOOLEAN | 在庫管理している、またはしていない商品から検索 - recent_zero_stocks: true, # BOOLEAN | `true` の場合、過去1週間以内に更新された商品から検索 + display_state: 'showing', # String | 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + stocks: 56, # Integer | 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される + stock_managed: true, # Boolean | `true`の場合、在庫管理している商品を検索 + recent_zero_stocks: true, # Boolean | `true` の場合、過去1週間以内に更新された商品から検索 make_date_min: 'make_date_min_example', # String | 指定日時以降に作成された商品から検索 make_date_max: 'make_date_max_example', # String | 指定日時以前に作成された商品から検索 update_date_min: 'update_date_min_example', # String | 指定日時以降に更新された商品から検索 - update_date_max: 'update_date_max_example', # String | 指定日時以降に更新された商品から検索 + update_date_max: 'update_date_max_example', # String | 指定日時以前に更新された商品から検索 fields: 'fields_example', # String | レスポンスJSONのキーをカンマ区切りで指定 limit: 56, # Integer | レスポンスの件数を指定。指定がない場合は10。最大50 offset: 56 # Integer | 指定した数値+1件目以降のデータを返す } begin - #商品一覧の取得 + # 商品一覧の取得 result = api_instance.get_products(opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling ProductApi->get_products: #{e}" + puts "Error when calling ProductApi->get_products: #{e}" +end +``` + +#### Using the get_products_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_products_with_http_info(opts) + +```ruby +begin + # 商品一覧の取得 + data, status_code, headers = api_instance.get_products_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->get_products_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ids** | **String**| 商品IDで検索。カンマ区切りにすることで複数検索が可能 | [optional] - **category_id_big** | **Integer**| 大カテゴリーIDで検索 | [optional] - **category_id_small** | **Integer**| 小カテゴリーIDで検索 | [optional] - **model_number** | **String**| 型番で部分一致検索 | [optional] - **name** | **String**| 商品名で部分一致検索 | [optional] - **display_state** | **String**| 掲載設定で検索 | [optional] - **stocks** | **Integer**| 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、合計在庫数で検索される | [optional] - **stock_managed** | **BOOLEAN**| 在庫管理している、またはしていない商品から検索 | [optional] - **recent_zero_stocks** | **BOOLEAN**| `true` の場合、過去1週間以内に更新された商品から検索 | [optional] - **make_date_min** | **String**| 指定日時以降に作成された商品から検索 | [optional] - **make_date_max** | **String**| 指定日時以前に作成された商品から検索 | [optional] - **update_date_min** | **String**| 指定日時以降に更新された商品から検索 | [optional] - **update_date_max** | **String**| 指定日時以降に更新された商品から検索 | [optional] - **fields** | **String**| レスポンスJSONのキーをカンマ区切りで指定 | [optional] - **limit** | **Integer**| レスポンスの件数を指定。指定がない場合は10。最大50 | [optional] - **offset** | **Integer**| 指定した数値+1件目以降のデータを返す | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **String** | 商品IDで検索。カンマ区切りにすることで複数検索が可能 | [optional] | +| **category_id_big** | **Integer** | 大カテゴリーIDで検索 | [optional] | +| **category_id_small** | **Integer** | 小カテゴリーIDで検索 | [optional] | +| **group_ids** | **Integer** | グループIDで検索。カンマ区切りにすることで複数検索が可能 | [optional] | +| **model_number** | **String** | 型番で部分一致検索 | [optional] | +| **name** | **String** | 商品名で部分一致検索 | [optional] | +| **display_state** | **String** | 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **stocks** | **Integer** | 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される | [optional] | +| **stock_managed** | **Boolean** | `true`の場合、在庫管理している商品を検索 | [optional] | +| **recent_zero_stocks** | **Boolean** | `true` の場合、過去1週間以内に更新された商品から検索 | [optional] | +| **make_date_min** | **String** | 指定日時以降に作成された商品から検索 | [optional] | +| **make_date_max** | **String** | 指定日時以前に作成された商品から検索 | [optional] | +| **update_date_min** | **String** | 指定日時以降に更新された商品から検索 | [optional] | +| **update_date_max** | **String** | 指定日時以前に更新された商品から検索 | [optional] | +| **fields** | **String** | レスポンスJSONのキーをカンマ区切りで指定 | [optional] | +| **limit** | **Integer** | レスポンスの件数を指定。指定がない場合は10。最大50 | [optional] | +| **offset** | **Integer** | 指定した数値+1件目以降のデータを返す | [optional] | ### Return type -**Object** +[**GetProducts200Response**](GetProducts200Response.md) ### Authorization @@ -186,21 +332,162 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## post_product_pickup -# **post_product_pickup** -> Object post_product_pickup(product_id, unknown_base_type) +> post_product_pickup(product_id, put_product_pickup_request) おすすめ商品情報の追加 おすすめ商品情報(おすすめ商品、売れ筋商品、新着商品、イチオシ商品のいずれか)を商品に追加します。 -### Example +### Examples + +```ruby +require 'time' +require 'color_me_shop' +# setup authorization +ColorMeShop.configure do |config| + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = ColorMeShop::ProductApi.new +product_id = 56 # Integer | 商品ID +put_product_pickup_request = ColorMeShop::PutProductPickupRequest.new # PutProductPickupRequest | + +begin + # おすすめ商品情報の追加 + result = api_instance.post_product_pickup(product_id, put_product_pickup_request) + p result +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->post_product_pickup: #{e}" +end +``` + +#### Using the post_product_pickup_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> post_product_pickup_with_http_info(product_id, put_product_pickup_request) + +```ruby +begin + # おすすめ商品情報の追加 + data, status_code, headers = api_instance.post_product_pickup_with_http_info(product_id, put_product_pickup_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->post_product_pickup_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **Integer** | 商品ID | | +| **put_product_pickup_request** | [**PutProductPickupRequest**](PutProductPickupRequest.md) | | | + +### Return type + +[**PutProductPickup200Response**](PutProductPickup200Response.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## post_products + +> post_products(post_products_request) + +商品データの追加 + + + +### Examples + +```ruby +require 'time' +require 'color_me_shop' +# setup authorization +ColorMeShop.configure do |config| + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = ColorMeShop::ProductApi.new +post_products_request = ColorMeShop::PostProductsRequest.new # PostProductsRequest | 商品データ + +begin + # 商品データの追加 + result = api_instance.post_products(post_products_request) + p result +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->post_products: #{e}" +end +``` + +#### Using the post_products_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> post_products_with_http_info(post_products_request) + +```ruby +begin + # 商品データの追加 + data, status_code, headers = api_instance.post_products_with_http_info(post_products_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->post_products_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **post_products_request** | [**PostProductsRequest**](PostProductsRequest.md) | 商品データ | | + +### Return type + +[**PostProducts200Response**](PostProducts200Response.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## put_product_pickup + +> put_product_pickup(product_id, put_product_pickup_request) + +おすすめ商品情報の更新 + +おすすめ商品情報(おすすめ商品、売れ筋商品、新着商品、イチオシ商品のいずれか)を更新します。 + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -210,27 +497,45 @@ end api_instance = ColorMeShop::ProductApi.new product_id = 56 # Integer | 商品ID -unknown_base_type = ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | +put_product_pickup_request = ColorMeShop::PutProductPickupRequest.new # PutProductPickupRequest | begin - #おすすめ商品情報の追加 - result = api_instance.post_product_pickup(product_id, unknown_base_type) + # おすすめ商品情報の更新 + result = api_instance.put_product_pickup(product_id, put_product_pickup_request) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling ProductApi->post_product_pickup: #{e}" + puts "Error when calling ProductApi->put_product_pickup: #{e}" +end +``` + +#### Using the put_product_pickup_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> put_product_pickup_with_http_info(product_id, put_product_pickup_request) + +```ruby +begin + # おすすめ商品情報の更新 + data, status_code, headers = api_instance.put_product_pickup_with_http_info(product_id, put_product_pickup_request) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->put_product_pickup_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **product_id** | **Integer**| 商品ID | - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **Integer** | 商品ID | | +| **put_product_pickup_request** | [**PutProductPickupRequest**](PutProductPickupRequest.md) | | | ### Return type -**Object** +[**PutProductPickup200Response**](PutProductPickup200Response.md) ### Authorization @@ -238,19 +543,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json +## update_product -# **update_product** -> Object update_product(product_id, opts) +> update_product(product_id, opts) 商品データの更新 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -261,28 +569,46 @@ end api_instance = ColorMeShop::ProductApi.new product_id = 56 # Integer | 商品ID opts = { - product_update_request: ColorMeShop::ProductUpdateRequest.new # ProductUpdateRequest | 商品データ + update_product_request: ColorMeShop::UpdateProductRequest.new # UpdateProductRequest | 商品データ } begin - #商品データの更新 + # 商品データの更新 result = api_instance.update_product(product_id, opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling ProductApi->update_product: #{e}" + puts "Error when calling ProductApi->update_product: #{e}" +end +``` + +#### Using the update_product_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_product_with_http_info(product_id, opts) + +```ruby +begin + # 商品データの更新 + data, status_code, headers = api_instance.update_product_with_http_info(product_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ProductApi->update_product_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **product_id** | **Integer**| 商品ID | - **product_update_request** | [**ProductUpdateRequest**](ProductUpdateRequest.md)| 商品データ | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **Integer** | 商品ID | | +| **update_product_request** | [**UpdateProductRequest**](UpdateProductRequest.md) | 商品データ | [optional] | ### Return type -**Object** +[**PostProducts200Response**](PostProducts200Response.md) ### Authorization @@ -290,8 +616,6 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - - +- **Content-Type**: application/json +- **Accept**: application/json diff --git a/docs/ProductCategory.md b/docs/ProductCategory.md index e1f878f..9ba3665 100644 --- a/docs/ProductCategory.md +++ b/docs/ProductCategory.md @@ -1,18 +1,38 @@ # ColorMeShop::ProductCategory ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id_big** | **Integer** | 大カテゴリーID | [optional] -**id_small** | **Integer** | 小カテゴリーID。大カテゴリーのことを表している場合は0 | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**name** | **String** | 商品カテゴリー名 | [optional] -**image_url** | **String** | 商品カテゴリー画像URL | [optional] -**expl** | **String** | 商品カテゴリー説明 | [optional] -**sort** | **Integer** | 表示順 | [optional] -**display_state** | **String** | 掲載設定 | [optional] -**make_date** | **Integer** | 商品カテゴリー作成日時 | [optional] -**update_date** | **Integer** | 商品カテゴリー更新日時 | [optional] -**children** | [**Array<ProductCategory>**](ProductCategory.md) | 子カテゴリー情報。子カテゴリーのことを表している場合はこのキーはレスポンスに含まれない | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id_big** | **Integer** | 大カテゴリーID | [optional] | +| **id_small** | **Integer** | 小カテゴリーID。大カテゴリーのことを表している場合は0 | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 商品カテゴリー名 | [optional] | +| **image_url** | **String** | 商品カテゴリー画像URL | [optional] | +| **expl** | **String** | 商品カテゴリー説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `members_only`: 会員にのみ掲載 | [optional] | +| **make_date** | **Integer** | 商品カテゴリー作成日時 | [optional] | +| **update_date** | **Integer** | 商品カテゴリー更新日時 | [optional] | +| **children** | [**Array<GetProductCategories200ResponseCategoriesInnerChildrenInner>**](GetProductCategories200ResponseCategoriesInnerChildrenInner.md) | 子カテゴリー | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ProductCategory.new( + id_big: 9923, + id_small: 0, + account_id: PA01234567, + name: Tシャツ, + image_url: null, + expl: null, + sort: 2, + display_state: showing, + make_date: 1465784944, + update_date: 1494496809, + children: [] +) +``` diff --git a/docs/ProductCategoryChild.md b/docs/ProductCategoryChild.md new file mode 100644 index 0000000..fca5247 --- /dev/null +++ b/docs/ProductCategoryChild.md @@ -0,0 +1,36 @@ +# ColorMeShop::ProductCategoryChild + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id_big** | **Integer** | 大カテゴリーID | [optional] | +| **id_small** | **Integer** | 小カテゴリーID。大カテゴリーのことを表している場合は0 | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 商品カテゴリー名 | [optional] | +| **image_url** | **String** | 商品カテゴリー画像URL | [optional] | +| **expl** | **String** | 商品カテゴリー説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `members_only`: 会員にのみ掲載 | [optional] | +| **make_date** | **Integer** | 商品カテゴリー作成日時 | [optional] | +| **update_date** | **Integer** | 商品カテゴリー更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ProductCategoryChild.new( + id_big: 9923, + id_small: 0, + account_id: PA01234567, + name: Tシャツ, + image_url: null, + expl: null, + sort: 2, + display_state: showing, + make_date: 1465784944, + update_date: 1494496809 +) +``` + diff --git a/docs/ProductCreateRequest.md b/docs/ProductCreateRequest.md new file mode 100644 index 0000000..10e977c --- /dev/null +++ b/docs/ProductCreateRequest.md @@ -0,0 +1,18 @@ +# ColorMeShop::ProductCreateRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product** | [**PostProductsRequestProduct**](PostProductsRequestProduct.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ProductCreateRequest.new( + product: null +) +``` + diff --git a/docs/ProductGroup.md b/docs/ProductGroup.md index 00abf54..a827cda 100644 --- a/docs/ProductGroup.md +++ b/docs/ProductGroup.md @@ -1,14 +1,32 @@ # ColorMeShop::ProductGroup ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 商品グループID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**name** | **String** | 商品グループ名 | [optional] -**image_url** | **String** | 商品グループ画像URL | [optional] -**expl** | **String** | 商品グループ説明 | [optional] -**sort** | **Integer** | 表示順 | [optional] -**display_state** | **String** | 掲載設定 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 商品グループID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | 商品グループ名 | [optional] | +| **image_url** | **String** | 商品グループ画像URL | [optional] | +| **expl** | **String** | 商品グループ説明 | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **parent_group_id** | **Integer** | 親の商品グループID | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ProductGroup.new( + id: 9923, + account_id: PA01234567, + name: 夏物, + image_url: null, + expl: 暑い夏を涼しく乗り切る、当店イチオシの夏物衣類, + sort: 2, + display_state: showing, + parent_group_id: 9923 +) +``` diff --git a/docs/ProductOption.md b/docs/ProductOption.md index edf0c00..ec20603 100644 --- a/docs/ProductOption.md +++ b/docs/ProductOption.md @@ -1,14 +1,30 @@ # ColorMeShop::ProductOption ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | オプションID | [optional] -**product_id** | **Integer** | 商品ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**name** | **String** | オプション名 | [optional] -**values** | **Array<String>** | オプション値の配列 | [optional] -**make_date** | **Integer** | オプション作成日時 | [optional] -**update_date** | **Integer** | オプション更新日時 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | オプションID | [optional] | +| **product_id** | **Integer** | 商品ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **name** | **String** | オプション名 | [optional] | +| **values** | **Array<String>** | オプション値の配列 | [optional] | +| **make_date** | **Integer** | オプション作成日時 | [optional] | +| **update_date** | **Integer** | オプション更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ProductOption.new( + id: 539903, + product_id: 1342332, + account_id: PA01234567, + name: 色, + values: ["赤","白"], + make_date: 1465784944, + update_date: 1494496809 +) +``` diff --git a/docs/ProductPickup.md b/docs/ProductPickup.md index 3463107..0010c00 100644 --- a/docs/ProductPickup.md +++ b/docs/ProductPickup.md @@ -1,13 +1,28 @@ # ColorMeShop::ProductPickup ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**pickup_type** | **Integer** | おすすめ商品情報種別 | [optional] -**product_id** | **Integer** | 商品ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**order_num** | **Integer** | 商品の表示順 | [optional] -**make_date** | **Integer** | 作成日時 | [optional] -**update_date** | **Integer** | 更新日時 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pickup_type** | **Integer** | おすすめ商品情報種別 | [optional] | +| **product_id** | **Integer** | 商品ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **order_num** | **Integer** | 商品の表示順 | [optional] | +| **make_date** | **Integer** | 作成日時 | [optional] | +| **update_date** | **Integer** | 更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ProductPickup.new( + pickup_type: 0, + product_id: 1342332, + account_id: PA00000000, + order_num: 1, + make_date: 1465784944, + update_date: 1494496809 +) +``` diff --git a/docs/ProductUpdateRequest.md b/docs/ProductUpdateRequest.md index cb8726a..9f97b98 100644 --- a/docs/ProductUpdateRequest.md +++ b/docs/ProductUpdateRequest.md @@ -1,8 +1,18 @@ # ColorMeShop::ProductUpdateRequest ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**product** | **Object** | | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product** | [**UpdateProductRequestProduct**](UpdateProductRequestProduct.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ProductUpdateRequest.new( + product: null +) +``` diff --git a/docs/ProductVariant.md b/docs/ProductVariant.md index 9cbb440..c9cd5e3 100644 --- a/docs/ProductVariant.md +++ b/docs/ProductVariant.md @@ -1,19 +1,48 @@ # ColorMeShop::ProductVariant ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**product_id** | **Integer** | 商品ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**option1_value** | **String** | オプション1の値 | [optional] -**option2_value** | **String** | オプション2の値 | [optional] -**title** | **String** | オプション1とオプション2の名前を\" x \"で結合した表示名。オプションが1つしか設定されていない場合はそのオプションの名前に等しい | [optional] -**stocks** | **Integer** | 在庫数 | [optional] -**few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] -**model_number** | **String** | 型番 | [optional] -**option_price** | **Integer** | 販売価格 | [optional] -**option_members_price** | **Integer** | 会員価格 | [optional] -**make_date** | **Integer** | オプション作成日時 | [optional] -**update_date** | **Integer** | オプション更新日時 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product_id** | **Integer** | 商品ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **option1_value** | **String** | オプション1の値 | [optional] | +| **option2_value** | **String** | オプション2の値 | [optional] | +| **title** | **String** | オプション1とオプション2の名前を\" x \"で結合した表示名。オプションが1つしか設定されていない場合はそのオプションの名前に等しい | [optional] | +| **stocks** | **Integer** | 在庫数 | [optional] | +| **few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] | +| **model_number** | **String** | 型番 | [optional] | +| **option_price** | **Integer** | 販売価格 | [optional] | +| **option_price_including_tax** | **Integer** | 消費税込販売価格 | [optional] | +| **option_price_tax** | **Integer** | 消費税額 | [optional] | +| **option_members_price** | **Integer** | 会員価格 | [optional] | +| **option_members_price_including_tax** | **Integer** | 消費税込会員価格 | [optional] | +| **option_members_price_tax** | **Integer** | 会員価格の消費税額 | [optional] | +| **make_date** | **Integer** | オプション作成日時 | [optional] | +| **update_date** | **Integer** | オプション更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ProductVariant.new( + product_id: 1342332, + account_id: PA01234567, + option1_value: 赤, + option2_value: S, + title: 赤 x S, + stocks: 20, + few_num: 5, + model_number: T-RED-S-223, + option_price: 1980, + option_price_including_tax: 2178, + option_price_tax: 198, + option_members_price: 100, + option_members_price_including_tax: 110, + option_members_price_tax: 10, + make_date: 1465784944, + update_date: 1494496809 +) +``` diff --git a/docs/PutProductPickup200Response.md b/docs/PutProductPickup200Response.md new file mode 100644 index 0000000..175de70 --- /dev/null +++ b/docs/PutProductPickup200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::PutProductPickup200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pickup** | [**PutProductPickup200ResponsePickup**](PutProductPickup200ResponsePickup.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PutProductPickup200Response.new( + pickup: null +) +``` + diff --git a/docs/PutProductPickup200ResponsePickup.md b/docs/PutProductPickup200ResponsePickup.md new file mode 100644 index 0000000..56cb429 --- /dev/null +++ b/docs/PutProductPickup200ResponsePickup.md @@ -0,0 +1,28 @@ +# ColorMeShop::PutProductPickup200ResponsePickup + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pickup_type** | **Integer** | おすすめ商品情報種別 | [optional] | +| **product_id** | **Integer** | 商品ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **order_num** | **Integer** | 商品の表示順 | [optional] | +| **make_date** | **Integer** | 作成日時 | [optional] | +| **update_date** | **Integer** | 更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PutProductPickup200ResponsePickup.new( + pickup_type: 0, + product_id: 1342332, + account_id: PA00000000, + order_num: 1, + make_date: 1465784944, + update_date: 1494496809 +) +``` + diff --git a/docs/PutProductPickupRequest.md b/docs/PutProductPickupRequest.md new file mode 100644 index 0000000..85ab6e5 --- /dev/null +++ b/docs/PutProductPickupRequest.md @@ -0,0 +1,20 @@ +# ColorMeShop::PutProductPickupRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **pickup_type** | **Integer** | おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) | [optional] | +| **order_num** | **Integer** | 商品の表示順 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::PutProductPickupRequest.new( + pickup_type: null, + order_num: null +) +``` + diff --git a/docs/RecurringApplicationCharge.md b/docs/RecurringApplicationCharge.md deleted file mode 100644 index f8d0f86..0000000 --- a/docs/RecurringApplicationCharge.md +++ /dev/null @@ -1,16 +0,0 @@ -# ColorMeShop::RecurringApplicationCharge - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 課金ID | [optional] -**account_id** | **String** | アカウントID | [optional] -**oauth_application_id** | **Integer** | アプリケーションID | [optional] -**recurring_application_charge_plan_id** | **Integer** | 課金プランID | [optional] -**return_url** | **String** | ショップオーナー様が課金の許可/拒否を行った後に遷移するURL | [optional] -**status** | **String** | ステータス | [optional] -**billing_on** | **Date** | 次回請求日 | [optional] -**make_date** | **Integer** | 作成日時 | [optional] -**update_date** | **Integer** | 更新日時 | [optional] - - diff --git a/docs/RecurringApplicationChargeCreateResponse.md b/docs/RecurringApplicationChargeCreateResponse.md deleted file mode 100644 index 4caca59..0000000 --- a/docs/RecurringApplicationChargeCreateResponse.md +++ /dev/null @@ -1,17 +0,0 @@ -# ColorMeShop::RecurringApplicationChargeCreateResponse - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 課金ID | [optional] -**account_id** | **String** | アカウントID | [optional] -**oauth_application_id** | **Integer** | アプリケーションID | [optional] -**recurring_application_charge_plan_id** | **Integer** | 課金プランID | [optional] -**return_url** | **String** | ショップオーナー様が課金の許可/拒否を行った後に遷移するURL | [optional] -**confirmation_url** | **String** | ショップオーナー様が課金のOK/NGを行う確認画面ページのURLです。 URLには課金IDとsignatureを含んでいます。 | [optional] -**status** | **String** | ステータス | [optional] -**billing_on** | **Date** | 次回請求日 | [optional] -**make_date** | **Integer** | 作成日時 | [optional] -**update_date** | **Integer** | 更新日時 | [optional] - - diff --git a/docs/Sale.md b/docs/Sale.md index 694e284..76fe54d 100644 --- a/docs/Sale.md +++ b/docs/Sale.md @@ -1,47 +1,102 @@ # ColorMeShop::Sale ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 売上ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**make_date** | **Integer** | 受注日時 | [optional] -**update_date** | **Integer** | 受注更新日時 | [optional] -**memo** | **String** | 備考 | [optional] -**payment_id** | **Integer** | 使用された決済方法ID | [optional] -**mobile** | **BOOLEAN** | モバイルからの注文であるか否か | [optional] -**paid** | **BOOLEAN** | 入金済みであるか否か | [optional] -**delivered** | **BOOLEAN** | 発送済みである否か | [optional] -**canceled** | **BOOLEAN** | キャンセル済みであるか否か | [optional] -**accepted_mail_state** | **String** | 受注メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] -**paid_mail_state** | **String** | 入金メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] -**delivered_mail_state** | **String** | 発送メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] -**accepted_mail_sent_date** | **Integer** | 受注メールの送信日時 | [optional] -**paid_mail_sent_date** | **Integer** | 入金メールの送信日時 | [optional] -**delivered_mail_sent_date** | **Integer** | 発送メールの送信日時 | [optional] -**point_state** | **String** | ショップポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] -**gmo_point_state** | **String** | GMOポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] -**yahoo_point_state** | **String** | Yahooポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] -**product_total_price** | **Integer** | 商品の合計金額 | [optional] -**delivery_total_charge** | **Integer** | 配送料 | [optional] -**fee** | **Integer** | 決済手数料 | [optional] -**tax** | **Integer** | 商品合計金額に対する消費税 | [optional] -**noshi_total_charge** | **Integer** | 熨斗料金 | [optional] -**card_total_charge** | **Integer** | メッセージカード料金 | [optional] -**wrapping_total_charge** | **Integer** | ラッピング料金 | [optional] -**point_discount** | **Integer** | ショップポイントによる割引額 | [optional] -**gmo_point_discount** | **Integer** | GMOポイントによる割引額 | [optional] -**other_discount** | **Integer** | その他、クーポン等による割引額 | [optional] -**other_discount_name** | **String** | その他割引の名称 | [optional] -**total_price** | **Integer** | 注文総額 | [optional] -**granted_points** | **Integer** | 付与されたショップポイント数 | [optional] -**use_points** | **Integer** | 使用されたショップポイント数 | [optional] -**granted_gmo_points** | **Integer** | 付与されたGMOポイント数 | [optional] -**use_gmo_points** | **Integer** | 使用されたGMOポイント数 | [optional] -**granted_yahoo_points** | **Integer** | 付与されたYahooポイント数 | [optional] -**use_yahoo_points** | **Integer** | 使用されたYahooポイント数 | [optional] -**customer** | [**Customer**](Customer.md) | | [optional] -**details** | [**Array<SaleDetail>**](SaleDetail.md) | | [optional] -**sale_deliveries** | [**Array<SaleDelivery>**](SaleDelivery.md) | | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 売上ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **make_date** | **Integer** | 受注日時 | [optional] | +| **update_date** | **Integer** | 受注更新日時 | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **payment_id** | **Integer** | 使用された決済方法ID | [optional] | +| **mobile** | **Boolean** | モバイルからの注文であるか否か | [optional] | +| **paid** | **Boolean** | 入金済みであるか否か | [optional] | +| **delivered** | **Boolean** | 発送済みである否か | [optional] | +| **canceled** | **Boolean** | キャンセル済みであるか否か | [optional] | +| **accepted_mail_state** | **String** | 受注メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **paid_mail_state** | **String** | 入金メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **delivered_mail_state** | **String** | 発送メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **accepted_mail_sent_date** | **Integer** | 受注メールの送信日時 | [optional] | +| **paid_mail_sent_date** | **Integer** | 入金メールの送信日時 | [optional] | +| **delivered_mail_sent_date** | **Integer** | 発送メールの送信日時 | [optional] | +| **point_state** | **String** | ショップポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **gmo_point_state** | **String** | GMOポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **yahoo_point_state** | **String** | Yahooポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み | [optional] | +| **product_total_price** | **Integer** | 商品の合計金額 | [optional] | +| **delivery_total_charge** | **Integer** | 配送料 | [optional] | +| **fee** | **Integer** | 決済手数料 | [optional] | +| **tax** | **Integer** | 商品合計金額に対する消費税 | [optional] | +| **noshi_total_charge** | **Integer** | 熨斗料金 | [optional] | +| **card_total_charge** | **Integer** | メッセージカード料金 | [optional] | +| **wrapping_total_charge** | **Integer** | ラッピング料金 | [optional] | +| **point_discount** | **Integer** | ショップポイントによる割引額 | [optional] | +| **gmo_point_discount** | **Integer** | GMOポイントによる割引額 | [optional] | +| **other_discount** | **Integer** | その他、クーポン等による割引額 | [optional] | +| **other_discount_name** | **String** | その他割引の名称 | [optional] | +| **total_price** | **Integer** | 注文総額 | [optional] | +| **granted_points** | **Integer** | 付与されたショップポイント数 | [optional] | +| **use_points** | **Integer** | 使用されたショップポイント数 | [optional] | +| **granted_gmo_points** | **Integer** | 付与されたGMOポイント数 | [optional] | +| **use_gmo_points** | **Integer** | 使用されたGMOポイント数 | [optional] | +| **granted_yahoo_points** | **Integer** | 付与されたYahooポイント数 | [optional] | +| **use_yahoo_points** | **Integer** | 使用されたYahooポイント数 | [optional] | +| **external_order_id** | **String** | 外部システムで発行された決済識別番号 該当受注の決済が、楽天ペイ(オンライン決済)、LINE Pay、PayPal Commerce Platform、Amazon Pay、Amazon Pay V2、Square対面決済のいずれかである場合、その決済の決済識別番号を返します。 それ以外の決済に関しては空文字列を返します。 | [optional] | +| **customer** | [**GetSales200ResponseSalesInnerCustomer**](GetSales200ResponseSalesInnerCustomer.md) | | [optional] | +| **details** | [**Array<GetSales200ResponseSalesInnerDetailsInner>**](GetSales200ResponseSalesInnerDetailsInner.md) | | [optional] | +| **sale_deliveries** | [**Array<GetSales200ResponseSalesInnerSaleDeliveriesInner>**](GetSales200ResponseSalesInnerSaleDeliveriesInner.md) | | [optional] | +| **segment** | [**GetSales200ResponseSalesInnerSegment**](GetSales200ResponseSalesInnerSegment.md) | | [optional] | +| **totals** | [**GetSales200ResponseSalesInnerTotals**](GetSales200ResponseSalesInnerTotals.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::Sale.new( + id: 4434233, + account_id: PAXXXXXXXX, + make_date: 1465784934, + update_date: 1494496895, + memo: null, + payment_id: 751, + mobile: false, + paid: true, + delivered: true, + canceled: false, + accepted_mail_state: null, + paid_mail_state: null, + delivered_mail_state: null, + accepted_mail_sent_date: 1363152822, + paid_mail_sent_date: 1363153288, + delivered_mail_sent_date: 1363154591, + point_state: null, + gmo_point_state: null, + yahoo_point_state: null, + product_total_price: 1000, + delivery_total_charge: 350, + fee: 300, + tax: 80, + noshi_total_charge: 0, + card_total_charge: 200, + wrapping_total_charge: 0, + point_discount: 0, + gmo_point_discount: 0, + other_discount: 0, + other_discount_name: , + total_price: 1930, + granted_points: 100, + use_points: 0, + granted_gmo_points: 0, + use_gmo_points: 0, + granted_yahoo_points: 0, + use_yahoo_points: 0, + external_order_id: ABC0123456789, + customer: null, + details: null, + sale_deliveries: null, + segment: null, + totals: null +) +``` diff --git a/docs/SaleApi.md b/docs/SaleApi.md index 0b162c0..732cef4 100644 --- a/docs/SaleApi.md +++ b/docs/SaleApi.md @@ -2,26 +2,28 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**cancel_sale**](SaleApi.md#cancel_sale) | **PUT** /v1/sales/{saleId}/cancel.json | 受注のキャンセル -[**get_sale**](SaleApi.md#get_sale) | **GET** /v1/sales/{saleId}.json | 受注データの取得 -[**get_sales**](SaleApi.md#get_sales) | **GET** /v1/sales.json | 受注データのリストを取得 -[**send_sales_mail**](SaleApi.md#send_sales_mail) | **POST** /v1/sales/{saleId}/mails.json | メールの送信 -[**stat_sale**](SaleApi.md#stat_sale) | **GET** /v1/sales/stat.json | 売上集計の取得 -[**update_sale**](SaleApi.md#update_sale) | **PUT** /v1/sales/{saleId}.json | 受注データの更新 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**cancel_sale**](SaleApi.md#cancel_sale) | **PUT** /v1/sales/{sale_id}/cancel | 受注のキャンセル | +| [**get_sale**](SaleApi.md#get_sale) | **GET** /v1/sales/{sale_id} | 受注データの取得 | +| [**get_sales**](SaleApi.md#get_sales) | **GET** /v1/sales | 受注データのリストを取得 | +| [**send_sales_mail**](SaleApi.md#send_sales_mail) | **POST** /v1/sales/{sale_id}/mails | メールの送信 | +| [**stat_sale**](SaleApi.md#stat_sale) | **GET** /v1/sales/stat | 売上集計の取得 | +| [**update_sale**](SaleApi.md#update_sale) | **PUT** /v1/sales/{sale_id} | 受注データの更新 | -# **cancel_sale** -> Object cancel_sale(sale_id, opts) +## cancel_sale + +> cancel_sale(sale_id, opts) 受注のキャンセル -受注をキャンセルすると、以下のことが起こります。 - 該当受注の商品購入数が0になる - 該当受注の合計金額が0になる - 該当受注の`canceled`が`true`になる - 該当受注に使用されたショップポイント・GMOポイントがキャンセルされる - 該当受注の決済がAmazon Pay、または楽天ペイ(オンライン決済)である場合は、決済金額が自動的に購入者へ返金される - カラメル等の販売手数料が0になる +受注をキャンセルすると、以下のことが起こります。 - 該当受注の商品購入数が0になる - 該当受注の合計金額が0になる - 該当受注の`canceled`が`true`になる - 該当受注に使用されたショップポイント・GMOポイントがキャンセルされる - 該当受注の決済がAmazon Pay、LINE Pay、または楽天ペイ(オンライン決済)である場合は、決済金額が自動的に購入者へ返金される - 該当受注の決済がPayPay(イプシロン)である場合には、イプシロン側の決済もキャンセルされる - ショップポイントがキャンセルされる 販売手数料確定前の場合は以下のことが起こります。 - 販売手数料が0になる - 付与したGMOポイントがキャンセルされる - 購入者が使用したGMOポイントがキャンセルされる 現在、以下の機能はサポートしていません。 - キャンセル連動設定を利用した、クレジット(イプシロン)決済のキャンセル - 分割された受注のキャンセル + +### Examples -### Example ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -32,28 +34,46 @@ end api_instance = ColorMeShop::SaleApi.new sale_id = 56 # Integer | opts = { - unknown_base_type: ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | + cancel_sale_request: ColorMeShop::CancelSaleRequest.new # CancelSaleRequest | } begin - #受注のキャンセル + # 受注のキャンセル result = api_instance.cancel_sale(sale_id, opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling SaleApi->cancel_sale: #{e}" + puts "Error when calling SaleApi->cancel_sale: #{e}" +end +``` + +#### Using the cancel_sale_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> cancel_sale_with_http_info(sale_id, opts) + +```ruby +begin + # 受注のキャンセル + data, status_code, headers = api_instance.cancel_sale_with_http_info(sale_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling SaleApi->cancel_sale_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sale_id** | **Integer**| | - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sale_id** | **Integer** | | | +| **cancel_sale_request** | [**CancelSaleRequest**](CancelSaleRequest.md) | | [optional] | ### Return type -**Object** +[**UpdateSale200Response**](UpdateSale200Response.md) ### Authorization @@ -61,19 +81,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json +## get_sale -# **get_sale** -> Object get_sale(sale_id) +> get_sale(sale_id) 受注データの取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -85,23 +108,41 @@ api_instance = ColorMeShop::SaleApi.new sale_id = 56 # Integer | begin - #受注データの取得 + # 受注データの取得 result = api_instance.get_sale(sale_id) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling SaleApi->get_sale: #{e}" + puts "Error when calling SaleApi->get_sale: #{e}" +end +``` + +#### Using the get_sale_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_sale_with_http_info(sale_id) + +```ruby +begin + # 受注データの取得 + data, status_code, headers = api_instance.get_sale_with_http_info(sale_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling SaleApi->get_sale_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sale_id** | **Integer**| | +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sale_id** | **Integer** | | | ### Return type -**Object** +[**GetSale200Response**](GetSale200Response.md) ### Authorization @@ -109,19 +150,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## get_sales -# **get_sales** -> Object get_sales(opts) +> get_sales(opts) 受注データのリストを取得 -### Example +受注データのリストを取得します。(日付が指定されていない場合は直近1週間分を取得します。) + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -132,66 +176,86 @@ end api_instance = ColorMeShop::SaleApi.new opts = { ids: 'ids_example', # String | 受注IDで検索。カンマ区切りで複数指定可能 - after: 'after_example', # String | 指定日時以降の受注から検索 + after: 'after_example', # String | 指定日時以降の受注から検索。 `after` 未指定時は `before` の指定日時の7日前の0時、 `before` 未指定時は現在から7日前の0時がデフォルト値となります。 before: 'before_example', # String | 指定日時以前の受注から検索 make_date_min: 'make_date_min_example', # String | `after`と同義 make_date_max: 'make_date_max_example', # String | `before`と同義 update_date_min: 'update_date_min_example', # String | 指定日時以降に更新された受注から検索 - update_date_max: 'update_date_max_example', # String | 指定日時以降に更新された受注から検索 + update_date_max: 'update_date_max_example', # String | 指定日時以前に更新された受注から検索 customer_ids: 'customer_ids_example', # String | 購入した顧客IDで検索。カンマ区切りにすることで複数検索が可能 customer_name: 'customer_name_example', # String | 購入した顧客名で部分一致検索 customer_furigana: 'customer_furigana_example', # String | 購入した顧客フリガナがで部分一致検索 customer_mail: 'customer_mail_example', # String | 購入した顧客メールアドレスで部分一致検索 - accepted_mail_state: 56, # Integer | 受注メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - paid_mail_state: 56, # Integer | 入金メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - delivered_mail_state: 56, # Integer | 配送メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - mobile: true, # BOOLEAN | `true`なら携帯からの受注のみ取得 - paid: true, # BOOLEAN | `true`なら入金済みの受注のみ取得 - delivered: true, # BOOLEAN | `true`なら配送済みの受注のみ取得 + accepted_mail_state: 'not_yet', # String | 受注メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + paid_mail_state: 'not_yet', # String | 入金メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + delivered_mail_state: 'not_yet', # String | 配送メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + mobile: true, # Boolean | `true`なら携帯からの受注のみ取得 + paid: true, # Boolean | `true`なら入金済みの受注のみ取得 + delivered: true, # Boolean | `true`なら配送済みの受注のみ取得 + canceled: true, # Boolean | `true`ならキャンセル済みの受注のみ取得 payment_ids: 'payment_ids_example', # String | 使用された決済のIDで検索。カンマ区切りで複数指定可能 fields: 'fields_example', # String | レスポンスJSONのキーをカンマ区切りで指定 - limit: 56, # Integer | レスポンスの件数を指定。指定がない場合は10。最大50 + limit: 56, # Integer | レスポンスの件数を指定。指定がない場合は10。最大100 offset: 56 # Integer | 指定した数値+1件目以降のデータを返す } begin - #受注データのリストを取得 + # 受注データのリストを取得 result = api_instance.get_sales(opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling SaleApi->get_sales: #{e}" + puts "Error when calling SaleApi->get_sales: #{e}" +end +``` + +#### Using the get_sales_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_sales_with_http_info(opts) + +```ruby +begin + # 受注データのリストを取得 + data, status_code, headers = api_instance.get_sales_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling SaleApi->get_sales_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ids** | **String**| 受注IDで検索。カンマ区切りで複数指定可能 | [optional] - **after** | **String**| 指定日時以降の受注から検索 | [optional] - **before** | **String**| 指定日時以前の受注から検索 | [optional] - **make_date_min** | **String**| `after`と同義 | [optional] - **make_date_max** | **String**| `before`と同義 | [optional] - **update_date_min** | **String**| 指定日時以降に更新された受注から検索 | [optional] - **update_date_max** | **String**| 指定日時以降に更新された受注から検索 | [optional] - **customer_ids** | **String**| 購入した顧客IDで検索。カンマ区切りにすることで複数検索が可能 | [optional] - **customer_name** | **String**| 購入した顧客名で部分一致検索 | [optional] - **customer_furigana** | **String**| 購入した顧客フリガナがで部分一致検索 | [optional] - **customer_mail** | **String**| 購入した顧客メールアドレスで部分一致検索 | [optional] - **accepted_mail_state** | **Integer**| 受注メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない | [optional] - **paid_mail_state** | **Integer**| 入金メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない | [optional] - **delivered_mail_state** | **Integer**| 配送メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない | [optional] - **mobile** | **BOOLEAN**| `true`なら携帯からの受注のみ取得 | [optional] - **paid** | **BOOLEAN**| `true`なら入金済みの受注のみ取得 | [optional] - **delivered** | **BOOLEAN**| `true`なら配送済みの受注のみ取得 | [optional] - **payment_ids** | **String**| 使用された決済のIDで検索。カンマ区切りで複数指定可能 | [optional] - **fields** | **String**| レスポンスJSONのキーをカンマ区切りで指定 | [optional] - **limit** | **Integer**| レスポンスの件数を指定。指定がない場合は10。最大50 | [optional] - **offset** | **Integer**| 指定した数値+1件目以降のデータを返す | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **String** | 受注IDで検索。カンマ区切りで複数指定可能 | [optional] | +| **after** | **String** | 指定日時以降の受注から検索。 `after` 未指定時は `before` の指定日時の7日前の0時、 `before` 未指定時は現在から7日前の0時がデフォルト値となります。 | [optional] | +| **before** | **String** | 指定日時以前の受注から検索 | [optional] | +| **make_date_min** | **String** | `after`と同義 | [optional] | +| **make_date_max** | **String** | `before`と同義 | [optional] | +| **update_date_min** | **String** | 指定日時以降に更新された受注から検索 | [optional] | +| **update_date_max** | **String** | 指定日時以前に更新された受注から検索 | [optional] | +| **customer_ids** | **String** | 購入した顧客IDで検索。カンマ区切りにすることで複数検索が可能 | [optional] | +| **customer_name** | **String** | 購入した顧客名で部分一致検索 | [optional] | +| **customer_furigana** | **String** | 購入した顧客フリガナがで部分一致検索 | [optional] | +| **customer_mail** | **String** | 購入した顧客メールアドレスで部分一致検索 | [optional] | +| **accepted_mail_state** | **String** | 受注メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **paid_mail_state** | **String** | 入金メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **delivered_mail_state** | **String** | 配送メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない | [optional] | +| **mobile** | **Boolean** | `true`なら携帯からの受注のみ取得 | [optional] | +| **paid** | **Boolean** | `true`なら入金済みの受注のみ取得 | [optional] | +| **delivered** | **Boolean** | `true`なら配送済みの受注のみ取得 | [optional] | +| **canceled** | **Boolean** | `true`ならキャンセル済みの受注のみ取得 | [optional] | +| **payment_ids** | **String** | 使用された決済のIDで検索。カンマ区切りで複数指定可能 | [optional] | +| **fields** | **String** | レスポンスJSONのキーをカンマ区切りで指定 | [optional] | +| **limit** | **Integer** | レスポンスの件数を指定。指定がない場合は10。最大100 | [optional] | +| **offset** | **Integer** | 指定した数値+1件目以降のデータを返す | [optional] | ### Return type -**Object** +[**GetSales200Response**](GetSales200Response.md) ### Authorization @@ -199,21 +263,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## send_sales_mail -# **send_sales_mail** > send_sales_mail(sale_id, opts) メールの送信 -受注・入金確認・商品発送メールを送ることができます。 +受注・入金確認・商品発送メールを送ることができます。 対象の受注が分割されている場合、 受注メール、入金確認メールは、親受注でのみ指定可能です。 + +### Examples -### Example ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -224,23 +289,41 @@ end api_instance = ColorMeShop::SaleApi.new sale_id = 56 # Integer | opts = { - unknown_base_type: ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | + send_sales_mail_request: ColorMeShop::SendSalesMailRequest.new # SendSalesMailRequest | } begin - #メールの送信 + # メールの送信 api_instance.send_sales_mail(sale_id, opts) rescue ColorMeShop::ApiError => e - puts "Exception when calling SaleApi->send_sales_mail: #{e}" + puts "Error when calling SaleApi->send_sales_mail: #{e}" +end +``` + +#### Using the send_sales_mail_with_http_info variant + +This returns an Array which contains the response data (`nil` in this case), status code and headers. + +> send_sales_mail_with_http_info(sale_id, opts) + +```ruby +begin + # メールの送信 + data, status_code, headers = api_instance.send_sales_mail_with_http_info(sale_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => nil +rescue ColorMeShop::ApiError => e + puts "Error when calling SaleApi->send_sales_mail_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sale_id** | **Integer**| | - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sale_id** | **Integer** | | | +| **send_sales_mail_request** | [**SendSalesMailRequest**](SendSalesMailRequest.md) | | [optional] | ### Return type @@ -252,19 +335,22 @@ nil (empty response body) ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined +## stat_sale -# **stat_sale** -> Object stat_sale(opts) +> stat_sale(opts) 売上集計の取得 -### Example + + +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -278,23 +364,41 @@ opts = { } begin - #売上集計の取得 + # 売上集計の取得 result = api_instance.stat_sale(opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling SaleApi->stat_sale: #{e}" + puts "Error when calling SaleApi->stat_sale: #{e}" +end +``` + +#### Using the stat_sale_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> stat_sale_with_http_info(opts) + +```ruby +begin + # 売上集計の取得 + data, status_code, headers = api_instance.stat_sale_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling SaleApi->stat_sale_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **make_date** | **String**| 集計対象とする売上の作成日。形式は\"2017-04-12\"、\"2017/04/12\"など。指定しない場合は今日の日付が使われる | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **make_date** | **String** | 集計対象とする売上の作成日。形式は\"2017-04-12\"、\"2017/04/12\"など。指定しない場合は今日の日付が使われる | [optional] | ### Return type -**Object** +[**StatSale200Response**](StatSale200Response.md) ### Authorization @@ -302,21 +406,22 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json +## update_sale -# **update_sale** -> Object update_sale(sale_id, opts) +> update_sale(sale_id, opts) 受注データの更新 -該当受注の決済がAmazon Pay、または楽天ペイ(オンライン決済)である場合は、熨斗・メッセージカード・ラッピングの手数料を更新すると、決済金額が自動的に購入者に請求もしくは返金されます。 +該当受注の決済がAmazon Pay、LINE Pay、または楽天ペイ(オンライン決済)である場合は、熨斗・メッセージカード・ラッピングの手数料を更新すると、決済金額が自動的に購入者に請求もしくは返金されます。 ただし、LINE Payの場合は、決済金額の変更は減額のみ行うことができます。 + +### Examples -### Example ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -327,28 +432,46 @@ end api_instance = ColorMeShop::SaleApi.new sale_id = 56 # Integer | opts = { - unknown_base_type: ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | + update_sale_request: ColorMeShop::UpdateSaleRequest.new # UpdateSaleRequest | } begin - #受注データの更新 + # 受注データの更新 result = api_instance.update_sale(sale_id, opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling SaleApi->update_sale: #{e}" + puts "Error when calling SaleApi->update_sale: #{e}" +end +``` + +#### Using the update_sale_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_sale_with_http_info(sale_id, opts) + +```ruby +begin + # 受注データの更新 + data, status_code, headers = api_instance.update_sale_with_http_info(sale_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling SaleApi->update_sale_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sale_id** | **Integer**| | - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sale_id** | **Integer** | | | +| **update_sale_request** | [**UpdateSaleRequest**](UpdateSaleRequest.md) | | [optional] | ### Return type -**Object** +[**UpdateSale200Response**](UpdateSale200Response.md) ### Authorization @@ -356,8 +479,6 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json - - +- **Content-Type**: application/json +- **Accept**: application/json diff --git a/docs/SaleDelivery.md b/docs/SaleDelivery.md index e7123fd..bc700a6 100644 --- a/docs/SaleDelivery.md +++ b/docs/SaleDelivery.md @@ -1,34 +1,72 @@ # ColorMeShop::SaleDelivery ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 配送ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**sale_id** | **Integer** | 売上ID | [optional] -**delivery_id** | **Integer** | 使用された配送方法ID | [optional] -**detail_ids** | **Array<Integer>** | この配送に含まれる受注明細IDの配列 | [optional] -**name** | **String** | 宛名 | [optional] -**furigana** | **String** | 宛名のフリガナ | [optional] -**postal** | **String** | 郵便番号 | [optional] -**pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47 | [optional] -**pref_name** | **String** | 都道府県名 | [optional] -**address1** | **String** | 住所1 | [optional] -**address2** | **String** | 住所2 | [optional] -**tel** | **String** | 電話番号 | [optional] -**preferred_date** | **String** | 配送希望日 | [optional] -**preferred_period** | **String** | 配送希望時間帯 | [optional] -**slip_number** | **String** | 配送伝票番号 | [optional] -**noshi_text** | **String** | 熨斗の文言 | [optional] -**noshi_charge** | **Integer** | 熨斗の料金 | [optional] -**card_name** | **String** | メッセージカードの表示名 | [optional] -**card_text** | **String** | メッセージカードのテキスト | [optional] -**card_charge** | **Integer** | メッセージカードの料金 | [optional] -**wrapping_name** | **String** | ラッピングの表示名 | [optional] -**wrapping_charge** | **Integer** | ラッピングの料金 | [optional] -**delivery_charge** | **Integer** | 配送料 | [optional] -**total_charge** | **Integer** | 配送料・手数料の小計 | [optional] -**memo** | **String** | 備考 | [optional] -**delivered** | **BOOLEAN** | 発送済みであるか否か | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | お届け先ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **sale_id** | **Integer** | 売上ID | [optional] | +| **delivery_id** | **Integer** | 使用された配送方法ID | [optional][readonly] | +| **detail_ids** | **Array<Integer>** | この配送に含まれる受注明細IDの配列 | [optional] | +| **name** | **String** | 宛名 | [optional] | +| **furigana** | **String** | 宛名のフリガナ | [optional] | +| **postal** | **String** | 郵便番号 | [optional] | +| **pref_id** | **Integer** | 都道府県の通し番号。北海道が1、沖縄が47 | [optional] | +| **pref_name** | **String** | 都道府県名 | [optional] | +| **address1** | **String** | 住所1 | [optional] | +| **address2** | **String** | 住所2 | [optional] | +| **tel** | **String** | 電話番号 | [optional] | +| **preferred_date** | **String** | 配送希望日 | [optional] | +| **preferred_period** | **String** | 配送希望時間帯 | [optional] | +| **slip_number** | **String** | 配送伝票番号 | [optional] | +| **noshi_text** | **String** | 熨斗の文言 | [optional] | +| **noshi_charge** | **Integer** | 熨斗の料金 | [optional] | +| **card_name** | **String** | メッセージカードの表示名 | [optional] | +| **card_text** | **String** | メッセージカードのテキスト | [optional] | +| **card_charge** | **Integer** | メッセージカードの料金 | [optional] | +| **wrapping_name** | **String** | ラッピングの表示名 | [optional] | +| **wrapping_charge** | **Integer** | ラッピングの料金 | [optional] | +| **delivery_charge** | **Integer** | 配送料 | [optional] | +| **total_charge** | **Integer** | 配送料・手数料の小計 | [optional] | +| **tracking_url** | **String** | 配送状況確認URL | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **delivered** | **Boolean** | 発送済みであるか否か | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::SaleDelivery.new( + id: 1173289, + account_id: PA01234567, + sale_id: 4434233, + delivery_id: 113922, + detail_ids: [44344599], + name: ペパボ太郎, + furigana: ペパボタロウ, + postal: 1508512, + pref_id: 13, + pref_name: 東京都, + address1: 渋谷区桜丘町26-1, + address2: セルリアンタワー, + tel: null, + preferred_date: 2017-05-21, + preferred_period: 午前中, + slip_number: 1234-5678-9012, + noshi_text: 寿, + noshi_charge: 100, + card_name: バースデーカード, + card_text: おめでとう, + card_charge: 150, + wrapping_name: ギフト用ラッピング(ピンク), + wrapping_charge: 200, + delivery_charge: 350, + total_charge: 800, + tracking_url: https://example.com/delivery_state?id=111-222-33333, + memo: null, + delivered: false +) +``` diff --git a/docs/SaleDetail.md b/docs/SaleDetail.md index afde7df..25cedb5 100644 --- a/docs/SaleDetail.md +++ b/docs/SaleDetail.md @@ -1,27 +1,58 @@ # ColorMeShop::SaleDetail ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | 受注明細ID | [optional] -**sale_id** | **Integer** | 売上ID | [optional] -**account_id** | **String** | ショップアカウントID | [optional] -**product_id** | **Integer** | 商品ID | [optional] -**sale_delivery_id** | **Integer** | 配送ID | [optional] -**option1_value** | **String** | オプション1の値 | [optional] -**option2_value** | **String** | オプション2の値 | [optional] -**option1_index** | **Integer** | オプション1の値の選択肢中の位置 | [optional] -**option2_index** | **String** | オプション2の値の選択肢中の位置 | [optional] -**product_model_number** | **String** | 型番 | [optional] -**product_name** | **String** | 商品名 | [optional] -**product_cost** | **Integer** | 商品原価 | [optional] -**product_image_url** | **String** | 商品画像URL | [optional] -**product_thumbnail_image_url** | **String** | サムネイル用商品画像URL | [optional] -**product_mobile_image_url** | **String** | モバイル用商品画像URL | [optional] -**price** | **Integer** | 商品販売価格 | [optional] -**price_with_tax** | **Integer** | 税込み商品価格 | [optional] -**product_num** | **Integer** | 商品点数 | [optional] -**unit** | **String** | 単位 | [optional] -**subtotal_price** | **Integer** | 商品小計。販売価格と点数の積 | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | 受注明細ID | [optional] | +| **sale_id** | **Integer** | 売上ID | [optional] | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **product_id** | **Integer** | 商品ID | [optional] | +| **sale_delivery_id** | **Integer** | お届け先ID | [optional] | +| **option1_value** | **String** | オプション1の値(最新の商品情報) | [optional] | +| **option2_value** | **String** | オプション2の値(最新の商品情報) | [optional] | +| **option1_index** | **Integer** | オプション1の値の選択肢中の位置 | [optional] | +| **option2_index** | **Integer** | オプション2の値の選択肢中の位置 | [optional] | +| **product_model_number** | **String** | 型番 | [optional] | +| **product_name** | **String** | 商品名(最新の商品情報) | [optional] | +| **pristine_product_full_name** | **String** | 商品名とオプション名(注文時の商品情報) | [optional] | +| **product_cost** | **Integer** | 商品原価 | [optional] | +| **product_image_url** | **String** | 商品画像URL | [optional] | +| **product_thumbnail_image_url** | **String** | サムネイル用商品画像URL | [optional] | +| **product_mobile_image_url** | **String** | モバイル用商品画像URL | [optional] | +| **price** | **Integer** | 商品販売価格 | [optional] | +| **price_with_tax** | **Integer** | 税込み商品価格 | [optional] | +| **product_num** | **Integer** | 商品点数 | [optional] | +| **unit** | **String** | 単位 | [optional] | +| **subtotal_price** | **Integer** | 商品小計。販売価格と点数の積 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::SaleDetail.new( + id: 44344599, + sale_id: 4434233, + account_id: PA01234567, + product_id: 1342332, + sale_delivery_id: 1173289, + option1_value: 赤, + option2_value: Sサイズ, + option1_index: 0, + option2_index: 0, + product_model_number: T-RED-S-223, + product_name: Tシャツ, + pristine_product_full_name: Tシャツ(カラー:赤、サイズ:Sサイズ), + product_cost: 1000, + product_image_url: https://img07.shop-pro.jp/XXX/XX/product/123.jpg?20130319164314, + product_thumbnail_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_th.jpg?20130319164314, + product_mobile_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_mb.jpg?20130319164314, + price: 1680, + price_with_tax: 1814, + product_num: 1, + unit: 枚, + subtotal_price: 1814 +) +``` diff --git a/docs/ScriptApi.md b/docs/ScriptApi.md deleted file mode 100644 index 4e0114d..0000000 --- a/docs/ScriptApi.md +++ /dev/null @@ -1,250 +0,0 @@ -# ColorMeShop::ScriptApi - -All URIs are relative to *https://api.shop-pro.jp* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**create_script_tag**](ScriptApi.md#create_script_tag) | **POST** /v1/script_tags.json | スクリプトタグの作成 -[**delete_script_tag**](ScriptApi.md#delete_script_tag) | **DELETE** /v1/script_tags/{scriptTagId}.json | スクリプトタグの削除 -[**get_script_tag**](ScriptApi.md#get_script_tag) | **GET** /v1/script_tags/{scriptTagId}.json | スクリプトタグの取得 -[**get_script_tags**](ScriptApi.md#get_script_tags) | **GET** /v1/script_tags.json | スクリプトタグの取得 -[**update_script_tag**](ScriptApi.md#update_script_tag) | **PUT** /v1/script_tags/{scriptTagId}.json | スクリプトタグの更新 - - -# **create_script_tag** -> Object create_script_tag(unknown_base_type) - -スクリプトタグの作成 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ScriptApi.new -unknown_base_type = ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | 作成するスクリプトタグの情報 - -begin - #スクリプトタグの作成 - result = api_instance.create_script_tag(unknown_base_type) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ScriptApi->create_script_tag: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| 作成するスクリプトタグの情報 | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - - -# **delete_script_tag** -> delete_script_tag(script_tag_id) - -スクリプトタグの削除 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ScriptApi.new -script_tag_id = 56 # Integer | - -begin - #スクリプトタグの削除 - api_instance.delete_script_tag(script_tag_id) -rescue ColorMeShop::ApiError => e - puts "Exception when calling ScriptApi->delete_script_tag: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **script_tag_id** | **Integer**| | - -### Return type - -nil (empty response body) - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - - - -# **get_script_tag** -> Object get_script_tag(script_tag_id) - -スクリプトタグの取得 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ScriptApi.new -script_tag_id = 56 # Integer | - -begin - #スクリプトタグの取得 - result = api_instance.get_script_tag(script_tag_id) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ScriptApi->get_script_tag: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **script_tag_id** | **Integer**| | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **get_script_tags** -> Object get_script_tags - -スクリプトタグの取得 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ScriptApi.new - -begin - #スクリプトタグの取得 - result = api_instance.get_script_tags - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ScriptApi->get_script_tags: #{e}" -end -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - - -# **update_script_tag** -> Object update_script_tag(script_tag_id, unknown_base_type) - -スクリプトタグの更新 - -### Example -```ruby -# load the gem -require 'color_me_shop' -# setup authorization -ColorMeShop.configure do |config| - # Configure OAuth2 access token for authorization: OAuth2 - config.access_token = 'YOUR ACCESS TOKEN' -end - -api_instance = ColorMeShop::ScriptApi.new -script_tag_id = 56 # Integer | -unknown_base_type = ColorMeShop::UNKNOWN_BASE_TYPE.new # UNKNOWN_BASE_TYPE | 作成するスクリプトタグの情報 - -begin - #スクリプトタグの更新 - result = api_instance.update_script_tag(script_tag_id, unknown_base_type) - p result -rescue ColorMeShop::ApiError => e - puts "Exception when calling ScriptApi->update_script_tag: #{e}" -end -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **script_tag_id** | **Integer**| | - **unknown_base_type** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| 作成するスクリプトタグの情報 | - -### Return type - -**Object** - -### Authorization - -[OAuth2](../README.md#OAuth2) - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - - - diff --git a/docs/ScriptTag.md b/docs/ScriptTag.md deleted file mode 100644 index 1ceb223..0000000 --- a/docs/ScriptTag.md +++ /dev/null @@ -1,12 +0,0 @@ -# ColorMeShop::ScriptTag - -## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **Integer** | スクリプトタグID | [optional] -**src** | **String** | スクリプトURL | [optional] -**display_scope** | **String** | スクリプトを出力するページ。 - `all`: ショップページと注文完了ページの両方 - `shop`: ショップページ - `thanks_page`: 注文完了ページ | [optional] -**make_date** | **Integer** | 作成日時 | [optional] -**update_date** | **Integer** | 更新日時 | [optional] - - diff --git a/docs/SendSalesMailRequest.md b/docs/SendSalesMailRequest.md new file mode 100644 index 0000000..8e5b01e --- /dev/null +++ b/docs/SendSalesMailRequest.md @@ -0,0 +1,18 @@ +# ColorMeShop::SendSalesMailRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **mail** | [**SendSalesMailRequestMail**](SendSalesMailRequestMail.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::SendSalesMailRequest.new( + mail: null +) +``` + diff --git a/docs/SendSalesMailRequestMail.md b/docs/SendSalesMailRequestMail.md new file mode 100644 index 0000000..4612edc --- /dev/null +++ b/docs/SendSalesMailRequestMail.md @@ -0,0 +1,18 @@ +# ColorMeShop::SendSalesMailRequestMail + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **type** | **String** | 送信するメールの種類 - `accepted`: 受注メールを送信する - `paid`: 入金確認メールを送信する - `delivered`: 商品発送メールを送信する | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::SendSalesMailRequestMail.new( + type: null +) +``` + diff --git a/docs/Shop.md b/docs/Shop.md index 80f9a11..5926aa7 100644 --- a/docs/Shop.md +++ b/docs/Shop.md @@ -1,39 +1,90 @@ # ColorMeShop::Shop ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **String** | ショップアカウントID | [optional] -**state** | **String** | アカウント状態 | [optional] -**domain_plan** | **String** | ドメインプラン | [optional] -**contract_plan** | **String** | 契約プラン | [optional] -**contract_start_date** | **Integer** | 契約開始日時 | [optional] -**contract_end_date** | **Integer** | 契約終了日時 | [optional] -**contract_term** | **Integer** | 契約期間 | [optional] -**last_login_date** | **Integer** | 最終ログイン日時 | [optional] -**setup_date** | **Integer** | 申し込み完了日時 | [optional] -**make_date** | **Integer** | アカウント作成日時 | [optional] -**url** | **String** | ショップURL | [optional] -**open_state** | **String** | 開店状態 | [optional] -**mobile_open_state** | **String** | モバイルショップ開店状態 | [optional] -**login_id** | **String** | ログインID | [optional] -**name1** | **String** | 登録者氏名(姓) | [optional] -**name2** | **String** | 登録者氏名(名) | [optional] -**name1_kana** | **String** | 登録者氏名カナ(姓) | [optional] -**name2_kana** | **String** | 登録者氏名カナ(名) | [optional] -**hojin** | **String** | 法人名 | [optional] -**hojin_kana** | **String** | 法人名カナ | [optional] -**user_mail** | **String** | 登録者メールアドレス | [optional] -**tel** | **String** | 登録者電話番号 | [optional] -**fax** | **String** | 登録者FAX番号 | [optional] -**postal** | **String** | 郵便番号 | [optional] -**pref_id** | **Integer** | 都道府県ID | [optional] -**pref_name** | **String** | 都道府県名 | [optional] -**address1** | **String** | 住所1 | [optional] -**address2** | **String** | 住所2 | [optional] -**title** | **String** | ショップ名 | [optional] -**title_short** | **String** | メールタイトル用ショップ名 | [optional] -**shop_mail_1** | **String** | 管理者メールアドレス | [optional] -**shop_mail_2** | **String** | 管理者携帯メールアドレス | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | ショップアカウントID | [optional] | +| **state** | **String** | アカウント状態 | [optional] | +| **domain_plan** | **String** | ドメインプラン | [optional] | +| **contract_plan** | **String** | 契約プラン | [optional] | +| **contract_start_date** | **Integer** | 契約開始日時 | [optional] | +| **contract_end_date** | **Integer** | 契約終了日時 | [optional] | +| **contract_term** | **Integer** | 契約期間 | [optional] | +| **last_login_date** | **Integer** | 最終ログイン日時 | [optional] | +| **setup_date** | **Integer** | 申し込み完了日時 | [optional] | +| **make_date** | **Integer** | アカウント作成日時 | [optional] | +| **url** | **String** | ショップURL | [optional] | +| **open_state** | **String** | 開店状態 | [optional] | +| **mobile_open_state** | **String** | モバイルショップ開店状態 | [optional] | +| **login_id** | **String** | ログインID | [optional] | +| **name1** | **String** | 登録者氏名(姓) | [optional] | +| **name2** | **String** | 登録者氏名(名) | [optional] | +| **name1_kana** | **String** | 登録者氏名カナ(姓) | [optional] | +| **name2_kana** | **String** | 登録者氏名カナ(名) | [optional] | +| **hojin** | **String** | 法人名 | [optional] | +| **hojin_kana** | **String** | 法人名カナ | [optional] | +| **user_mail** | **String** | 登録者メールアドレス | [optional] | +| **tel** | **String** | 登録者電話番号 | [optional] | +| **fax** | **String** | 登録者FAX番号 | [optional] | +| **postal** | **String** | 郵便番号 | [optional] | +| **pref_id** | **Integer** | 都道府県ID | [optional] | +| **pref_name** | **String** | 都道府県名 | [optional] | +| **address1** | **String** | 住所1 | [optional] | +| **address2** | **String** | 住所2 | [optional] | +| **title** | **String** | ショップ名 | [optional] | +| **title_short** | **String** | メールタイトル用ショップ名 | [optional] | +| **shop_mail_1** | **String** | 管理者メールアドレス | [optional] | +| **shop_mail_2** | **String** | 管理者携帯メールアドレス | [optional] | +| **tax_type** | **String** | 消費税の内税・外税設定 | [optional] | +| **tax** | **Integer** | 消費税率 | [optional] | +| **tax_rounding_method** | **String** | 消費税の切り捨て、切り上げ設定 | [optional] | +| **reduce_tax_rate** | **Integer** | 軽減税率 | [optional] | +| **shop_logo_url** | **String** | ショップロゴ画像のURL | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::Shop.new( + id: PAXXXXXXXX, + state: null, + domain_plan: null, + contract_plan: null, + contract_start_date: 1546268400, + contract_end_date: 1577718000, + contract_term: 12, + last_login_date: 1570750709, + setup_date: 1511747460, + make_date: 1511747460, + url: https://example.shop-pro.jp, + open_state: null, + mobile_open_state: null, + login_id: testshop, + name1: 山田, + name2: 太郎, + name1_kana: ヤマダ, + name2_kana: タロウ, + hojin: , + hojin_kana: , + user_mail: tarou@example.com, + tel: 11-1111-1111, + fax: null, + postal: 1508512, + pref_id: 13, + pref_name: 東京都, + address1: 渋谷区桜丘町, + address2: 26-1 セルリアンタワー, + title: テスト商店, + title_short: テスト商店, + shop_mail_1: shop@example.com, + shop_mail_2: shop-phone@example.com, + tax_type: null, + tax: 10, + tax_rounding_method: null, + reduce_tax_rate: 8, + shop_logo_url: https://img00.shop-pro.jp/PA00000/001/PA00000001.png?cmsp_timestamp=20201201214110 +) +``` diff --git a/docs/ShopApi.md b/docs/ShopApi.md index e0a44ca..c59868f 100644 --- a/docs/ShopApi.md +++ b/docs/ShopApi.md @@ -2,21 +2,23 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_shop**](ShopApi.md#get_shop) | **GET** /v1/shop.json | ショップ情報の取得 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_shop**](ShopApi.md#get_shop) | **GET** /v1/shop | ショップ情報の取得 | -# **get_shop** -> Object get_shop +## get_shop + +> get_shop ショップ情報の取得 ショップ名などの基本的な情報を取得することができるAPIです。 -### Example +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -27,20 +29,39 @@ end api_instance = ColorMeShop::ShopApi.new begin - #ショップ情報の取得 + # ショップ情報の取得 result = api_instance.get_shop p result rescue ColorMeShop::ApiError => e - puts "Exception when calling ShopApi->get_shop: #{e}" + puts "Error when calling ShopApi->get_shop: #{e}" +end +``` + +#### Using the get_shop_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_shop_with_http_info + +```ruby +begin + # ショップ情報の取得 + data, status_code, headers = api_instance.get_shop_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ShopApi->get_shop_with_http_info: #{e}" end ``` ### Parameters + This endpoint does not need any parameter. ### Return type -**Object** +[**GetShop200Response**](GetShop200Response.md) ### Authorization @@ -48,8 +69,6 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json - - +- **Content-Type**: Not defined +- **Accept**: application/json diff --git a/docs/ShopCoupon.md b/docs/ShopCoupon.md new file mode 100644 index 0000000..676dafc --- /dev/null +++ b/docs/ShopCoupon.md @@ -0,0 +1,44 @@ +# ColorMeShop::ShopCoupon + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **Integer** | Coupon ID | [optional] | +| **name** | **String** | クーポン名 | [optional] | +| **code** | **String** | クーポンコード | [optional] | +| **coupon_type** | **String** | クーポン種別 - `amount`: 定額 - `rate`: 定率 - `delivery_charge`: 送料無料 | [optional] | +| **discount_amount** | **Integer** | 割引金額または割引率 | [optional] | +| **minimum_amount** | **Integer** | 利用最低額 | [optional] | +| **starts_at** | **Integer** | 利用開始日 | [optional] | +| **ends_at** | **Integer** | 利用終了日 | [optional] | +| **total_usage_limit** | **Integer** | 総利用可能数 | [optional] | +| **usage_limit** | **String** | ユーザ毎の利用可能数 - `indisposable`: 無制限 - `disposable`: 一度のみ | [optional] | +| **group_limit_type** | **String** | 商品グループによる制限 - `none`: 無制限 - `including`: 含む - `excluding`: 除外 | [optional] | +| **status** | **String** | クーポンの利用可否 - `unavailable`: 利用不可 - `available`: 利用可能 | [optional] | +| **created_at** | **Integer** | 作成日時 | [optional] | +| **updated_at** | **Integer** | 更新日時 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::ShopCoupon.new( + id: 187239, + name: 100円割引, + code: descount100, + coupon_type: null, + discount_amount: 50, + minimum_amount: 1000, + starts_at: 1465784934, + ends_at: 1465784934, + total_usage_limit: 10, + usage_limit: null, + group_limit_type: null, + status: null, + created_at: 1465784934, + updated_at: 1465784934 +) +``` + diff --git a/docs/ShopCouponApi.md b/docs/ShopCouponApi.md new file mode 100644 index 0000000..77769ba --- /dev/null +++ b/docs/ShopCouponApi.md @@ -0,0 +1,144 @@ +# ColorMeShop::ShopCouponApi + +All URIs are relative to *https://api.shop-pro.jp* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_coupon**](ShopCouponApi.md#get_coupon) | **GET** /v1/shop_coupons/{coupon_id} | ショップクーポンの取得 | +| [**get_coupons**](ShopCouponApi.md#get_coupons) | **GET** /v1/shop_coupons | ショップクーポン一覧取得 | + + +## get_coupon + +> get_coupon(coupon_id) + +ショップクーポンの取得 + + + +### Examples + +```ruby +require 'time' +require 'color_me_shop' +# setup authorization +ColorMeShop.configure do |config| + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = ColorMeShop::ShopCouponApi.new +coupon_id = 56 # Integer | Coupon ID + +begin + # ショップクーポンの取得 + result = api_instance.get_coupon(coupon_id) + p result +rescue ColorMeShop::ApiError => e + puts "Error when calling ShopCouponApi->get_coupon: #{e}" +end +``` + +#### Using the get_coupon_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_coupon_with_http_info(coupon_id) + +```ruby +begin + # ショップクーポンの取得 + data, status_code, headers = api_instance.get_coupon_with_http_info(coupon_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ShopCouponApi->get_coupon_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **coupon_id** | **Integer** | Coupon ID | | + +### Return type + +[**GetCoupon200Response**](GetCoupon200Response.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_coupons + +> get_coupons + +ショップクーポン一覧取得 + + + +### Examples + +```ruby +require 'time' +require 'color_me_shop' +# setup authorization +ColorMeShop.configure do |config| + # Configure OAuth2 access token for authorization: OAuth2 + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = ColorMeShop::ShopCouponApi.new + +begin + # ショップクーポン一覧取得 + result = api_instance.get_coupons + p result +rescue ColorMeShop::ApiError => e + puts "Error when calling ShopCouponApi->get_coupons: #{e}" +end +``` + +#### Using the get_coupons_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_coupons_with_http_info + +```ruby +begin + # ショップクーポン一覧取得 + data, status_code, headers = api_instance.get_coupons_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling ShopCouponApi->get_coupons_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**GetCoupons200Response**](GetCoupons200Response.md) + +### Authorization + +[OAuth2](../README.md#OAuth2) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + diff --git a/docs/StatSale200Response.md b/docs/StatSale200Response.md new file mode 100644 index 0000000..fb72071 --- /dev/null +++ b/docs/StatSale200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::StatSale200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sales_stat** | [**StatSale200ResponseSalesStat**](StatSale200ResponseSalesStat.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::StatSale200Response.new( + sales_stat: null +) +``` + diff --git a/docs/StatSale200ResponseSalesStat.md b/docs/StatSale200ResponseSalesStat.md new file mode 100644 index 0000000..10a3213 --- /dev/null +++ b/docs/StatSale200ResponseSalesStat.md @@ -0,0 +1,32 @@ +# ColorMeShop::StatSale200ResponseSalesStat + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **date** | **Integer** | 集計対象とする売上の作成日 | [optional] | +| **amount_today** | **Integer** | 合計売上金額 | [optional] | +| **count_today** | **Integer** | 合計件数 | [optional] | +| **amount_last_7days** | **Integer** | `date`を含む過去7日間の合計売上金額 | [optional] | +| **count_last_7days** | **Integer** | `date`を含む過去7日間の合計件数 | [optional] | +| **amount_this_month** | **Integer** | `date`が含まれる月の合計売上金額 | [optional] | +| **count_this_month** | **Integer** | `date`が含まれる月の合計件数 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::StatSale200ResponseSalesStat.new( + account_id: PA01234567, + date: 1363151732, + amount_today: 15000, + count_today: 5, + amount_last_7days: 100000, + count_last_7days: 10, + amount_this_month: 220000, + count_this_month: 44 +) +``` + diff --git a/docs/Stock.md b/docs/Stock.md index a1e3542..d4dbbdd 100644 --- a/docs/Stock.md +++ b/docs/Stock.md @@ -1,41 +1,91 @@ # ColorMeShop::Stock ## Properties -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account_id** | **String** | ショップアカウントID | [optional] -**product_id** | **Integer** | 商品ID | [optional] -**name** | **String** | 商品名 | [optional] -**option1_value** | **String** | オプション1の値 | [optional] -**option2_value** | **String** | オプション2の値 | [optional] -**stocks** | **Integer** | 在庫数 | [optional] -**few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] -**model_number** | **String** | 型番 | [optional] -**category** | **Object** | | [optional] -**display_state** | **String** | 掲載設定 | [optional] -**sales_price** | **Integer** | 販売価格 | [optional] -**price** | **Integer** | 定価 | [optional] -**members_price** | **Integer** | 会員価格 | [optional] -**cost** | **Integer** | 原価 | [optional] -**delivery_charge** | **Integer** | 個別送料 | [optional] -**min_num** | **Integer** | 最小購入数量 | [optional] -**max_num** | **Integer** | 最大購入数量 | [optional] -**sale_start_date** | **Integer** | 掲載開始時刻 | [optional] -**sale_end_date** | **Integer** | 掲載終了時刻 | [optional] -**unit** | **String** | 単位 | [optional] -**weight** | **Integer** | 重量(グラム単位) | [optional] -**soldout_display** | **BOOLEAN** | 売り切れているときもショップに表示するか | [optional] -**sort** | **Integer** | 表示順 | [optional] -**simple_expl** | **String** | 簡易説明 | [optional] -**expl** | **String** | 商品説明 | [optional] -**mobile_expl** | **String** | フィーチャーフォン向けショップの商品説明 | [optional] -**smartphone_expl** | **String** | スマホ向けショップの商品説明 | [optional] -**make_date** | **Integer** | 商品作成日時 | [optional] -**update_date** | **Integer** | 商品更新日時 | [optional] -**memo** | **String** | 備考 | [optional] -**image_url** | **String** | メインの商品画像URL | [optional] -**mobile_image_url** | **String** | メインの商品画像のモバイル用URL | [optional] -**thumbnail_image_url** | **String** | メインの商品画像のサムネイルURL | [optional] -**images** | **Array<Object>** | メインの商品画像以外の3つの画像に関する、PC用とモバイル用の画像URL | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **account_id** | **String** | ショップアカウントID | [optional] | +| **product_id** | **Integer** | 商品ID | [optional] | +| **name** | **String** | 商品名 | [optional] | +| **option1_value** | **String** | オプション1の値 | [optional] | +| **option2_value** | **String** | オプション2の値 | [optional] | +| **stocks** | **Integer** | 在庫数 | [optional] | +| **few_num** | **Integer** | 残りわずかとなる在庫数 | [optional] | +| **model_number** | **String** | 型番 | [optional] | +| **variant_model_number** | **String** | オプションの型番 | [optional] | +| **category** | [**GetProducts200ResponseProductsInnerCategory**](GetProducts200ResponseProductsInnerCategory.md) | | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **sales_price** | **Integer** | 販売価格 | [optional] | +| **price** | **Integer** | 定価 | [optional] | +| **members_price** | **Integer** | 会員価格 | [optional] | +| **cost** | **Integer** | 原価 | [optional] | +| **delivery_charge** | **Integer** | 個別送料 | [optional] | +| **cool_charge** | **Integer** | クール便の追加料金 | [optional] | +| **min_num** | **Integer** | 最小購入数量 | [optional] | +| **max_num** | **Integer** | 最大購入数量 | [optional] | +| **sale_start_date** | **Integer** | 掲載開始時刻 | [optional] | +| **sale_end_date** | **Integer** | 掲載終了時刻 | [optional] | +| **unit** | **String** | 単位 | [optional] | +| **weight** | **Integer** | 重量(グラム単位) | [optional] | +| **soldout_display** | **Boolean** | 売り切れているときもショップに表示するか | [optional] | +| **sort** | **Integer** | 表示順 | [optional] | +| **simple_expl** | **String** | 簡易説明 | [optional] | +| **expl** | **String** | 商品説明 | [optional] | +| **mobile_expl** | **String** | フィーチャーフォン向けショップの商品説明 | [optional] | +| **smartphone_expl** | **String** | スマホ向けショップの商品説明 | [optional] | +| **make_date** | **Integer** | 商品作成日時 | [optional] | +| **update_date** | **Integer** | 商品更新日時 | [optional] | +| **memo** | **String** | 備考 | [optional] | +| **image_url** | **String** | メインの商品画像URL | [optional] | +| **mobile_image_url** | **String** | メインの商品画像のモバイル用URL | [optional] | +| **thumbnail_image_url** | **String** | メインの商品画像のサムネイルURL | [optional] | +| **images** | [**Array<GetStocks200ResponseStocksInnerImagesInner>**](GetStocks200ResponseStocksInnerImagesInner.md) | メインの商品画像以外の3つの画像に関する、PC用とモバイル用の画像URL | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::Stock.new( + account_id: PA01234567, + product_id: 1342332, + name: Tシャツ, + option1_value: 白, + option2_value: Sサイズ, + stocks: 20, + few_num: 5, + model_number: T-WHITE-S-223, + variant_model_number: T-WHITE-S-223-WITH-NAME, + category: null, + display_state: showing, + sales_price: 1980, + price: null, + members_price: 1680, + cost: null, + delivery_charge: null, + cool_charge: null, + min_num: null, + max_num: null, + sale_start_date: null, + sale_end_date: null, + unit: 個, + weight: null, + soldout_display: true, + sort: 2, + simple_expl: 素材にこだわってつくった、弊社の人気商品です。, + expl: 綿100%のこだわりTシャツです。 + +肌触りや吸水性の良さにみなさま驚かれます。弊社の人気商品です。 +, + mobile_expl: null, + smartphone_expl: null, + make_date: 1465784934, + update_date: 1494496895, + memo: , + image_url: https://img07.shop-pro.jp/XXX/XX/product/123.jpg?20130319164314, + mobile_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_mb.jpg?20130319164314, + thumbnail_image_url: https://img07.shop-pro.jp/XXX/XX/product/123_th.jpg?20130319164314, + images: null +) +``` diff --git a/docs/StockApi.md b/docs/StockApi.md index 5c5aed6..b951b8b 100644 --- a/docs/StockApi.md +++ b/docs/StockApi.md @@ -2,21 +2,23 @@ All URIs are relative to *https://api.shop-pro.jp* -Method | HTTP request | Description -------------- | ------------- | ------------- -[**get_stocks**](StockApi.md#get_stocks) | **GET** /v1/stocks.json | 在庫情報の取得 +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**get_stocks**](StockApi.md#get_stocks) | **GET** /v1/stocks | 在庫情報の取得 | -# **get_stocks** -> Object get_stocks(opts) +## get_stocks + +> get_stocks(opts) 在庫情報の取得 在庫情報を商品名や型番で検索できるAPIです。 -### Example +### Examples + ```ruby -# load the gem +require 'time' require 'color_me_shop' # setup authorization ColorMeShop.configure do |config| @@ -31,42 +33,60 @@ opts = { category_id_small: 56, # Integer | 小カテゴリーIDで検索 model_number: 'model_number_example', # String | 型番で部分一致検索 name: 'name_example', # String | 商品名で部分一致検索 - display_state: 'display_state_example', # String | 掲載設定で検索 - stocks: 56, # Integer | 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、合計在庫数で検索される - recent_zero_stocks: true, # BOOLEAN | `true` の場合、過去1週間以内に更新された商品から検索 + display_state: 'showing', # String | 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + stocks: 56, # Integer | 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される + recent_zero_stocks: true, # Boolean | `true` の場合、過去1週間以内にオプションが更新された商品から検索 fields: 'fields_example', # String | レスポンスJSONのキーをカンマ区切りで指定 limit: 56, # Integer | レスポンスの件数を指定。指定がない場合は10。最大50 offset: 56 # Integer | 指定した数値+1件目以降のデータを返す } begin - #在庫情報の取得 + # 在庫情報の取得 result = api_instance.get_stocks(opts) p result rescue ColorMeShop::ApiError => e - puts "Exception when calling StockApi->get_stocks: #{e}" + puts "Error when calling StockApi->get_stocks: #{e}" +end +``` + +#### Using the get_stocks_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_stocks_with_http_info(opts) + +```ruby +begin + # 在庫情報の取得 + data, status_code, headers = api_instance.get_stocks_with_http_info(opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue ColorMeShop::ApiError => e + puts "Error when calling StockApi->get_stocks_with_http_info: #{e}" end ``` ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **ids** | **String**| 商品IDで検索。カンマ区切りにすることで複数検索が可能 | [optional] - **category_id_big** | **Integer**| 大カテゴリーIDで検索 | [optional] - **category_id_small** | **Integer**| 小カテゴリーIDで検索 | [optional] - **model_number** | **String**| 型番で部分一致検索 | [optional] - **name** | **String**| 商品名で部分一致検索 | [optional] - **display_state** | **String**| 掲載設定で検索 | [optional] - **stocks** | **Integer**| 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、合計在庫数で検索される | [optional] - **recent_zero_stocks** | **BOOLEAN**| `true` の場合、過去1週間以内に更新された商品から検索 | [optional] - **fields** | **String**| レスポンスJSONのキーをカンマ区切りで指定 | [optional] - **limit** | **Integer**| レスポンスの件数を指定。指定がない場合は10。最大50 | [optional] - **offset** | **Integer**| 指定した数値+1件目以降のデータを返す | [optional] +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **ids** | **String** | 商品IDで検索。カンマ区切りにすることで複数検索が可能 | [optional] | +| **category_id_big** | **Integer** | 大カテゴリーIDで検索 | [optional] | +| **category_id_small** | **Integer** | 小カテゴリーIDで検索 | [optional] | +| **model_number** | **String** | 型番で部分一致検索 | [optional] | +| **name** | **String** | 商品名で部分一致検索 | [optional] | +| **display_state** | **String** | 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **stocks** | **Integer** | 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される | [optional] | +| **recent_zero_stocks** | **Boolean** | `true` の場合、過去1週間以内にオプションが更新された商品から検索 | [optional] | +| **fields** | **String** | レスポンスJSONのキーをカンマ区切りで指定 | [optional] | +| **limit** | **Integer** | レスポンスの件数を指定。指定がない場合は10。最大50 | [optional] | +| **offset** | **Integer** | 指定した数値+1件目以降のデータを返す | [optional] | ### Return type -**Object** +[**GetStocks200Response**](GetStocks200Response.md) ### Authorization @@ -74,8 +94,6 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json - - +- **Content-Type**: Not defined +- **Accept**: application/json diff --git a/docs/UpdateProductRequest.md b/docs/UpdateProductRequest.md new file mode 100644 index 0000000..425af12 --- /dev/null +++ b/docs/UpdateProductRequest.md @@ -0,0 +1,18 @@ +# ColorMeShop::UpdateProductRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **product** | [**UpdateProductRequestProduct**](UpdateProductRequestProduct.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::UpdateProductRequest.new( + product: null +) +``` + diff --git a/docs/UpdateProductRequestProduct.md b/docs/UpdateProductRequestProduct.md new file mode 100644 index 0000000..5807795 --- /dev/null +++ b/docs/UpdateProductRequestProduct.md @@ -0,0 +1,53 @@ +# ColorMeShop::UpdateProductRequestProduct + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **name** | **String** | 商品名 | [optional] | +| **price** | **Integer** | 定価 | [optional] | +| **category_id_big** | **Integer** | 大カテゴリーID | [optional] | +| **category_id_small** | **Integer** | 小カテゴリーID | [optional] | +| **cost** | **Integer** | 原価 | [optional] | +| **sales_price** | **Integer** | 販売価格 フリープランを利用しているショップの場合、最低価格は100円です。 | [optional] | +| **members_price** | **Integer** | 会員価格 フリープランを利用しているショップの場合、最低価格は100円です。 | [optional] | +| **model_number** | **String** | 型番 | [optional] | +| **expl** | **String** | 商品説明 | [optional] | +| **simple_expl** | **String** | 簡易説明 | [optional] | +| **smartphone_expl** | **String** | スマホ向けショップの商品説明 | [optional] | +| **display_state** | **String** | 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 | [optional] | +| **stock_managed** | **Boolean** | 在庫管理する場合は `true` | [optional] | +| **stocks** | [**UpdateProductRequestProductStocks**](UpdateProductRequestProductStocks.md) | | [optional] | +| **group_ids** | **Array<Integer>** | グループIDの配列 | [optional] | +| **variants** | [**Array<UpdateProductRequestProductVariantsInner>**](UpdateProductRequestProductVariantsInner.md) | 商品オプションによるバリエーションごとに更新 | [optional] | +| **tax_reduced** | **Boolean** | `true` の場合は軽減税率対象 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::UpdateProductRequestProduct.new( + name: null, + price: 1600, + category_id_big: 1139, + category_id_small: 993, + cost: null, + sales_price: 1600, + members_price: 1500, + model_number: T-223, + expl: 綿100%のこだわりTシャツです。 + +肌触りや吸水性の良さにみなさま驚かれます。弊社の人気商品です。 +, + simple_expl: 素材にこだわってつくられた、弊社の人気商品です。, + smartphone_expl: 素材にこだわってつくられた、弊社の人気商品です。, + display_state: null, + stock_managed: null, + stocks: null, + group_ids: [112342,4825592], + variants: null, + tax_reduced: false +) +``` + diff --git a/docs/UpdateProductRequestProductStocks.md b/docs/UpdateProductRequestProductStocks.md new file mode 100644 index 0000000..d3b6a37 --- /dev/null +++ b/docs/UpdateProductRequestProductStocks.md @@ -0,0 +1,49 @@ +# ColorMeShop::UpdateProductRequestProductStocks + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'color_me_shop' + +ColorMeShop::UpdateProductRequestProductStocks.openapi_one_of +# => +# [ +# :'Integer', +# :'UpdateProductRequestProductStocksOneOf' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'color_me_shop' + +ColorMeShop::UpdateProductRequestProductStocks.build(data) +# => # + +ColorMeShop::UpdateProductRequestProductStocks.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `Integer` +- `UpdateProductRequestProductStocksOneOf` +- `nil` (if no type matches) + diff --git a/docs/UpdateProductRequestProductStocksOneOf.md b/docs/UpdateProductRequestProductStocksOneOf.md new file mode 100644 index 0000000..3730301 --- /dev/null +++ b/docs/UpdateProductRequestProductStocksOneOf.md @@ -0,0 +1,18 @@ +# ColorMeShop::UpdateProductRequestProductStocksOneOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **increment** | **Integer** | 在庫数の増減値 | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::UpdateProductRequestProductStocksOneOf.new( + increment: null +) +``` + diff --git a/docs/UpdateProductRequestProductVariantsInner.md b/docs/UpdateProductRequestProductVariantsInner.md new file mode 100644 index 0000000..89d0995 --- /dev/null +++ b/docs/UpdateProductRequestProductVariantsInner.md @@ -0,0 +1,22 @@ +# ColorMeShop::UpdateProductRequestProductVariantsInner + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **option1_value** | **String** | オプション1の値 | [optional] | +| **option2_value** | **String** | オプション2の値 | [optional] | +| **stocks** | [**UpdateProductRequestProductVariantsInnerStocks**](UpdateProductRequestProductVariantsInnerStocks.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::UpdateProductRequestProductVariantsInner.new( + option1_value: 赤, + option2_value: S, + stocks: null +) +``` + diff --git a/docs/UpdateProductRequestProductVariantsInnerStocks.md b/docs/UpdateProductRequestProductVariantsInnerStocks.md new file mode 100644 index 0000000..fae8a8d --- /dev/null +++ b/docs/UpdateProductRequestProductVariantsInnerStocks.md @@ -0,0 +1,49 @@ +# ColorMeShop::UpdateProductRequestProductVariantsInnerStocks + +## Class instance methods + +### `openapi_one_of` + +Returns the list of classes defined in oneOf. + +#### Example + +```ruby +require 'color_me_shop' + +ColorMeShop::UpdateProductRequestProductVariantsInnerStocks.openapi_one_of +# => +# [ +# :'Integer', +# :'UpdateProductRequestProductStocksOneOf' +# ] +``` + +### build + +Find the appropriate object from the `openapi_one_of` list and casts the data into it. + +#### Example + +```ruby +require 'color_me_shop' + +ColorMeShop::UpdateProductRequestProductVariantsInnerStocks.build(data) +# => # + +ColorMeShop::UpdateProductRequestProductVariantsInnerStocks.build(data_that_doesnt_match) +# => nil +``` + +#### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| **data** | **Mixed** | data to be matched against the list of oneOf items | + +#### Return type + +- `Integer` +- `UpdateProductRequestProductStocksOneOf` +- `nil` (if no type matches) + diff --git a/docs/UpdateSale200Response.md b/docs/UpdateSale200Response.md new file mode 100644 index 0000000..3cc33b8 --- /dev/null +++ b/docs/UpdateSale200Response.md @@ -0,0 +1,18 @@ +# ColorMeShop::UpdateSale200Response + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sale** | [**GetSales200ResponseSalesInner**](GetSales200ResponseSalesInner.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::UpdateSale200Response.new( + sale: null +) +``` + diff --git a/docs/UpdateSaleRequest.md b/docs/UpdateSaleRequest.md new file mode 100644 index 0000000..5643d16 --- /dev/null +++ b/docs/UpdateSaleRequest.md @@ -0,0 +1,18 @@ +# ColorMeShop::UpdateSaleRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sale** | [**UpdateSaleRequestSale**](UpdateSaleRequestSale.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::UpdateSaleRequest.new( + sale: null +) +``` + diff --git a/docs/UpdateSaleRequestSale.md b/docs/UpdateSaleRequestSale.md new file mode 100644 index 0000000..8c68f46 --- /dev/null +++ b/docs/UpdateSaleRequestSale.md @@ -0,0 +1,22 @@ +# ColorMeShop::UpdateSaleRequestSale + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **paid** | **Boolean** | 入金済みであるか否か | [optional] | +| **point_state** | **String** | ショップポイントの付与状態。`fixed`へ変更すると、購入者にショップポイントが付与される。`fixed`から別のステータスには変更できない また、受注が分割されている場合、子受注のショップポイント付与状態は変更することができません。 - `assumed`: 仮付与 - `fixed`: 確定済み - `cenceled`: キャンセル済み | [optional] | +| **sale_deliveries** | [**Array<GetSales200ResponseSalesInnerSaleDeliveriesInner>**](GetSales200ResponseSalesInnerSaleDeliveriesInner.md) | | [optional] | + +## Example + +```ruby +require 'color_me_shop' + +instance = ColorMeShop::UpdateSaleRequestSale.new( + paid: null, + point_state: null, + sale_deliveries: null +) +``` + diff --git a/generate.sh b/generate.sh deleted file mode 100755 index 4803025..0000000 --- a/generate.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate \ - -DmodelTests=false -DapiTests=false \ - -i https://api.shop-pro.jp/v1/swagger.json \ - -g ruby \ - -o /local/ \ - --additional-properties moduleName=ColorMeShop,gemAuthor="GMO Pepabo inc.",gemHomepage=https://shop-pro.jp,gemLicense=MIT,gemDescription="カラーミーショップAPIのRubyクライアントです。",gemVersion=1.1.0 diff --git a/git_push.sh b/git_push.sh index b9fd6af..f53a75d 100644 --- a/git_push.sh +++ b/git_push.sh @@ -1,14 +1,17 @@ #!/bin/sh -# -# Generated by: https://openapi-generator.tech -# # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi if [ "$git_user_id" = "" ]; then git_user_id="GIT_USER_ID" @@ -35,14 +38,14 @@ git add . git commit -m "$release_note" # Sets the new remote -git_remote=`git remote` +git_remote=$(git remote) if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -50,6 +53,5 @@ fi git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' - diff --git a/lib/color_me_shop.rb b/lib/color_me_shop.rb index 6b16115..70fd849 100644 --- a/lib/color_me_shop.rb +++ b/lib/color_me_shop.rb @@ -1,12 +1,12 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end @@ -17,43 +17,120 @@ require 'color_me_shop/configuration' # Models -require 'color_me_shop/models/application_charge' -require 'color_me_shop/models/application_charge_create_response' +require 'color_me_shop/models/cancel_sale_request' require 'color_me_shop/models/customer' require 'color_me_shop/models/delivery' require 'color_me_shop/models/delivery_charge_by_prefecture' require 'color_me_shop/models/delivery_date_setting' +require 'color_me_shop/models/get_coupon200_response' +require 'color_me_shop/models/get_coupons200_response' +require 'color_me_shop/models/get_coupons200_response_shop_coupons_inner' +require 'color_me_shop/models/get_customer200_response' +require 'color_me_shop/models/get_customer200_response_meta' +require 'color_me_shop/models/get_customers200_response' +require 'color_me_shop/models/get_deliveries200_response' +require 'color_me_shop/models/get_deliveries200_response_deliveries_inner' +require 'color_me_shop/models/get_deliveries200_response_deliveries_inner_charge' +require 'color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner' +require 'color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner' +require 'color_me_shop/models/get_delivery_date_setting200_response' +require 'color_me_shop/models/get_delivery_date_setting200_response_delivery_date' +require 'color_me_shop/models/get_delivery_date_setting200_response_delivery_date_days' +require 'color_me_shop/models/get_delivery_date_setting200_response_delivery_date_times' +require 'color_me_shop/models/get_gift200_response' +require 'color_me_shop/models/get_gift200_response_gift' +require 'color_me_shop/models/get_gift200_response_gift_card' +require 'color_me_shop/models/get_gift200_response_gift_card_types_inner' +require 'color_me_shop/models/get_gift200_response_gift_noshi' +require 'color_me_shop/models/get_gift200_response_gift_noshi_types_inner' +require 'color_me_shop/models/get_gift200_response_gift_wrapping' +require 'color_me_shop/models/get_gift200_response_gift_wrapping_types_inner' +require 'color_me_shop/models/get_payments200_response' +require 'color_me_shop/models/get_payments200_response_payments_inner' +require 'color_me_shop/models/get_payments200_response_payments_inner_card' +require 'color_me_shop/models/get_payments200_response_payments_inner_card_brands_inner' +require 'color_me_shop/models/get_payments200_response_payments_inner_cod' +require 'color_me_shop/models/get_payments200_response_payments_inner_financial' +require 'color_me_shop/models/get_product_categories200_response' +require 'color_me_shop/models/get_product_categories200_response_categories_inner' +require 'color_me_shop/models/get_product_categories200_response_categories_inner_children_inner' +require 'color_me_shop/models/get_product_groups200_response' +require 'color_me_shop/models/get_product_groups200_response_groups_inner' +require 'color_me_shop/models/get_product_variants200_response' +require 'color_me_shop/models/get_products200_response' +require 'color_me_shop/models/get_products200_response_products_inner' +require 'color_me_shop/models/get_products200_response_products_inner_category' +require 'color_me_shop/models/get_products200_response_products_inner_images_inner' +require 'color_me_shop/models/get_products200_response_products_inner_options_inner' +require 'color_me_shop/models/get_products200_response_products_inner_pickups_inner' +require 'color_me_shop/models/get_products200_response_products_inner_variants_inner' +require 'color_me_shop/models/get_sale200_response' +require 'color_me_shop/models/get_sale200_response_sale' +require 'color_me_shop/models/get_sale200_response_sale_all_of_segment' +require 'color_me_shop/models/get_sales200_response' +require 'color_me_shop/models/get_sales200_response_meta' +require 'color_me_shop/models/get_sales200_response_sales_inner' +require 'color_me_shop/models/get_sales200_response_sales_inner_customer' +require 'color_me_shop/models/get_sales200_response_sales_inner_details_inner' +require 'color_me_shop/models/get_sales200_response_sales_inner_sale_deliveries_inner' +require 'color_me_shop/models/get_sales200_response_sales_inner_segment' +require 'color_me_shop/models/get_sales200_response_sales_inner_totals' +require 'color_me_shop/models/get_shop200_response' +require 'color_me_shop/models/get_shop200_response_shop' +require 'color_me_shop/models/get_stocks200_response' +require 'color_me_shop/models/get_stocks200_response_stocks_inner' +require 'color_me_shop/models/get_stocks200_response_stocks_inner_images_inner' require 'color_me_shop/models/meta' require 'color_me_shop/models/payment' +require 'color_me_shop/models/post_customers200_response' +require 'color_me_shop/models/post_customers_request' +require 'color_me_shop/models/post_customers_request_customer' +require 'color_me_shop/models/post_products200_response' +require 'color_me_shop/models/post_products_request' +require 'color_me_shop/models/post_products_request_product' require 'color_me_shop/models/product' require 'color_me_shop/models/product_category' +require 'color_me_shop/models/product_category_child' +require 'color_me_shop/models/product_create_request' require 'color_me_shop/models/product_group' require 'color_me_shop/models/product_option' require 'color_me_shop/models/product_pickup' require 'color_me_shop/models/product_update_request' require 'color_me_shop/models/product_variant' -require 'color_me_shop/models/recurring_application_charge' -require 'color_me_shop/models/recurring_application_charge_create_response' +require 'color_me_shop/models/put_product_pickup200_response' +require 'color_me_shop/models/put_product_pickup200_response_pickup' +require 'color_me_shop/models/put_product_pickup_request' require 'color_me_shop/models/sale' require 'color_me_shop/models/sale_delivery' require 'color_me_shop/models/sale_detail' -require 'color_me_shop/models/script_tag' +require 'color_me_shop/models/send_sales_mail_request' +require 'color_me_shop/models/send_sales_mail_request_mail' require 'color_me_shop/models/shop' +require 'color_me_shop/models/shop_coupon' +require 'color_me_shop/models/stat_sale200_response' +require 'color_me_shop/models/stat_sale200_response_sales_stat' require 'color_me_shop/models/stock' +require 'color_me_shop/models/update_product_request' +require 'color_me_shop/models/update_product_request_product' +require 'color_me_shop/models/update_product_request_product_stocks' +require 'color_me_shop/models/update_product_request_product_stocks_one_of' +require 'color_me_shop/models/update_product_request_product_variants_inner' +require 'color_me_shop/models/update_product_request_product_variants_inner_stocks' +require 'color_me_shop/models/update_sale200_response' +require 'color_me_shop/models/update_sale_request' +require 'color_me_shop/models/update_sale_request_sale' # APIs require 'color_me_shop/api/category_api' -require 'color_me_shop/api/charge_api' require 'color_me_shop/api/customer_api' require 'color_me_shop/api/delivery_api' -require 'color_me_shop/api/etc_api' require 'color_me_shop/api/gift_api' require 'color_me_shop/api/group_api' require 'color_me_shop/api/payment_api' require 'color_me_shop/api/product_api' require 'color_me_shop/api/sale_api' -require 'color_me_shop/api/script_api' require 'color_me_shop/api/shop_api' +require 'color_me_shop/api/shop_coupon_api' require 'color_me_shop/api/stock_api' module ColorMeShop diff --git a/lib/color_me_shop/api/category_api.rb b/lib/color_me_shop/api/category_api.rb index c952b69..3a48df9 100644 --- a/lib/color_me_shop/api/category_api.rb +++ b/lib/color_me_shop/api/category_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class CategoryApi @@ -20,44 +20,56 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # 商品カテゴリー一覧を取得 + # # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetProductCategories200Response] def get_product_categories(opts = {}) data, _status_code, _headers = get_product_categories_with_http_info(opts) data end # 商品カテゴリー一覧を取得 + # # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetProductCategories200Response, Integer, Hash)>] GetProductCategories200Response data, response status code and response headers def get_product_categories_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CategoryApi.get_product_categories ...' end # resource path - local_var_path = '/v1/categories.json' + local_var_path = '/v1/categories' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetProductCategories200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"CategoryApi.get_product_categories", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CategoryApi#get_product_categories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/charge_api.rb b/lib/color_me_shop/api/charge_api.rb deleted file mode 100644 index 92d2e01..0000000 --- a/lib/color_me_shop/api/charge_api.rb +++ /dev/null @@ -1,495 +0,0 @@ -=begin -#カラーミーショップ API - -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` - -OpenAPI spec version: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT - -=end - -require 'uri' - -module ColorMeShop - class ChargeApi - attr_accessor :api_client - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end - # スポット課金データをアクティベートする - # スポット課金データをアクティベートするAPIです。 - # @param application_charge_id - # @param [Hash] opts the optional parameters - # @return [Object] - def activate_application_charge(application_charge_id, opts = {}) - data, _status_code, _headers = activate_application_charge_with_http_info(application_charge_id, opts) - data - end - - # スポット課金データをアクティベートする - # スポット課金データをアクティベートするAPIです。 - # @param application_charge_id - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def activate_application_charge_with_http_info(application_charge_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.activate_application_charge ...' - end - # verify the required parameter 'application_charge_id' is set - if @api_client.config.client_side_validation && application_charge_id.nil? - fail ArgumentError, "Missing the required parameter 'application_charge_id' when calling ChargeApi.activate_application_charge" - end - # resource path - local_var_path = '/v1/application_charges/{applicationChargeId}/activate.json'.sub('{' + 'applicationChargeId' + '}', application_charge_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#activate_application_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # 月額課金データをアクティベートする - # 月額課金データをアクティベートするAPIです。 - # @param recurring_application_charge_id - # @param [Hash] opts the optional parameters - # @return [Object] - def activate_recurring_application_charge(recurring_application_charge_id, opts = {}) - data, _status_code, _headers = activate_recurring_application_charge_with_http_info(recurring_application_charge_id, opts) - data - end - - # 月額課金データをアクティベートする - # 月額課金データをアクティベートするAPIです。 - # @param recurring_application_charge_id - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def activate_recurring_application_charge_with_http_info(recurring_application_charge_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.activate_recurring_application_charge ...' - end - # verify the required parameter 'recurring_application_charge_id' is set - if @api_client.config.client_side_validation && recurring_application_charge_id.nil? - fail ArgumentError, "Missing the required parameter 'recurring_application_charge_id' when calling ChargeApi.activate_recurring_application_charge" - end - # resource path - local_var_path = '/v1/recurring_application_charges/{recurringApplicationChargeId}/activate.json'.sub('{' + 'recurringApplicationChargeId' + '}', recurring_application_charge_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#activate_recurring_application_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # 月額課金データをキャンセルする - # 月額課金データをキャンセルするAPIです。 - # @param recurring_application_charge_id - # @param [Hash] opts the optional parameters - # @return [Object] - def cancel_recurring_application_charge(recurring_application_charge_id, opts = {}) - data, _status_code, _headers = cancel_recurring_application_charge_with_http_info(recurring_application_charge_id, opts) - data - end - - # 月額課金データをキャンセルする - # 月額課金データをキャンセルするAPIです。 - # @param recurring_application_charge_id - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def cancel_recurring_application_charge_with_http_info(recurring_application_charge_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.cancel_recurring_application_charge ...' - end - # verify the required parameter 'recurring_application_charge_id' is set - if @api_client.config.client_side_validation && recurring_application_charge_id.nil? - fail ArgumentError, "Missing the required parameter 'recurring_application_charge_id' when calling ChargeApi.cancel_recurring_application_charge" - end - # resource path - local_var_path = '/v1/recurring_application_charges/{recurringApplicationChargeId}/cancel.json'.sub('{' + 'recurringApplicationChargeId' + '}', recurring_application_charge_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#cancel_recurring_application_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # スポット課金データの取得 - # スポット課金データを取得するAPIです。 - # @param application_charge_id - # @param [Hash] opts the optional parameters - # @return [Object] - def get_application_charge(application_charge_id, opts = {}) - data, _status_code, _headers = get_application_charge_with_http_info(application_charge_id, opts) - data - end - - # スポット課金データの取得 - # スポット課金データを取得するAPIです。 - # @param application_charge_id - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def get_application_charge_with_http_info(application_charge_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.get_application_charge ...' - end - # verify the required parameter 'application_charge_id' is set - if @api_client.config.client_side_validation && application_charge_id.nil? - fail ArgumentError, "Missing the required parameter 'application_charge_id' when calling ChargeApi.get_application_charge" - end - # resource path - local_var_path = '/v1/application_charges/{applicationChargeId}.json'.sub('{' + 'applicationChargeId' + '}', application_charge_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#get_application_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # スポット課金一覧の取得 - # スポット課金一覧を取得するAPIです。 - # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit レスポンスの件数を指定します。指定がない場合は10件。最大50件。 - # @option opts [Integer] :since_id 指定した課金ID以降のデータを返します。 - # @return [Object] - def get_application_charges(opts = {}) - data, _status_code, _headers = get_application_charges_with_http_info(opts) - data - end - - # スポット課金一覧の取得 - # スポット課金一覧を取得するAPIです。 - # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit レスポンスの件数を指定します。指定がない場合は10件。最大50件。 - # @option opts [Integer] :since_id 指定した課金ID以降のデータを返します。 - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def get_application_charges_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.get_application_charges ...' - end - # resource path - local_var_path = '/v1/application_charges.json' - - # query parameters - query_params = {} - query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? - query_params[:'since_id'] = opts[:'since_id'] if !opts[:'since_id'].nil? - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#get_application_charges\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # 月額課金データの取得 - # 月額課金データを取得するAPIです。 - # @param recurring_application_charge_id - # @param [Hash] opts the optional parameters - # @return [Object] - def get_recurring_application_charge(recurring_application_charge_id, opts = {}) - data, _status_code, _headers = get_recurring_application_charge_with_http_info(recurring_application_charge_id, opts) - data - end - - # 月額課金データの取得 - # 月額課金データを取得するAPIです。 - # @param recurring_application_charge_id - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def get_recurring_application_charge_with_http_info(recurring_application_charge_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.get_recurring_application_charge ...' - end - # verify the required parameter 'recurring_application_charge_id' is set - if @api_client.config.client_side_validation && recurring_application_charge_id.nil? - fail ArgumentError, "Missing the required parameter 'recurring_application_charge_id' when calling ChargeApi.get_recurring_application_charge" - end - # resource path - local_var_path = '/v1/recurring_application_charges/{recurringApplicationChargeId}.json'.sub('{' + 'recurringApplicationChargeId' + '}', recurring_application_charge_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#get_recurring_application_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # 月額課金一覧の取得 - # 月額課金一覧を取得するAPIです。 - # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit レスポンスの件数を指定します。指定がない場合は10件。最大50件。 - # @option opts [Integer] :since_id 指定した課金ID以降のデータを返します。 - # @return [Object] - def get_recurring_application_charges(opts = {}) - data, _status_code, _headers = get_recurring_application_charges_with_http_info(opts) - data - end - - # 月額課金一覧の取得 - # 月額課金一覧を取得するAPIです。 - # @param [Hash] opts the optional parameters - # @option opts [Integer] :limit レスポンスの件数を指定します。指定がない場合は10件。最大50件。 - # @option opts [Integer] :since_id 指定した課金ID以降のデータを返します。 - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def get_recurring_application_charges_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.get_recurring_application_charges ...' - end - # resource path - local_var_path = '/v1/recurring_application_charges.json' - - # query parameters - query_params = {} - query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? - query_params[:'since_id'] = opts[:'since_id'] if !opts[:'since_id'].nil? - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#get_recurring_application_charges\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # スポット課金データの作成 - # スポット課金データを作成するAPIです。 - # @param unknown_base_type - # @param [Hash] opts the optional parameters - # @return [Object] - def post_application_charge(unknown_base_type, opts = {}) - data, _status_code, _headers = post_application_charge_with_http_info(unknown_base_type, opts) - data - end - - # スポット課金データの作成 - # スポット課金データを作成するAPIです。 - # @param unknown_base_type - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def post_application_charge_with_http_info(unknown_base_type, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.post_application_charge ...' - end - # verify the required parameter 'unknown_base_type' is set - if @api_client.config.client_side_validation && unknown_base_type.nil? - fail ArgumentError, "Missing the required parameter 'unknown_base_type' when calling ChargeApi.post_application_charge" - end - # resource path - local_var_path = '/v1/application_charges.json' - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = @api_client.object_to_http_body(unknown_base_type) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#post_application_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # 月額課金データの作成 - # 月額課金データを作成するAPIです。 - # @param unknown_base_type - # @param [Hash] opts the optional parameters - # @return [Object] - def post_recurring_application_charge(unknown_base_type, opts = {}) - data, _status_code, _headers = post_recurring_application_charge_with_http_info(unknown_base_type, opts) - data - end - - # 月額課金データの作成 - # 月額課金データを作成するAPIです。 - # @param unknown_base_type - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def post_recurring_application_charge_with_http_info(unknown_base_type, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ChargeApi.post_recurring_application_charge ...' - end - # verify the required parameter 'unknown_base_type' is set - if @api_client.config.client_side_validation && unknown_base_type.nil? - fail ArgumentError, "Missing the required parameter 'unknown_base_type' when calling ChargeApi.post_recurring_application_charge" - end - # resource path - local_var_path = '/v1/recurring_application_charges.json' - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = @api_client.object_to_http_body(unknown_base_type) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ChargeApi#post_recurring_application_charge\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - end -end diff --git a/lib/color_me_shop/api/customer_api.rb b/lib/color_me_shop/api/customer_api.rb index 123c0fb..c51ca90 100644 --- a/lib/color_me_shop/api/customer_api.rb +++ b/lib/color_me_shop/api/customer_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class CustomerApi @@ -20,18 +20,20 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # 顧客データの取得 - # @param customer_id + # + # @param customer_id [Integer] # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetCustomer200Response] def get_customer(customer_id, opts = {}) data, _status_code, _headers = get_customer_with_http_info(customer_id, opts) data end # 顧客データの取得 - # @param customer_id + # + # @param customer_id [Integer] # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetCustomer200Response, Integer, Hash)>] GetCustomer200Response data, response status code and response headers def get_customer_with_http_info(customer_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...' @@ -41,83 +43,110 @@ def get_customer_with_http_info(customer_id, opts = {}) fail ArgumentError, "Missing the required parameter 'customer_id' when calling CustomerApi.get_customer" end # resource path - local_var_path = '/v1/customers/{customerId}.json'.sub('{' + 'customerId' + '}', customer_id.to_s) + local_var_path = '/v1/customers/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetCustomer200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"CustomerApi.get_customer", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # 顧客データのリストを取得 + # # @param [Hash] opts the optional parameters # @option opts [String] :ids 顧客IDで検索。カンマ区切りで複数指定可能 # @option opts [String] :name 顧客名で部分一致検索 - # @option opts [String] :furigana 顧客フリガナがで部分一致検索 + # @option opts [String] :furigana 顧客フリガナで部分一致検索 # @option opts [String] :mail 顧客メールアドレスで部分一致検索 # @option opts [String] :postal 顧客の郵便番号で部分一致検索 # @option opts [String] :tel 顧客の電話番号で部分一致検索 - # @option opts [BOOLEAN] :mobile `true`なら会員登録済みの顧客から検索 + # @option opts [String] :sex 顧客の性別で検索 - `male`: 男性 - `female`: 女性 + # @option opts [Boolean] :member `true`なら会員登録済みの顧客から検索 + # @option opts [Boolean] :receive_mail_magazine メルマガ受信可否で検索 # @option opts [String] :make_date_min 指定日時以降に登録された顧客から検索 # @option opts [String] :make_date_max 指定日時以前に登録された顧客から検索 # @option opts [String] :update_date_min 指定日時以降に更新された顧客から検索 - # @option opts [String] :update_date_max 指定日時以降に更新された顧客から検索 - # @return [Object] + # @option opts [String] :update_date_max 指定日時以前に更新された顧客から検索 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大100 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [GetCustomers200Response] def get_customers(opts = {}) data, _status_code, _headers = get_customers_with_http_info(opts) data end # 顧客データのリストを取得 + # # @param [Hash] opts the optional parameters # @option opts [String] :ids 顧客IDで検索。カンマ区切りで複数指定可能 # @option opts [String] :name 顧客名で部分一致検索 - # @option opts [String] :furigana 顧客フリガナがで部分一致検索 + # @option opts [String] :furigana 顧客フリガナで部分一致検索 # @option opts [String] :mail 顧客メールアドレスで部分一致検索 # @option opts [String] :postal 顧客の郵便番号で部分一致検索 # @option opts [String] :tel 顧客の電話番号で部分一致検索 - # @option opts [BOOLEAN] :mobile `true`なら会員登録済みの顧客から検索 + # @option opts [String] :sex 顧客の性別で検索 - `male`: 男性 - `female`: 女性 + # @option opts [Boolean] :member `true`なら会員登録済みの顧客から検索 + # @option opts [Boolean] :receive_mail_magazine メルマガ受信可否で検索 # @option opts [String] :make_date_min 指定日時以降に登録された顧客から検索 # @option opts [String] :make_date_max 指定日時以前に登録された顧客から検索 # @option opts [String] :update_date_min 指定日時以降に更新された顧客から検索 - # @option opts [String] :update_date_max 指定日時以降に更新された顧客から検索 - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @option opts [String] :update_date_max 指定日時以前に更新された顧客から検索 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大100 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [Array<(GetCustomers200Response, Integer, Hash)>] GetCustomers200Response data, response status code and response headers def get_customers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.get_customers ...' end + allowable_values = ["male", "female"] + if @api_client.config.client_side_validation && opts[:'sex'] && !allowable_values.include?(opts[:'sex']) + fail ArgumentError, "invalid value for \"sex\", must be one of #{allowable_values}" + end # resource path - local_var_path = '/v1/customers.json' + local_var_path = '/v1/customers' # query parameters - query_params = {} + query_params = opts[:query_params] || {} query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil? query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil? query_params[:'furigana'] = opts[:'furigana'] if !opts[:'furigana'].nil? query_params[:'mail'] = opts[:'mail'] if !opts[:'mail'].nil? query_params[:'postal'] = opts[:'postal'] if !opts[:'postal'].nil? query_params[:'tel'] = opts[:'tel'] if !opts[:'tel'].nil? - query_params[:'mobile'] = opts[:'mobile'] if !opts[:'mobile'].nil? + query_params[:'sex'] = opts[:'sex'] if !opts[:'sex'].nil? + query_params[:'member'] = opts[:'member'] if !opts[:'member'].nil? + query_params[:'receive_mail_magazine'] = opts[:'receive_mail_magazine'] if !opts[:'receive_mail_magazine'].nil? query_params[:'make_date_min'] = opts[:'make_date_min'] if !opts[:'make_date_min'].nil? query_params[:'make_date_max'] = opts[:'make_date_max'] if !opts[:'make_date_max'].nil? query_params[:'update_date_min'] = opts[:'update_date_min'] if !opts[:'update_date_min'].nil? @@ -126,75 +155,97 @@ def get_customers_with_http_info(opts = {}) query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetCustomers200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"CustomerApi.get_customers", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#get_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # 顧客データを追加 - # @param unknown_base_type + # # @param [Hash] opts the optional parameters - # @return [Object] - def post_customers(unknown_base_type, opts = {}) - data, _status_code, _headers = post_customers_with_http_info(unknown_base_type, opts) + # @option opts [PostCustomersRequest] :post_customers_request + # @return [PostCustomers200Response] + def post_customers(opts = {}) + data, _status_code, _headers = post_customers_with_http_info(opts) data end # 顧客データを追加 - # @param unknown_base_type + # # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def post_customers_with_http_info(unknown_base_type, opts = {}) + # @option opts [PostCustomersRequest] :post_customers_request + # @return [Array<(PostCustomers200Response, Integer, Hash)>] PostCustomers200Response data, response status code and response headers + def post_customers_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CustomerApi.post_customers ...' end - # verify the required parameter 'unknown_base_type' is set - if @api_client.config.client_side_validation && unknown_base_type.nil? - fail ArgumentError, "Missing the required parameter 'unknown_base_type' when calling CustomerApi.post_customers" - end # resource path - local_var_path = '/v1/customers.json' + local_var_path = '/v1/customers' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(unknown_base_type) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'post_customers_request']) + + # return_type + return_type = opts[:debug_return_type] || 'PostCustomers200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"CustomerApi.post_customers", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerApi#post_customers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/delivery_api.rb b/lib/color_me_shop/api/delivery_api.rb index db38e3c..5c2db13 100644 --- a/lib/color_me_shop/api/delivery_api.rb +++ b/lib/color_me_shop/api/delivery_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class DeliveryApi @@ -20,88 +20,113 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # 配送方法一覧を取得 + # # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetDeliveries200Response] def get_deliveries(opts = {}) data, _status_code, _headers = get_deliveries_with_http_info(opts) data end # 配送方法一覧を取得 + # # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetDeliveries200Response, Integer, Hash)>] GetDeliveries200Response data, response status code and response headers def get_deliveries_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DeliveryApi.get_deliveries ...' end # resource path - local_var_path = '/v1/deliveries.json' + local_var_path = '/v1/deliveries' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetDeliveries200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"DeliveryApi.get_deliveries", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DeliveryApi#get_deliveries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # 配送日時設定を取得 + # # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetDeliveryDateSetting200Response] def get_delivery_date_setting(opts = {}) data, _status_code, _headers = get_delivery_date_setting_with_http_info(opts) data end # 配送日時設定を取得 + # # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetDeliveryDateSetting200Response, Integer, Hash)>] GetDeliveryDateSetting200Response data, response status code and response headers def get_delivery_date_setting_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DeliveryApi.get_delivery_date_setting ...' end # resource path - local_var_path = '/v1/deliveries/date.json' + local_var_path = '/v1/deliveries/date' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetDeliveryDateSetting200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"DeliveryApi.get_delivery_date_setting", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: DeliveryApi#get_delivery_date_setting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/etc_api.rb b/lib/color_me_shop/api/etc_api.rb deleted file mode 100644 index 1ed2947..0000000 --- a/lib/color_me_shop/api/etc_api.rb +++ /dev/null @@ -1,70 +0,0 @@ -=begin -#カラーミーショップ API - -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` - -OpenAPI spec version: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT - -=end - -require 'uri' - -module ColorMeShop - class EtcApi - attr_accessor :api_client - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end - # デバイストークンの削除 - # @param token - # @param [Hash] opts the optional parameters - # @return [nil] - def delete_device_token(token, opts = {}) - delete_device_token_with_http_info(token, opts) - nil - end - - # デバイストークンの削除 - # @param token - # @param [Hash] opts the optional parameters - # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def delete_device_token_with_http_info(token, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: EtcApi.delete_device_token ...' - end - # verify the required parameter 'token' is set - if @api_client.config.client_side_validation && token.nil? - fail ArgumentError, "Missing the required parameter 'token' when calling EtcApi.delete_device_token" - end - # resource path - local_var_path = '/v1/device_tokens/{token}.json'.sub('{' + 'token' + '}', token.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: EtcApi#delete_device_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - end -end diff --git a/lib/color_me_shop/api/gift_api.rb b/lib/color_me_shop/api/gift_api.rb index 3c60126..678b61d 100644 --- a/lib/color_me_shop/api/gift_api.rb +++ b/lib/color_me_shop/api/gift_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class GiftApi @@ -20,44 +20,56 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # ギフト設定を取得 + # # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetGift200Response] def get_gift(opts = {}) data, _status_code, _headers = get_gift_with_http_info(opts) data end # ギフト設定を取得 + # # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetGift200Response, Integer, Hash)>] GetGift200Response data, response status code and response headers def get_gift_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: GiftApi.get_gift ...' end # resource path - local_var_path = '/v1/gift.json' + local_var_path = '/v1/gift' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetGift200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"GiftApi.get_gift", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: GiftApi#get_gift\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/group_api.rb b/lib/color_me_shop/api/group_api.rb index a4073fe..2a2f703 100644 --- a/lib/color_me_shop/api/group_api.rb +++ b/lib/color_me_shop/api/group_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class GroupApi @@ -20,44 +20,56 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # 商品グループ一覧を取得 + # # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetProductGroups200Response] def get_product_groups(opts = {}) data, _status_code, _headers = get_product_groups_with_http_info(opts) data end # 商品グループ一覧を取得 + # # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetProductGroups200Response, Integer, Hash)>] GetProductGroups200Response data, response status code and response headers def get_product_groups_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: GroupApi.get_product_groups ...' end # resource path - local_var_path = '/v1/groups.json' + local_var_path = '/v1/groups' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetProductGroups200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"GroupApi.get_product_groups", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: GroupApi#get_product_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/payment_api.rb b/lib/color_me_shop/api/payment_api.rb index bf535ea..0350a17 100644 --- a/lib/color_me_shop/api/payment_api.rb +++ b/lib/color_me_shop/api/payment_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class PaymentApi @@ -20,44 +20,56 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # 決済設定の一覧を取得 + # # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetPayments200Response] def get_payments(opts = {}) data, _status_code, _headers = get_payments_with_http_info(opts) data end # 決済設定の一覧を取得 + # # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetPayments200Response, Integer, Hash)>] GetPayments200Response data, response status code and response headers def get_payments_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: PaymentApi.get_payments ...' end # resource path - local_var_path = '/v1/payments.json' + local_var_path = '/v1/payments' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetPayments200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"PaymentApi.get_payments", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: PaymentApi#get_payments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/product_api.rb b/lib/color_me_shop/api/product_api.rb index 64a966c..3051d87 100644 --- a/lib/color_me_shop/api/product_api.rb +++ b/lib/color_me_shop/api/product_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class ProductApi @@ -21,10 +21,10 @@ def initialize(api_client = ApiClient.default) end # おすすめ商品情報の削除 # 商品に付加されたおすすめ商品情報を削除します - # @param product_id 商品ID - # @param pickup_type おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) + # @param product_id [Integer] 商品ID + # @param pickup_type [Integer] おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) # @param [Hash] opts the optional parameters - # @return [Object] + # @return [PutProductPickup200Response] def delete_product_pickup(product_id, pickup_type, opts = {}) data, _status_code, _headers = delete_product_pickup_with_http_info(product_id, pickup_type, opts) data @@ -32,10 +32,10 @@ def delete_product_pickup(product_id, pickup_type, opts = {}) # おすすめ商品情報の削除 # 商品に付加されたおすすめ商品情報を削除します - # @param product_id 商品ID - # @param pickup_type おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) + # @param product_id [Integer] 商品ID + # @param pickup_type [Integer] おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(PutProductPickup200Response, Integer, Hash)>] PutProductPickup200Response data, response status code and response headers def delete_product_pickup_with_http_info(product_id, pickup_type, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductApi.delete_product_pickup ...' @@ -49,47 +49,60 @@ def delete_product_pickup_with_http_info(product_id, pickup_type, opts = {}) fail ArgumentError, "Missing the required parameter 'pickup_type' when calling ProductApi.delete_product_pickup" end # resource path - local_var_path = '/v1/products/{productId}/pickups/{pickupType}.json'.sub('{' + 'productId' + '}', product_id.to_s).sub('{' + 'pickupType' + '}', pickup_type.to_s) + local_var_path = '/v1/products/{product_id}/pickups/{pickup_type}'.sub('{' + 'product_id' + '}', CGI.escape(product_id.to_s)).sub('{' + 'pickup_type' + '}', CGI.escape(pickup_type.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PutProductPickup200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ProductApi.delete_product_pickup", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProductApi#delete_product_pickup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # 商品データの取得 - # @param product_id 商品ID + # + # @param product_id [Integer] 商品ID # @param [Hash] opts the optional parameters - # @return [Object] + # @return [PostProducts200Response] def get_product(product_id, opts = {}) data, _status_code, _headers = get_product_with_http_info(product_id, opts) data end # 商品データの取得 - # @param product_id 商品ID + # + # @param product_id [Integer] 商品ID # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(PostProducts200Response, Integer, Hash)>] PostProducts200Response data, response status code and response headers def get_product_with_http_info(product_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductApi.get_product ...' @@ -99,92 +112,184 @@ def get_product_with_http_info(product_id, opts = {}) fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductApi.get_product" end # resource path - local_var_path = '/v1/products/{productId}.json'.sub('{' + 'productId' + '}', product_id.to_s) + local_var_path = '/v1/products/{product_id}'.sub('{' + 'product_id' + '}', CGI.escape(product_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PostProducts200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ProductApi.get_product", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProductApi#get_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + + # 商品オプション一覧の取得 + # + # @param product_id [Integer] 商品ID + # @param [Hash] opts the optional parameters + # @option opts [String] :model_number 型番で部分一致検索 + # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [GetProductVariants200Response] + def get_product_variants(product_id, opts = {}) + data, _status_code, _headers = get_product_variants_with_http_info(product_id, opts) + data + end + + # 商品オプション一覧の取得 + # + # @param product_id [Integer] 商品ID + # @param [Hash] opts the optional parameters + # @option opts [String] :model_number 型番で部分一致検索 + # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [Array<(GetProductVariants200Response, Integer, Hash)>] GetProductVariants200Response data, response status code and response headers + def get_product_variants_with_http_info(product_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProductApi.get_product_variants ...' + end + # verify the required parameter 'product_id' is set + if @api_client.config.client_side_validation && product_id.nil? + fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductApi.get_product_variants" + end + # resource path + local_var_path = '/v1/products/{product_id}/variants'.sub('{' + 'product_id' + '}', CGI.escape(product_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'model_number'] = opts[:'model_number'] if !opts[:'model_number'].nil? + query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetProductVariants200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ProductApi.get_product_variants", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProductApi#get_product_variants\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # 商品一覧の取得 + # 商品一覧を取得します。 オプションやバリエーションの数が多い場合、レスポンスの返却に時間がかかる場合があります。 `fields` リクエストパラメータで必要なキーを指定することを推奨します。 # @param [Hash] opts the optional parameters # @option opts [String] :ids 商品IDで検索。カンマ区切りにすることで複数検索が可能 # @option opts [Integer] :category_id_big 大カテゴリーIDで検索 # @option opts [Integer] :category_id_small 小カテゴリーIDで検索 + # @option opts [Integer] :group_ids グループIDで検索。カンマ区切りにすることで複数検索が可能 # @option opts [String] :model_number 型番で部分一致検索 # @option opts [String] :name 商品名で部分一致検索 - # @option opts [String] :display_state 掲載設定で検索 - # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、合計在庫数で検索される - # @option opts [BOOLEAN] :stock_managed 在庫管理している、またはしていない商品から検索 - # @option opts [BOOLEAN] :recent_zero_stocks `true` の場合、過去1週間以内に更新された商品から検索 + # @option opts [String] :display_state 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される + # @option opts [Boolean] :stock_managed `true`の場合、在庫管理している商品を検索 + # @option opts [Boolean] :recent_zero_stocks `true` の場合、過去1週間以内に更新された商品から検索 # @option opts [String] :make_date_min 指定日時以降に作成された商品から検索 # @option opts [String] :make_date_max 指定日時以前に作成された商品から検索 # @option opts [String] :update_date_min 指定日時以降に更新された商品から検索 - # @option opts [String] :update_date_max 指定日時以降に更新された商品から検索 + # @option opts [String] :update_date_max 指定日時以前に更新された商品から検索 # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す - # @return [Object] + # @return [GetProducts200Response] def get_products(opts = {}) data, _status_code, _headers = get_products_with_http_info(opts) data end # 商品一覧の取得 + # 商品一覧を取得します。 オプションやバリエーションの数が多い場合、レスポンスの返却に時間がかかる場合があります。 `fields` リクエストパラメータで必要なキーを指定することを推奨します。 # @param [Hash] opts the optional parameters # @option opts [String] :ids 商品IDで検索。カンマ区切りにすることで複数検索が可能 # @option opts [Integer] :category_id_big 大カテゴリーIDで検索 # @option opts [Integer] :category_id_small 小カテゴリーIDで検索 + # @option opts [Integer] :group_ids グループIDで検索。カンマ区切りにすることで複数検索が可能 # @option opts [String] :model_number 型番で部分一致検索 # @option opts [String] :name 商品名で部分一致検索 - # @option opts [String] :display_state 掲載設定で検索 - # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、合計在庫数で検索される - # @option opts [BOOLEAN] :stock_managed 在庫管理している、またはしていない商品から検索 - # @option opts [BOOLEAN] :recent_zero_stocks `true` の場合、過去1週間以内に更新された商品から検索 + # @option opts [String] :display_state 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される + # @option opts [Boolean] :stock_managed `true`の場合、在庫管理している商品を検索 + # @option opts [Boolean] :recent_zero_stocks `true` の場合、過去1週間以内に更新された商品から検索 # @option opts [String] :make_date_min 指定日時以降に作成された商品から検索 # @option opts [String] :make_date_max 指定日時以前に作成された商品から検索 # @option opts [String] :update_date_min 指定日時以降に更新された商品から検索 - # @option opts [String] :update_date_max 指定日時以降に更新された商品から検索 + # @option opts [String] :update_date_max 指定日時以前に更新された商品から検索 # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetProducts200Response, Integer, Hash)>] GetProducts200Response data, response status code and response headers def get_products_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductApi.get_products ...' end - if @api_client.config.client_side_validation && opts[:'display_state'] && !['showing', 'hidden', 'showing_for_members', 'sale_for_members'].include?(opts[:'display_state']) - fail ArgumentError, 'invalid value for "display_state", must be one of showing, hidden, showing_for_members, sale_for_members' + allowable_values = ["showing", "hidden", "showing_for_members", "sale_for_members"] + if @api_client.config.client_side_validation && opts[:'display_state'] && !allowable_values.include?(opts[:'display_state']) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{allowable_values}" end # resource path - local_var_path = '/v1/products.json' + local_var_path = '/v1/products' # query parameters - query_params = {} + query_params = opts[:query_params] || {} query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil? query_params[:'category_id_big'] = opts[:'category_id_big'] if !opts[:'category_id_big'].nil? query_params[:'category_id_small'] = opts[:'category_id_small'] if !opts[:'category_id_small'].nil? + query_params[:'group_ids'] = opts[:'group_ids'] if !opts[:'group_ids'].nil? query_params[:'model_number'] = opts[:'model_number'] if !opts[:'model_number'].nil? query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil? query_params[:'display_state'] = opts[:'display_state'] if !opts[:'display_state'].nil? @@ -200,46 +305,57 @@ def get_products_with_http_info(opts = {}) query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetProducts200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ProductApi.get_products", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProductApi#get_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # おすすめ商品情報の追加 # おすすめ商品情報(おすすめ商品、売れ筋商品、新着商品、イチオシ商品のいずれか)を商品に追加します。 - # @param product_id 商品ID - # @param unknown_base_type + # @param product_id [Integer] 商品ID + # @param put_product_pickup_request [PutProductPickupRequest] # @param [Hash] opts the optional parameters - # @return [Object] - def post_product_pickup(product_id, unknown_base_type, opts = {}) - data, _status_code, _headers = post_product_pickup_with_http_info(product_id, unknown_base_type, opts) + # @return [PutProductPickup200Response] + def post_product_pickup(product_id, put_product_pickup_request, opts = {}) + data, _status_code, _headers = post_product_pickup_with_http_info(product_id, put_product_pickup_request, opts) data end # おすすめ商品情報の追加 # おすすめ商品情報(おすすめ商品、売れ筋商品、新着商品、イチオシ商品のいずれか)を商品に追加します。 - # @param product_id 商品ID - # @param unknown_base_type + # @param product_id [Integer] 商品ID + # @param put_product_pickup_request [PutProductPickupRequest] # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def post_product_pickup_with_http_info(product_id, unknown_base_type, opts = {}) + # @return [Array<(PutProductPickup200Response, Integer, Hash)>] PutProductPickup200Response data, response status code and response headers + def post_product_pickup_with_http_info(product_id, put_product_pickup_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductApi.post_product_pickup ...' end @@ -247,56 +363,214 @@ def post_product_pickup_with_http_info(product_id, unknown_base_type, opts = {}) if @api_client.config.client_side_validation && product_id.nil? fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductApi.post_product_pickup" end - # verify the required parameter 'unknown_base_type' is set - if @api_client.config.client_side_validation && unknown_base_type.nil? - fail ArgumentError, "Missing the required parameter 'unknown_base_type' when calling ProductApi.post_product_pickup" + # verify the required parameter 'put_product_pickup_request' is set + if @api_client.config.client_side_validation && put_product_pickup_request.nil? + fail ArgumentError, "Missing the required parameter 'put_product_pickup_request' when calling ProductApi.post_product_pickup" end # resource path - local_var_path = '/v1/products/{productId}/pickups.json'.sub('{' + 'productId' + '}', product_id.to_s) + local_var_path = '/v1/products/{product_id}/pickups'.sub('{' + 'product_id' + '}', CGI.escape(product_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(unknown_base_type) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, + post_body = opts[:debug_body] || @api_client.object_to_http_body(put_product_pickup_request) + + # return_type + return_type = opts[:debug_return_type] || 'PutProductPickup200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ProductApi.post_product_pickup", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProductApi#post_product_pickup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + + # 商品データの追加 + # + # @param post_products_request [PostProductsRequest] 商品データ + # @param [Hash] opts the optional parameters + # @return [PostProducts200Response] + def post_products(post_products_request, opts = {}) + data, _status_code, _headers = post_products_with_http_info(post_products_request, opts) + data + end + + # 商品データの追加 + # + # @param post_products_request [PostProductsRequest] 商品データ + # @param [Hash] opts the optional parameters + # @return [Array<(PostProducts200Response, Integer, Hash)>] PostProducts200Response data, response status code and response headers + def post_products_with_http_info(post_products_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProductApi.post_products ...' + end + # verify the required parameter 'post_products_request' is set + if @api_client.config.client_side_validation && post_products_request.nil? + fail ArgumentError, "Missing the required parameter 'post_products_request' when calling ProductApi.post_products" + end + # resource path + local_var_path = '/v1/products' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(post_products_request) + + # return_type + return_type = opts[:debug_return_type] || 'PostProducts200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ProductApi.post_products", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProductApi#post_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # おすすめ商品情報の更新 + # おすすめ商品情報(おすすめ商品、売れ筋商品、新着商品、イチオシ商品のいずれか)を更新します。 + # @param product_id [Integer] 商品ID + # @param put_product_pickup_request [PutProductPickupRequest] + # @param [Hash] opts the optional parameters + # @return [PutProductPickup200Response] + def put_product_pickup(product_id, put_product_pickup_request, opts = {}) + data, _status_code, _headers = put_product_pickup_with_http_info(product_id, put_product_pickup_request, opts) + data + end + + # おすすめ商品情報の更新 + # おすすめ商品情報(おすすめ商品、売れ筋商品、新着商品、イチオシ商品のいずれか)を更新します。 + # @param product_id [Integer] 商品ID + # @param put_product_pickup_request [PutProductPickupRequest] + # @param [Hash] opts the optional parameters + # @return [Array<(PutProductPickup200Response, Integer, Hash)>] PutProductPickup200Response data, response status code and response headers + def put_product_pickup_with_http_info(product_id, put_product_pickup_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ProductApi.put_product_pickup ...' + end + # verify the required parameter 'product_id' is set + if @api_client.config.client_side_validation && product_id.nil? + fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductApi.put_product_pickup" + end + # verify the required parameter 'put_product_pickup_request' is set + if @api_client.config.client_side_validation && put_product_pickup_request.nil? + fail ArgumentError, "Missing the required parameter 'put_product_pickup_request' when calling ProductApi.put_product_pickup" + end + # resource path + local_var_path = '/v1/products/{product_id}/pickups'.sub('{' + 'product_id' + '}', CGI.escape(product_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(put_product_pickup_request) + + # return_type + return_type = opts[:debug_return_type] || 'PutProductPickup200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ProductApi.put_product_pickup", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ProductApi#put_product_pickup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # 商品データの更新 - # @param product_id 商品ID + # + # @param product_id [Integer] 商品ID # @param [Hash] opts the optional parameters - # @option opts [ProductUpdateRequest] :product_update_request 商品データ - # @return [Object] + # @option opts [UpdateProductRequest] :update_product_request 商品データ + # @return [PostProducts200Response] def update_product(product_id, opts = {}) data, _status_code, _headers = update_product_with_http_info(product_id, opts) data end # 商品データの更新 - # @param product_id 商品ID + # + # @param product_id [Integer] 商品ID # @param [Hash] opts the optional parameters - # @option opts [ProductUpdateRequest] :product_update_request 商品データ - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @option opts [UpdateProductRequest] :update_product_request 商品データ + # @return [Array<(PostProducts200Response, Integer, Hash)>] PostProducts200Response data, response status code and response headers def update_product_with_http_info(product_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ProductApi.update_product ...' @@ -306,31 +580,44 @@ def update_product_with_http_info(product_id, opts = {}) fail ArgumentError, "Missing the required parameter 'product_id' when calling ProductApi.update_product" end # resource path - local_var_path = '/v1/products/{productId}.json'.sub('{' + 'productId' + '}', product_id.to_s) + local_var_path = '/v1/products/{product_id}'.sub('{' + 'product_id' + '}', CGI.escape(product_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'product_update_request']) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_product_request']) + + # return_type + return_type = opts[:debug_return_type] || 'PostProducts200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ProductApi.update_product", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ProductApi#update_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/sale_api.rb b/lib/color_me_shop/api/sale_api.rb index f3967ba..a2d9ab8 100644 --- a/lib/color_me_shop/api/sale_api.rb +++ b/lib/color_me_shop/api/sale_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class SaleApi @@ -20,22 +20,22 @@ def initialize(api_client = ApiClient.default) @api_client = api_client end # 受注のキャンセル - # 受注をキャンセルすると、以下のことが起こります。 - 該当受注の商品購入数が0になる - 該当受注の合計金額が0になる - 該当受注の`canceled`が`true`になる - 該当受注に使用されたショップポイント・GMOポイントがキャンセルされる - 該当受注の決済がAmazon Pay、または楽天ペイ(オンライン決済)である場合は、決済金額が自動的に購入者へ返金される - カラメル等の販売手数料が0になる - # @param sale_id + # 受注をキャンセルすると、以下のことが起こります。 - 該当受注の商品購入数が0になる - 該当受注の合計金額が0になる - 該当受注の`canceled`が`true`になる - 該当受注に使用されたショップポイント・GMOポイントがキャンセルされる - 該当受注の決済がAmazon Pay、LINE Pay、または楽天ペイ(オンライン決済)である場合は、決済金額が自動的に購入者へ返金される - 該当受注の決済がPayPay(イプシロン)である場合には、イプシロン側の決済もキャンセルされる - ショップポイントがキャンセルされる 販売手数料確定前の場合は以下のことが起こります。 - 販売手数料が0になる - 付与したGMOポイントがキャンセルされる - 購入者が使用したGMOポイントがキャンセルされる 現在、以下の機能はサポートしていません。 - キャンセル連動設定を利用した、クレジット(イプシロン)決済のキャンセル - 分割された受注のキャンセル + # @param sale_id [Integer] # @param [Hash] opts the optional parameters - # @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type - # @return [Object] + # @option opts [CancelSaleRequest] :cancel_sale_request + # @return [UpdateSale200Response] def cancel_sale(sale_id, opts = {}) data, _status_code, _headers = cancel_sale_with_http_info(sale_id, opts) data end # 受注のキャンセル - # 受注をキャンセルすると、以下のことが起こります。 - 該当受注の商品購入数が0になる - 該当受注の合計金額が0になる - 該当受注の`canceled`が`true`になる - 該当受注に使用されたショップポイント・GMOポイントがキャンセルされる - 該当受注の決済がAmazon Pay、または楽天ペイ(オンライン決済)である場合は、決済金額が自動的に購入者へ返金される - カラメル等の販売手数料が0になる - # @param sale_id + # 受注をキャンセルすると、以下のことが起こります。 - 該当受注の商品購入数が0になる - 該当受注の合計金額が0になる - 該当受注の`canceled`が`true`になる - 該当受注に使用されたショップポイント・GMOポイントがキャンセルされる - 該当受注の決済がAmazon Pay、LINE Pay、または楽天ペイ(オンライン決済)である場合は、決済金額が自動的に購入者へ返金される - 該当受注の決済がPayPay(イプシロン)である場合には、イプシロン側の決済もキャンセルされる - ショップポイントがキャンセルされる 販売手数料確定前の場合は以下のことが起こります。 - 販売手数料が0になる - 付与したGMOポイントがキャンセルされる - 購入者が使用したGMOポイントがキャンセルされる 現在、以下の機能はサポートしていません。 - キャンセル連動設定を利用した、クレジット(イプシロン)決済のキャンセル - 分割された受注のキャンセル + # @param sale_id [Integer] # @param [Hash] opts the optional parameters - # @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @option opts [CancelSaleRequest] :cancel_sale_request + # @return [Array<(UpdateSale200Response, Integer, Hash)>] UpdateSale200Response data, response status code and response headers def cancel_sale_with_http_info(sale_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SaleApi.cancel_sale ...' @@ -45,49 +45,65 @@ def cancel_sale_with_http_info(sale_id, opts = {}) fail ArgumentError, "Missing the required parameter 'sale_id' when calling SaleApi.cancel_sale" end # resource path - local_var_path = '/v1/sales/{saleId}/cancel.json'.sub('{' + 'saleId' + '}', sale_id.to_s) + local_var_path = '/v1/sales/{sale_id}/cancel'.sub('{' + 'sale_id' + '}', CGI.escape(sale_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'unknown_base_type']) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'cancel_sale_request']) + + # return_type + return_type = opts[:debug_return_type] || 'UpdateSale200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"SaleApi.cancel_sale", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SaleApi#cancel_sale\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # 受注データの取得 - # @param sale_id + # + # @param sale_id [Integer] # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetSale200Response] def get_sale(sale_id, opts = {}) data, _status_code, _headers = get_sale_with_http_info(sale_id, opts) data end # 受注データの取得 - # @param sale_id + # + # @param sale_id [Integer] # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetSale200Response, Integer, Hash)>] GetSale200Response data, response status code and response headers def get_sale_with_http_info(sale_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SaleApi.get_sale ...' @@ -97,105 +113,123 @@ def get_sale_with_http_info(sale_id, opts = {}) fail ArgumentError, "Missing the required parameter 'sale_id' when calling SaleApi.get_sale" end # resource path - local_var_path = '/v1/sales/{saleId}.json'.sub('{' + 'saleId' + '}', sale_id.to_s) + local_var_path = '/v1/sales/{sale_id}'.sub('{' + 'sale_id' + '}', CGI.escape(sale_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetSale200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"SaleApi.get_sale", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SaleApi#get_sale\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # 受注データのリストを取得 + # 受注データのリストを取得します。(日付が指定されていない場合は直近1週間分を取得します。) # @param [Hash] opts the optional parameters # @option opts [String] :ids 受注IDで検索。カンマ区切りで複数指定可能 - # @option opts [String] :after 指定日時以降の受注から検索 + # @option opts [String] :after 指定日時以降の受注から検索。 `after` 未指定時は `before` の指定日時の7日前の0時、 `before` 未指定時は現在から7日前の0時がデフォルト値となります。 # @option opts [String] :before 指定日時以前の受注から検索 # @option opts [String] :make_date_min `after`と同義 # @option opts [String] :make_date_max `before`と同義 # @option opts [String] :update_date_min 指定日時以降に更新された受注から検索 - # @option opts [String] :update_date_max 指定日時以降に更新された受注から検索 + # @option opts [String] :update_date_max 指定日時以前に更新された受注から検索 # @option opts [String] :customer_ids 購入した顧客IDで検索。カンマ区切りにすることで複数検索が可能 # @option opts [String] :customer_name 購入した顧客名で部分一致検索 # @option opts [String] :customer_furigana 購入した顧客フリガナがで部分一致検索 # @option opts [String] :customer_mail 購入した顧客メールアドレスで部分一致検索 - # @option opts [Integer] :accepted_mail_state 受注メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - # @option opts [Integer] :paid_mail_state 入金メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - # @option opts [Integer] :delivered_mail_state 配送メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - # @option opts [BOOLEAN] :mobile `true`なら携帯からの受注のみ取得 - # @option opts [BOOLEAN] :paid `true`なら入金済みの受注のみ取得 - # @option opts [BOOLEAN] :delivered `true`なら配送済みの受注のみ取得 + # @option opts [String] :accepted_mail_state 受注メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [String] :paid_mail_state 入金メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [String] :delivered_mail_state 配送メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [Boolean] :mobile `true`なら携帯からの受注のみ取得 + # @option opts [Boolean] :paid `true`なら入金済みの受注のみ取得 + # @option opts [Boolean] :delivered `true`なら配送済みの受注のみ取得 + # @option opts [Boolean] :canceled `true`ならキャンセル済みの受注のみ取得 # @option opts [String] :payment_ids 使用された決済のIDで検索。カンマ区切りで複数指定可能 # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 - # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大100 # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す - # @return [Object] + # @return [GetSales200Response] def get_sales(opts = {}) data, _status_code, _headers = get_sales_with_http_info(opts) data end # 受注データのリストを取得 + # 受注データのリストを取得します。(日付が指定されていない場合は直近1週間分を取得します。) # @param [Hash] opts the optional parameters # @option opts [String] :ids 受注IDで検索。カンマ区切りで複数指定可能 - # @option opts [String] :after 指定日時以降の受注から検索 + # @option opts [String] :after 指定日時以降の受注から検索。 `after` 未指定時は `before` の指定日時の7日前の0時、 `before` 未指定時は現在から7日前の0時がデフォルト値となります。 # @option opts [String] :before 指定日時以前の受注から検索 # @option opts [String] :make_date_min `after`と同義 # @option opts [String] :make_date_max `before`と同義 # @option opts [String] :update_date_min 指定日時以降に更新された受注から検索 - # @option opts [String] :update_date_max 指定日時以降に更新された受注から検索 + # @option opts [String] :update_date_max 指定日時以前に更新された受注から検索 # @option opts [String] :customer_ids 購入した顧客IDで検索。カンマ区切りにすることで複数検索が可能 # @option opts [String] :customer_name 購入した顧客名で部分一致検索 # @option opts [String] :customer_furigana 購入した顧客フリガナがで部分一致検索 # @option opts [String] :customer_mail 購入した顧客メールアドレスで部分一致検索 - # @option opts [Integer] :accepted_mail_state 受注メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - # @option opts [Integer] :paid_mail_state 入金メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - # @option opts [Integer] :delivered_mail_state 配送メールの送信状態で検索 - `0`: 未送信 - `1`: 送信済み - `2`: 送信しない - # @option opts [BOOLEAN] :mobile `true`なら携帯からの受注のみ取得 - # @option opts [BOOLEAN] :paid `true`なら入金済みの受注のみ取得 - # @option opts [BOOLEAN] :delivered `true`なら配送済みの受注のみ取得 + # @option opts [String] :accepted_mail_state 受注メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [String] :paid_mail_state 入金メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [String] :delivered_mail_state 配送メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [Boolean] :mobile `true`なら携帯からの受注のみ取得 + # @option opts [Boolean] :paid `true`なら入金済みの受注のみ取得 + # @option opts [Boolean] :delivered `true`なら配送済みの受注のみ取得 + # @option opts [Boolean] :canceled `true`ならキャンセル済みの受注のみ取得 # @option opts [String] :payment_ids 使用された決済のIDで検索。カンマ区切りで複数指定可能 # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 - # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大100 # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetSales200Response, Integer, Hash)>] GetSales200Response data, response status code and response headers def get_sales_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SaleApi.get_sales ...' end - if @api_client.config.client_side_validation && opts[:'accepted_mail_state'] && !['0', '1', '2'].include?(opts[:'accepted_mail_state']) - fail ArgumentError, 'invalid value for "accepted_mail_state", must be one of 0, 1, 2' + allowable_values = ["not_yet", "sent", "pass"] + if @api_client.config.client_side_validation && opts[:'accepted_mail_state'] && !allowable_values.include?(opts[:'accepted_mail_state']) + fail ArgumentError, "invalid value for \"accepted_mail_state\", must be one of #{allowable_values}" end - if @api_client.config.client_side_validation && opts[:'paid_mail_state'] && !['0', '1', '2'].include?(opts[:'paid_mail_state']) - fail ArgumentError, 'invalid value for "paid_mail_state", must be one of 0, 1, 2' + allowable_values = ["not_yet", "sent", "pass"] + if @api_client.config.client_side_validation && opts[:'paid_mail_state'] && !allowable_values.include?(opts[:'paid_mail_state']) + fail ArgumentError, "invalid value for \"paid_mail_state\", must be one of #{allowable_values}" end - if @api_client.config.client_side_validation && opts[:'delivered_mail_state'] && !['0', '1', '2'].include?(opts[:'delivered_mail_state']) - fail ArgumentError, 'invalid value for "delivered_mail_state", must be one of 0, 1, 2' + allowable_values = ["not_yet", "sent", "pass"] + if @api_client.config.client_side_validation && opts[:'delivered_mail_state'] && !allowable_values.include?(opts[:'delivered_mail_state']) + fail ArgumentError, "invalid value for \"delivered_mail_state\", must be one of #{allowable_values}" end # resource path - local_var_path = '/v1/sales.json' + local_var_path = '/v1/sales' # query parameters - query_params = {} + query_params = opts[:query_params] || {} query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? @@ -213,39 +247,51 @@ def get_sales_with_http_info(opts = {}) query_params[:'mobile'] = opts[:'mobile'] if !opts[:'mobile'].nil? query_params[:'paid'] = opts[:'paid'] if !opts[:'paid'].nil? query_params[:'delivered'] = opts[:'delivered'] if !opts[:'delivered'].nil? + query_params[:'canceled'] = opts[:'canceled'] if !opts[:'canceled'].nil? query_params[:'payment_ids'] = opts[:'payment_ids'] if !opts[:'payment_ids'].nil? query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetSales200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"SaleApi.get_sales", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SaleApi#get_sales\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # メールの送信 - # 受注・入金確認・商品発送メールを送ることができます。 - # @param sale_id + # 受注・入金確認・商品発送メールを送ることができます。 対象の受注が分割されている場合、 受注メール、入金確認メールは、親受注でのみ指定可能です。 + # @param sale_id [Integer] # @param [Hash] opts the optional parameters - # @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type + # @option opts [SendSalesMailRequest] :send_sales_mail_request # @return [nil] def send_sales_mail(sale_id, opts = {}) send_sales_mail_with_http_info(sale_id, opts) @@ -253,11 +299,11 @@ def send_sales_mail(sale_id, opts = {}) end # メールの送信 - # 受注・入金確認・商品発送メールを送ることができます。 - # @param sale_id + # 受注・入金確認・商品発送メールを送ることができます。 対象の受注が分割されている場合、 受注メール、入金確認メールは、親受注でのみ指定可能です。 + # @param sale_id [Integer] # @param [Hash] opts the optional parameters - # @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type - # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers + # @option opts [SendSalesMailRequest] :send_sales_mail_request + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def send_sales_mail_with_http_info(sale_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SaleApi.send_sales_mail ...' @@ -267,97 +313,125 @@ def send_sales_mail_with_http_info(sale_id, opts = {}) fail ArgumentError, "Missing the required parameter 'sale_id' when calling SaleApi.send_sales_mail" end # resource path - local_var_path = '/v1/sales/{saleId}/mails.json'.sub('{' + 'saleId' + '}', sale_id.to_s) + local_var_path = '/v1/sales/{sale_id}/mails'.sub('{' + 'sale_id' + '}', CGI.escape(sale_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'unknown_base_type']) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'send_sales_mail_request']) + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"SaleApi.send_sales_mail", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, - :auth_names => auth_names) + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SaleApi#send_sales_mail\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # 売上集計の取得 + # # @param [Hash] opts the optional parameters # @option opts [String] :make_date 集計対象とする売上の作成日。形式は\"2017-04-12\"、\"2017/04/12\"など。指定しない場合は今日の日付が使われる - # @return [Object] + # @return [StatSale200Response] def stat_sale(opts = {}) data, _status_code, _headers = stat_sale_with_http_info(opts) data end # 売上集計の取得 + # # @param [Hash] opts the optional parameters # @option opts [String] :make_date 集計対象とする売上の作成日。形式は\"2017-04-12\"、\"2017/04/12\"など。指定しない場合は今日の日付が使われる - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(StatSale200Response, Integer, Hash)>] StatSale200Response data, response status code and response headers def stat_sale_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SaleApi.stat_sale ...' end # resource path - local_var_path = '/v1/sales/stat.json' + local_var_path = '/v1/sales/stat' # query parameters - query_params = {} + query_params = opts[:query_params] || {} query_params[:'make_date'] = opts[:'make_date'] if !opts[:'make_date'].nil? # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'StatSale200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"SaleApi.stat_sale", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SaleApi#stat_sale\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end + # 受注データの更新 - # 該当受注の決済がAmazon Pay、または楽天ペイ(オンライン決済)である場合は、熨斗・メッセージカード・ラッピングの手数料を更新すると、決済金額が自動的に購入者に請求もしくは返金されます。 - # @param sale_id + # 該当受注の決済がAmazon Pay、LINE Pay、または楽天ペイ(オンライン決済)である場合は、熨斗・メッセージカード・ラッピングの手数料を更新すると、決済金額が自動的に購入者に請求もしくは返金されます。 ただし、LINE Payの場合は、決済金額の変更は減額のみ行うことができます。 + # @param sale_id [Integer] # @param [Hash] opts the optional parameters - # @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type - # @return [Object] + # @option opts [UpdateSaleRequest] :update_sale_request + # @return [UpdateSale200Response] def update_sale(sale_id, opts = {}) data, _status_code, _headers = update_sale_with_http_info(sale_id, opts) data end # 受注データの更新 - # 該当受注の決済がAmazon Pay、または楽天ペイ(オンライン決済)である場合は、熨斗・メッセージカード・ラッピングの手数料を更新すると、決済金額が自動的に購入者に請求もしくは返金されます。 - # @param sale_id + # 該当受注の決済がAmazon Pay、LINE Pay、または楽天ペイ(オンライン決済)である場合は、熨斗・メッセージカード・ラッピングの手数料を更新すると、決済金額が自動的に購入者に請求もしくは返金されます。 ただし、LINE Payの場合は、決済金額の変更は減額のみ行うことができます。 + # @param sale_id [Integer] # @param [Hash] opts the optional parameters - # @option opts [UNKNOWN_BASE_TYPE] :unknown_base_type - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @option opts [UpdateSaleRequest] :update_sale_request + # @return [Array<(UpdateSale200Response, Integer, Hash)>] UpdateSale200Response data, response status code and response headers def update_sale_with_http_info(sale_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SaleApi.update_sale ...' @@ -367,31 +441,44 @@ def update_sale_with_http_info(sale_id, opts = {}) fail ArgumentError, "Missing the required parameter 'sale_id' when calling SaleApi.update_sale" end # resource path - local_var_path = '/v1/sales/{saleId}.json'.sub('{' + 'saleId' + '}', sale_id.to_s) + local_var_path = '/v1/sales/{sale_id}'.sub('{' + 'sale_id' + '}', CGI.escape(sale_id.to_s)) # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'unknown_base_type']) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_sale_request']) + + # return_type + return_type = opts[:debug_return_type] || 'UpdateSale200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"SaleApi.update_sale", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: SaleApi#update_sale\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/script_api.rb b/lib/color_me_shop/api/script_api.rb deleted file mode 100644 index 60aec40..0000000 --- a/lib/color_me_shop/api/script_api.rb +++ /dev/null @@ -1,274 +0,0 @@ -=begin -#カラーミーショップ API - -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` - -OpenAPI spec version: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT - -=end - -require 'uri' - -module ColorMeShop - class ScriptApi - attr_accessor :api_client - - def initialize(api_client = ApiClient.default) - @api_client = api_client - end - # スクリプトタグの作成 - # @param unknown_base_type 作成するスクリプトタグの情報 - # @param [Hash] opts the optional parameters - # @return [Object] - def create_script_tag(unknown_base_type, opts = {}) - data, _status_code, _headers = create_script_tag_with_http_info(unknown_base_type, opts) - data - end - - # スクリプトタグの作成 - # @param unknown_base_type 作成するスクリプトタグの情報 - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def create_script_tag_with_http_info(unknown_base_type, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ScriptApi.create_script_tag ...' - end - # verify the required parameter 'unknown_base_type' is set - if @api_client.config.client_side_validation && unknown_base_type.nil? - fail ArgumentError, "Missing the required parameter 'unknown_base_type' when calling ScriptApi.create_script_tag" - end - # resource path - local_var_path = '/v1/script_tags.json' - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = @api_client.object_to_http_body(unknown_base_type) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ScriptApi#create_script_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # スクリプトタグの削除 - # @param script_tag_id - # @param [Hash] opts the optional parameters - # @return [nil] - def delete_script_tag(script_tag_id, opts = {}) - delete_script_tag_with_http_info(script_tag_id, opts) - nil - end - - # スクリプトタグの削除 - # @param script_tag_id - # @param [Hash] opts the optional parameters - # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def delete_script_tag_with_http_info(script_tag_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ScriptApi.delete_script_tag ...' - end - # verify the required parameter 'script_tag_id' is set - if @api_client.config.client_side_validation && script_tag_id.nil? - fail ArgumentError, "Missing the required parameter 'script_tag_id' when calling ScriptApi.delete_script_tag" - end - # resource path - local_var_path = '/v1/script_tags/{scriptTagId}.json'.sub('{' + 'scriptTagId' + '}', script_tag_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ScriptApi#delete_script_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # スクリプトタグの取得 - # @param script_tag_id - # @param [Hash] opts the optional parameters - # @return [Object] - def get_script_tag(script_tag_id, opts = {}) - data, _status_code, _headers = get_script_tag_with_http_info(script_tag_id, opts) - data - end - - # スクリプトタグの取得 - # @param script_tag_id - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def get_script_tag_with_http_info(script_tag_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ScriptApi.get_script_tag ...' - end - # verify the required parameter 'script_tag_id' is set - if @api_client.config.client_side_validation && script_tag_id.nil? - fail ArgumentError, "Missing the required parameter 'script_tag_id' when calling ScriptApi.get_script_tag" - end - # resource path - local_var_path = '/v1/script_tags/{scriptTagId}.json'.sub('{' + 'scriptTagId' + '}', script_tag_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ScriptApi#get_script_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # スクリプトタグの取得 - # @param [Hash] opts the optional parameters - # @return [Object] - def get_script_tags(opts = {}) - data, _status_code, _headers = get_script_tags_with_http_info(opts) - data - end - - # スクリプトタグの取得 - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def get_script_tags_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ScriptApi.get_script_tags ...' - end - # resource path - local_var_path = '/v1/script_tags.json' - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ScriptApi#get_script_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # スクリプトタグの更新 - # @param script_tag_id - # @param unknown_base_type 作成するスクリプトタグの情報 - # @param [Hash] opts the optional parameters - # @return [Object] - def update_script_tag(script_tag_id, unknown_base_type, opts = {}) - data, _status_code, _headers = update_script_tag_with_http_info(script_tag_id, unknown_base_type, opts) - data - end - - # スクリプトタグの更新 - # @param script_tag_id - # @param unknown_base_type 作成するスクリプトタグの情報 - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def update_script_tag_with_http_info(script_tag_id, unknown_base_type, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug 'Calling API: ScriptApi.update_script_tag ...' - end - # verify the required parameter 'script_tag_id' is set - if @api_client.config.client_side_validation && script_tag_id.nil? - fail ArgumentError, "Missing the required parameter 'script_tag_id' when calling ScriptApi.update_script_tag" - end - # verify the required parameter 'unknown_base_type' is set - if @api_client.config.client_side_validation && unknown_base_type.nil? - fail ArgumentError, "Missing the required parameter 'unknown_base_type' when calling ScriptApi.update_script_tag" - end - # resource path - local_var_path = '/v1/script_tags/{scriptTagId}.json'.sub('{' + 'scriptTagId' + '}', script_tag_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - # HTTP header 'Accept' (if needed) - header_params['Accept'] = @api_client.select_header_accept(['application/json']) - # HTTP header 'Content-Type' - header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) - - # form parameters - form_params = {} - - # http body (model) - post_body = @api_client.object_to_http_body(unknown_base_type) - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:PUT, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: ScriptApi#update_script_tag\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - end -end diff --git a/lib/color_me_shop/api/shop_api.rb b/lib/color_me_shop/api/shop_api.rb index 1be8504..858a378 100644 --- a/lib/color_me_shop/api/shop_api.rb +++ b/lib/color_me_shop/api/shop_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class ShopApi @@ -22,7 +22,7 @@ def initialize(api_client = ApiClient.default) # ショップ情報の取得 # ショップ名などの基本的な情報を取得することができるAPIです。 # @param [Hash] opts the optional parameters - # @return [Object] + # @return [GetShop200Response] def get_shop(opts = {}) data, _status_code, _headers = get_shop_with_http_info(opts) data @@ -31,35 +31,45 @@ def get_shop(opts = {}) # ショップ情報の取得 # ショップ名などの基本的な情報を取得することができるAPIです。 # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetShop200Response, Integer, Hash)>] GetShop200Response data, response status code and response headers def get_shop_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ShopApi.get_shop ...' end # resource path - local_var_path = '/v1/shop.json' + local_var_path = '/v1/shop' # query parameters - query_params = {} + query_params = opts[:query_params] || {} # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetShop200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ShopApi.get_shop", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: ShopApi#get_shop\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api/shop_coupon_api.rb b/lib/color_me_shop/api/shop_coupon_api.rb new file mode 100644 index 0000000..e637f58 --- /dev/null +++ b/lib/color_me_shop/api/shop_coupon_api.rb @@ -0,0 +1,142 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'cgi' + +module ColorMeShop + class ShopCouponApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # ショップクーポンの取得 + # + # @param coupon_id [Integer] Coupon ID + # @param [Hash] opts the optional parameters + # @return [GetCoupon200Response] + def get_coupon(coupon_id, opts = {}) + data, _status_code, _headers = get_coupon_with_http_info(coupon_id, opts) + data + end + + # ショップクーポンの取得 + # + # @param coupon_id [Integer] Coupon ID + # @param [Hash] opts the optional parameters + # @return [Array<(GetCoupon200Response, Integer, Hash)>] GetCoupon200Response data, response status code and response headers + def get_coupon_with_http_info(coupon_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShopCouponApi.get_coupon ...' + end + # verify the required parameter 'coupon_id' is set + if @api_client.config.client_side_validation && coupon_id.nil? + fail ArgumentError, "Missing the required parameter 'coupon_id' when calling ShopCouponApi.get_coupon" + end + # resource path + local_var_path = '/v1/shop_coupons/{coupon_id}'.sub('{' + 'coupon_id' + '}', CGI.escape(coupon_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetCoupon200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ShopCouponApi.get_coupon", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShopCouponApi#get_coupon\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # ショップクーポン一覧取得 + # + # @param [Hash] opts the optional parameters + # @return [GetCoupons200Response] + def get_coupons(opts = {}) + data, _status_code, _headers = get_coupons_with_http_info(opts) + data + end + + # ショップクーポン一覧取得 + # + # @param [Hash] opts the optional parameters + # @return [Array<(GetCoupons200Response, Integer, Hash)>] GetCoupons200Response data, response status code and response headers + def get_coupons_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ShopCouponApi.get_coupons ...' + end + # resource path + local_var_path = '/v1/shop_coupons' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetCoupons200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"ShopCouponApi.get_coupons", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ShopCouponApi#get_coupons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/color_me_shop/api/stock_api.rb b/lib/color_me_shop/api/stock_api.rb index ca9361d..91858a6 100644 --- a/lib/color_me_shop/api/stock_api.rb +++ b/lib/color_me_shop/api/stock_api.rb @@ -1,16 +1,16 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'uri' +require 'cgi' module ColorMeShop class StockApi @@ -27,13 +27,13 @@ def initialize(api_client = ApiClient.default) # @option opts [Integer] :category_id_small 小カテゴリーIDで検索 # @option opts [String] :model_number 型番で部分一致検索 # @option opts [String] :name 商品名で部分一致検索 - # @option opts [String] :display_state 掲載設定で検索 - # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、合計在庫数で検索される - # @option opts [BOOLEAN] :recent_zero_stocks `true` の場合、過去1週間以内に更新された商品から検索 + # @option opts [String] :display_state 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される + # @option opts [Boolean] :recent_zero_stocks `true` の場合、過去1週間以内にオプションが更新された商品から検索 # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す - # @return [Object] + # @return [GetStocks200Response] def get_stocks(opts = {}) data, _status_code, _headers = get_stocks_with_http_info(opts) data @@ -47,25 +47,26 @@ def get_stocks(opts = {}) # @option opts [Integer] :category_id_small 小カテゴリーIDで検索 # @option opts [String] :model_number 型番で部分一致検索 # @option opts [String] :name 商品名で部分一致検索 - # @option opts [String] :display_state 掲載設定で検索 - # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、合計在庫数で検索される - # @option opts [BOOLEAN] :recent_zero_stocks `true` の場合、過去1週間以内に更新された商品から検索 + # @option opts [String] :display_state 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される + # @option opts [Boolean] :recent_zero_stocks `true` の場合、過去1週間以内にオプションが更新された商品から検索 # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers + # @return [Array<(GetStocks200Response, Integer, Hash)>] GetStocks200Response data, response status code and response headers def get_stocks_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: StockApi.get_stocks ...' end - if @api_client.config.client_side_validation && opts[:'display_state'] && !['showing', 'hidden', 'showing_for_members', 'sale_for_members'].include?(opts[:'display_state']) - fail ArgumentError, 'invalid value for "display_state", must be one of showing, hidden, showing_for_members, sale_for_members' + allowable_values = ["showing", "hidden", "showing_for_members", "sale_for_members"] + if @api_client.config.client_side_validation && opts[:'display_state'] && !allowable_values.include?(opts[:'display_state']) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{allowable_values}" end # resource path - local_var_path = '/v1/stocks.json' + local_var_path = '/v1/stocks' # query parameters - query_params = {} + query_params = opts[:query_params] || {} query_params[:'ids'] = opts[:'ids'] if !opts[:'ids'].nil? query_params[:'category_id_big'] = opts[:'category_id_big'] if !opts[:'category_id_big'].nil? query_params[:'category_id_small'] = opts[:'category_id_small'] if !opts[:'category_id_small'].nil? @@ -79,23 +80,33 @@ def get_stocks_with_http_info(opts = {}) query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? # header parameters - header_params = {} + header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters - form_params = {} + form_params = opts[:form_params] || {} # http body (model) - post_body = nil - auth_names = ['OAuth2'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetStocks200Response' + + # auth_names + auth_names = opts[:debug_auth_names] || ['OAuth2'] + + new_options = opts.merge( + :operation => :"StockApi.get_stocks", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, - :return_type => 'Object') + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: StockApi#get_stocks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/lib/color_me_shop/api_client.rb b/lib/color_me_shop/api_client.rb index 4376e0f..eb50e37 100644 --- a/lib/color_me_shop/api_client.rb +++ b/lib/color_me_shop/api_client.rb @@ -1,22 +1,22 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'addressable' require 'date' require 'json' require 'logger' require 'tempfile' +require 'time' require 'typhoeus' -require 'uri' + module ColorMeShop class ApiClient @@ -45,10 +45,11 @@ def self.default # Call an API with given options. # - # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements: - # the data deserialized from response body (could be nil), response status code and response headers. + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers. def call_api(http_method, path, opts = {}) request = build_request(http_method, path, opts) + tempfile = download_file(request) if opts[:return_type] == 'File' response = request.run if @config.debugging @@ -70,7 +71,9 @@ def call_api(http_method, path, opts = {}) end end - if opts[:return_type] + if opts[:return_type] == 'File' + data = tempfile + elsif opts[:return_type] data = deserialize(response, opts[:return_type]) else data = nil @@ -88,12 +91,13 @@ def call_api(http_method, path, opts = {}) # @option opts [Object] :body HTTP body (JSON/XML) # @return [Typhoeus::Request] A Typhoeus Request def build_request(http_method, path, opts = {}) - url = build_request_url(path) + url = build_request_url(path, opts) http_method = http_method.to_sym.downcase header_params = @default_headers.merge(opts[:header_params] || {}) query_params = opts[:query_params] || {} form_params = opts[:form_params] || {} + follow_location = opts[:follow_location] || true update_params_for_auth! header_params, query_params, opts[:auth_names] @@ -110,7 +114,8 @@ def build_request(http_method, path, opts = {}) :ssl_verifyhost => _verify_ssl_host, :sslcert => @config.cert_file, :sslkey => @config.key_file, - :verbose => @config.debugging + :verbose => @config.debugging, + :followlocation => follow_location } # set custom cert, if provided @@ -124,9 +129,76 @@ def build_request(http_method, path, opts = {}) end end - request = Typhoeus::Request.new(url, req_opts) - download_file(request) if opts[:return_type] == 'File' - request + Typhoeus::Request.new(url, req_opts) + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + # + # @return [Tempfile] the tempfile generated + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + + tempfile end # Check if the given MIME is a JSON MIME. @@ -144,18 +216,13 @@ def json_mime?(mime) # Deserialize the response to the given return type. # # @param [Response] response HTTP response - # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]" + # @param [String] return_type some examples: "User", "Array", "Hash" def deserialize(response, return_type) body = response.body - - # handle file downloading - return the File instance processed in request callbacks - # note that response body is empty when the file is written in chunks in request on_body callback - return @tempfile if return_type == 'File' - return nil if body.nil? || body.empty? # return response body directly for String return type - return body if return_type == 'String' + return body.to_s if return_type == 'String' # ensuring a default content type content_type = response.headers['Content-Type'] || 'application/json' @@ -165,7 +232,7 @@ def deserialize(response, return_type) begin data = JSON.parse("[#{body}]", :symbolize_names => true)[0] rescue JSON::ParserError => e - if %w(String Date DateTime).include?(return_type) + if %w(String Date Time).include?(return_type) data = body else raise e @@ -188,11 +255,11 @@ def convert_to_type(data, return_type) data.to_i when 'Float' data.to_f - when 'BOOLEAN' + when 'Boolean' data == true - when 'DateTime' + when 'Time' # parse date time (expecting ISO 8601 format) - DateTime.parse data + Time.parse data when 'Date' # parse date time (expecting ISO 8601 format) Date.parse data @@ -210,46 +277,9 @@ def convert_to_type(data, return_type) data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } end else - # models, e.g. Pet - ColorMeShop.const_get(return_type).new.tap do |model| - model.build_from_hash data - end - end - end - - # Save response body into a file in (the defined) temporary folder, using the filename - # from the "Content-Disposition" header if provided, otherwise a random filename. - # The response body is written to the file in chunks in order to handle files which - # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby - # process can use. - # - # @see Configuration#temp_folder_path - def download_file(request) - tempfile = nil - encoding = nil - request.on_headers do |response| - content_disposition = response.headers['Content-Disposition'] - if content_disposition && content_disposition =~ /filename=/i - filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] - prefix = sanitize_filename(filename) - else - prefix = 'download-' - end - prefix = prefix + '-' unless prefix.end_with?('-') - encoding = response.body.encoding - tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) - @tempfile = tempfile - end - request.on_body do |chunk| - chunk.force_encoding(encoding) - tempfile.write(chunk) - end - request.on_complete do |response| - tempfile.close - @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ - "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ - "will be deleted automatically with GC. It's also recommended to delete the temp file "\ - "explicitly with `tempfile.delete`" + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) end end @@ -262,41 +292,13 @@ def sanitize_filename(filename) filename.gsub(/.*[\/\\]/, '') end - def build_request_url(path) + def build_request_url(path, opts = {}) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') - Addressable::URI.escape(@config.base_url + path) - end - - # Builds the HTTP request body - # - # @param [Hash] header_params Header parameters - # @param [Hash] form_params Query parameters - # @param [Object] body HTTP body (JSON/XML) - # @return [String] HTTP body data in the form of string - def build_request_body(header_params, form_params, body) - # http form - if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || - header_params['Content-Type'] == 'multipart/form-data' - data = {} - form_params.each do |key, value| - case value - when ::File, ::Array, nil - # let typhoeus handle File, Array and nil parameters - data[key] = value - else - data[key] = value.to_s - end - end - elsif body - data = body.is_a?(String) ? body : body.to_json - else - data = nil - end - data + @config.base_url(opts[:operation]) + path end - # Update hearder and query params based on authentication settings. + # Update header and query params based on authentication settings. # # @param [Hash] header_params Header parameters # @param [Hash] query_params Query parameters @@ -308,7 +310,7 @@ def update_params_for_auth!(header_params, query_params, auth_names) case auth_setting[:in] when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] - else fail ArgumentError, 'Authentication token must be in `query` of `header`' + else fail ArgumentError, 'Authentication token must be in `query` or `header`' end end end @@ -335,8 +337,8 @@ def select_header_accept(accepts) # @param [Array] content_types array for Content-Type # @return [String] the Content-Type header (e.g. application/json) def select_header_content_type(content_types) - # use application/json by default - return 'application/json' if content_types.nil? || content_types.empty? + # return nil by default + return if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first diff --git a/lib/color_me_shop/api_error.rb b/lib/color_me_shop/api_error.rb index 255af42..69ac0e3 100644 --- a/lib/color_me_shop/api_error.rb +++ b/lib/color_me_shop/api_error.rb @@ -1,12 +1,12 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end @@ -32,7 +32,27 @@ def initialize(arg = nil) end else super arg + @message = arg end end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end end end diff --git a/lib/color_me_shop/configuration.rb b/lib/color_me_shop/configuration.rb index 21147c2..087db43 100644 --- a/lib/color_me_shop/configuration.rb +++ b/lib/color_me_shop/configuration.rb @@ -1,18 +1,15 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end -require 'addressable' -require 'uri' - module ColorMeShop class Configuration # Defines url scheme @@ -24,6 +21,18 @@ class Configuration # Defines url base path attr_accessor :base_path + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + # Defines API keys used with API Key authentications. # # @return [Hash] key: parameter name, value: parameter value (API key) @@ -53,6 +62,16 @@ class Configuration # Defines the access token (Bearer) used with OAuth2. attr_accessor :access_token + # Defines a Proc used to fetch or refresh access tokens (Bearer) used with OAuth2. + # Overrides the access_token if set + # @return [Proc] + attr_accessor :access_token_getter + + # Set this to return data as binary instead of downloading a temp file. When enabled (set to true) + # HTTP responses with return type `File` will be returned as a stream of binary data. + # Default to false. + attr_accessor :return_binary_data + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response # details will be logged with `logger.debug` (see the `logger` attribute). # Default to false. @@ -124,6 +143,7 @@ class Configuration # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 attr_accessor :params_encoding + attr_accessor :inject_format attr_accessor :force_ending_format @@ -131,16 +151,20 @@ class Configuration def initialize @scheme = 'https' @host = 'api.shop-pro.jp' - @base_path = '/' + @base_path = '' + @server_index = nil + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} @api_key = {} @api_key_prefix = {} - @timeout = 0 @client_side_validation = true @verify_ssl = true @verify_ssl_host = true - @params_encoding = nil @cert_file = nil @key_file = nil + @timeout = 0 + @params_encoding = nil @debugging = false @inject_format = false @force_ending_format = false @@ -174,21 +198,34 @@ def base_path=(base_path) @base_path = '' if @base_path == '/' end - def base_url - url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') - Addressable::URI.escape(url) + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + if operation_server_settings.key?(operation) then + index = server_operation_index.fetch(operation, server_index) + server_url(index.nil? ? 0 : index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + else + server_index.nil? ? "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') : server_url(server_index, server_variables, nil) + end end # Gets API key (with prefix if set). # @param [String] param_name the parameter name of API key auth - def api_key_with_prefix(param_name) + def api_key_with_prefix(param_name, param_alias = nil) + key = @api_key[param_name] + key = @api_key.fetch(param_alias, key) unless param_alias.nil? if @api_key_prefix[param_name] - "#{@api_key_prefix[param_name]} #{@api_key[param_name]}" + "#{@api_key_prefix[param_name]} #{key}" else - @api_key[param_name] + key end end + # Gets access_token using access_token_getter or uses the static access_token + def access_token_with_refresh + return access_token if access_token_getter.nil? + access_token_getter.call + end + # Gets Basic Auth token string def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") @@ -202,9 +239,60 @@ def auth_settings type: 'oauth2', in: 'header', key: 'Authorization', - value: "Bearer #{access_token}" + value: "Bearer #{access_token_with_refresh}" }, } end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://api.shop-pro.jp", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index.nil? || index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must not be nil and must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + + end end diff --git a/lib/color_me_shop/models/application_charge.rb b/lib/color_me_shop/models/application_charge.rb deleted file mode 100644 index 1a820c5..0000000 --- a/lib/color_me_shop/models/application_charge.rb +++ /dev/null @@ -1,288 +0,0 @@ -=begin -#カラーミーショップ API - -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` - -OpenAPI spec version: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT - -=end - -require 'date' - -module ColorMeShop - class ApplicationCharge - # 課金ID - attr_accessor :id - - # アカウントID - attr_accessor :account_id - - # アプリケーションID - attr_accessor :oauth_application_id - - # 課金プランID - attr_accessor :application_charge_plan_id - - # ショップオーナー様が課金の許可/拒否を行った後に遷移するURL - attr_accessor :return_url - - # ステータス - attr_accessor :status - - # 作成日時 - attr_accessor :make_date - - # 更新日時 - attr_accessor :update_date - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'account_id' => :'account_id', - :'oauth_application_id' => :'oauth_application_id', - :'application_charge_plan_id' => :'application_charge_plan_id', - :'return_url' => :'return_url', - :'status' => :'status', - :'make_date' => :'make_date', - :'update_date' => :'update_date' - } - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'Integer', - :'account_id' => :'String', - :'oauth_application_id' => :'Integer', - :'application_charge_plan_id' => :'Integer', - :'return_url' => :'String', - :'status' => :'String', - :'make_date' => :'Integer', - :'update_date' => :'Integer' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } - - if attributes.has_key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.has_key?(:'account_id') - self.account_id = attributes[:'account_id'] - end - - if attributes.has_key?(:'oauth_application_id') - self.oauth_application_id = attributes[:'oauth_application_id'] - end - - if attributes.has_key?(:'application_charge_plan_id') - self.application_charge_plan_id = attributes[:'application_charge_plan_id'] - end - - if attributes.has_key?(:'return_url') - self.return_url = attributes[:'return_url'] - end - - if attributes.has_key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.has_key?(:'make_date') - self.make_date = attributes[:'make_date'] - end - - if attributes.has_key?(:'update_date') - self.update_date = attributes[:'update_date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - status_validator = EnumAttributeValidator.new('String', ['pending', 'accepted', 'declined', 'active', 'expired']) - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ['pending', 'accepted', 'declined', 'active', 'expired']) - unless validator.valid?(status) - fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.' - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - account_id == o.account_id && - oauth_application_id == o.oauth_application_id && - application_charge_plan_id == o.application_charge_plan_id && - return_url == o.return_url && - status == o.status && - make_date == o.make_date && - update_date == o.update_date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [id, account_id, oauth_application_id, application_charge_plan_id, return_url, status, make_date, update_date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end -end diff --git a/lib/color_me_shop/models/application_charge_create_response.rb b/lib/color_me_shop/models/application_charge_create_response.rb deleted file mode 100644 index c8b99ab..0000000 --- a/lib/color_me_shop/models/application_charge_create_response.rb +++ /dev/null @@ -1,298 +0,0 @@ -=begin -#カラーミーショップ API - -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` - -OpenAPI spec version: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT - -=end - -require 'date' - -module ColorMeShop - class ApplicationChargeCreateResponse - # 課金ID - attr_accessor :id - - # アカウントID - attr_accessor :account_id - - # アプリケーションID - attr_accessor :oauth_application_id - - # 課金プランID - attr_accessor :application_charge_plan_id - - # ショップオーナー様が課金の許可/拒否を行った後に遷移するURL - attr_accessor :return_url - - # ショップオーナー様が課金のOK/NGを行う確認画面ページのURLです。 URLには課金IDとsignatureを含んでいます。 - attr_accessor :confirmation_url - - # ステータス - attr_accessor :status - - # 作成日時 - attr_accessor :make_date - - # 更新日時 - attr_accessor :update_date - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'account_id' => :'account_id', - :'oauth_application_id' => :'oauth_application_id', - :'application_charge_plan_id' => :'application_charge_plan_id', - :'return_url' => :'return_url', - :'confirmation_url' => :'confirmation_url', - :'status' => :'status', - :'make_date' => :'make_date', - :'update_date' => :'update_date' - } - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'Integer', - :'account_id' => :'String', - :'oauth_application_id' => :'Integer', - :'application_charge_plan_id' => :'Integer', - :'return_url' => :'String', - :'confirmation_url' => :'String', - :'status' => :'String', - :'make_date' => :'Integer', - :'update_date' => :'Integer' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } - - if attributes.has_key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.has_key?(:'account_id') - self.account_id = attributes[:'account_id'] - end - - if attributes.has_key?(:'oauth_application_id') - self.oauth_application_id = attributes[:'oauth_application_id'] - end - - if attributes.has_key?(:'application_charge_plan_id') - self.application_charge_plan_id = attributes[:'application_charge_plan_id'] - end - - if attributes.has_key?(:'return_url') - self.return_url = attributes[:'return_url'] - end - - if attributes.has_key?(:'confirmation_url') - self.confirmation_url = attributes[:'confirmation_url'] - end - - if attributes.has_key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.has_key?(:'make_date') - self.make_date = attributes[:'make_date'] - end - - if attributes.has_key?(:'update_date') - self.update_date = attributes[:'update_date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - status_validator = EnumAttributeValidator.new('String', ['pending', 'accepted', 'declined', 'active', 'expired']) - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ['pending', 'accepted', 'declined', 'active', 'expired']) - unless validator.valid?(status) - fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.' - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - account_id == o.account_id && - oauth_application_id == o.oauth_application_id && - application_charge_plan_id == o.application_charge_plan_id && - return_url == o.return_url && - confirmation_url == o.confirmation_url && - status == o.status && - make_date == o.make_date && - update_date == o.update_date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [id, account_id, oauth_application_id, application_charge_plan_id, return_url, confirmation_url, status, make_date, update_date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end -end diff --git a/lib/color_me_shop/models/cancel_sale_request.rb b/lib/color_me_shop/models/cancel_sale_request.rb new file mode 100644 index 0000000..2cdae6e --- /dev/null +++ b/lib/color_me_shop/models/cancel_sale_request.rb @@ -0,0 +1,215 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class CancelSaleRequest + # `true`の場合、在庫管理している商品について、購入された分の在庫数を充当する + attr_accessor :restock + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'restock' => :'restock' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'restock' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::CancelSaleRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::CancelSaleRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'restock') + self.restock = attributes[:'restock'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + restock == o.restock + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [restock].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/customer.rb b/lib/color_me_shop/models/customer.rb index 67cc4b5..3f6db79 100644 --- a/lib/color_me_shop/models/customer.rb +++ b/lib/color_me_shop/models/customer.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class Customer @@ -35,6 +36,9 @@ class Customer # 性別 attr_accessor :sex + # 誕生日 + attr_accessor :birthday + # 郵便番号 attr_accessor :postal @@ -63,7 +67,7 @@ class Customer attr_accessor :tel_mobile # 備考 - attr_accessor :memo + attr_accessor :other # 保有ポイント数 attr_accessor :points @@ -74,6 +78,18 @@ class Customer # これまでの購入回数 attr_accessor :sales_count + # メルマガ受信可否 + attr_accessor :receive_mail_magazine + + # フリー項目1の入力内容 + attr_accessor :answer_free_form1 + + # フリー項目2の入力内容 + attr_accessor :answer_free_form2 + + # フリー項目3の入力内容 + attr_accessor :answer_free_form3 + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -106,6 +122,7 @@ def self.attribute_map :'hojin' => :'hojin', :'busho' => :'busho', :'sex' => :'sex', + :'birthday' => :'birthday', :'postal' => :'postal', :'pref_id' => :'pref_id', :'pref_name' => :'pref_name', @@ -115,13 +132,22 @@ def self.attribute_map :'tel' => :'tel', :'fax' => :'fax', :'tel_mobile' => :'tel_mobile', - :'memo' => :'memo', + :'other' => :'other', :'points' => :'points', :'member' => :'member', - :'sales_count' => :'sales_count' + :'sales_count' => :'sales_count', + :'receive_mail_magazine' => :'receive_mail_magazine', + :'answer_free_form1' => :'answer_free_form1', + :'answer_free_form2' => :'answer_free_form2', + :'answer_free_form3' => :'answer_free_form3' } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -132,6 +158,7 @@ def self.openapi_types :'hojin' => :'String', :'busho' => :'String', :'sex' => :'String', + :'birthday' => :'String', :'postal' => :'String', :'pref_id' => :'Integer', :'pref_name' => :'String', @@ -141,105 +168,163 @@ def self.openapi_types :'tel' => :'String', :'fax' => :'String', :'tel_mobile' => :'String', - :'memo' => :'String', + :'other' => :'String', :'points' => :'Integer', - :'member' => :'BOOLEAN', - :'sales_count' => :'Integer' + :'member' => :'Boolean', + :'sales_count' => :'Integer', + :'receive_mail_magazine' => :'Boolean', + :'answer_free_form1' => :'String', + :'answer_free_form2' => :'String', + :'answer_free_form3' => :'String' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'furigana', + :'hojin', + :'busho', + :'sex', + :'birthday', + :'postal', + :'pref_id', + :'pref_name', + :'address1', + :'address2', + :'mail', + :'tel', + :'fax', + :'tel_mobile', + :'other', + :'receive_mail_magazine', + :'answer_free_form1', + :'answer_free_form2', + :'answer_free_form3' + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::Customer` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::Customer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'furigana') + if attributes.key?(:'furigana') self.furigana = attributes[:'furigana'] end - if attributes.has_key?(:'hojin') + if attributes.key?(:'hojin') self.hojin = attributes[:'hojin'] end - if attributes.has_key?(:'busho') + if attributes.key?(:'busho') self.busho = attributes[:'busho'] end - if attributes.has_key?(:'sex') + if attributes.key?(:'sex') self.sex = attributes[:'sex'] end - if attributes.has_key?(:'postal') + if attributes.key?(:'birthday') + self.birthday = attributes[:'birthday'] + end + + if attributes.key?(:'postal') self.postal = attributes[:'postal'] end - if attributes.has_key?(:'pref_id') + if attributes.key?(:'pref_id') self.pref_id = attributes[:'pref_id'] end - if attributes.has_key?(:'pref_name') + if attributes.key?(:'pref_name') self.pref_name = attributes[:'pref_name'] end - if attributes.has_key?(:'address1') + if attributes.key?(:'address1') self.address1 = attributes[:'address1'] end - if attributes.has_key?(:'address2') + if attributes.key?(:'address2') self.address2 = attributes[:'address2'] end - if attributes.has_key?(:'mail') + if attributes.key?(:'mail') self.mail = attributes[:'mail'] end - if attributes.has_key?(:'tel') + if attributes.key?(:'tel') self.tel = attributes[:'tel'] end - if attributes.has_key?(:'fax') + if attributes.key?(:'fax') self.fax = attributes[:'fax'] end - if attributes.has_key?(:'tel_mobile') + if attributes.key?(:'tel_mobile') self.tel_mobile = attributes[:'tel_mobile'] end - if attributes.has_key?(:'memo') - self.memo = attributes[:'memo'] + if attributes.key?(:'other') + self.other = attributes[:'other'] end - if attributes.has_key?(:'points') + if attributes.key?(:'points') self.points = attributes[:'points'] end - if attributes.has_key?(:'member') + if attributes.key?(:'member') self.member = attributes[:'member'] end - if attributes.has_key?(:'sales_count') + if attributes.key?(:'sales_count') self.sales_count = attributes[:'sales_count'] end + + if attributes.key?(:'receive_mail_magazine') + self.receive_mail_magazine = attributes[:'receive_mail_magazine'] + end + + if attributes.key?(:'answer_free_form1') + self.answer_free_form1 = attributes[:'answer_free_form1'] + end + + if attributes.key?(:'answer_free_form2') + self.answer_free_form2 = attributes[:'answer_free_form2'] + end + + if attributes.key?(:'answer_free_form3') + self.answer_free_form3 = attributes[:'answer_free_form3'] + end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -247,7 +332,8 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - sex_validator = EnumAttributeValidator.new('String', ['male', 'female']) + warn '[DEPRECATED] the `valid?` method is obsolete' + sex_validator = EnumAttributeValidator.new('String', ["male", "female"]) return false unless sex_validator.valid?(@sex) true end @@ -255,9 +341,9 @@ def valid? # Custom attribute writer method checking allowed values (enum). # @param [Object] sex Object to be assigned def sex=(sex) - validator = EnumAttributeValidator.new('String', ['male', 'female']) + validator = EnumAttributeValidator.new('String', ["male", "female"]) unless validator.valid?(sex) - fail ArgumentError, 'invalid value for "sex", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"sex\", must be one of #{validator.allowable_values}." end @sex = sex end @@ -274,6 +360,7 @@ def ==(o) hojin == o.hojin && busho == o.busho && sex == o.sex && + birthday == o.birthday && postal == o.postal && pref_id == o.pref_id && pref_name == o.pref_name && @@ -283,10 +370,14 @@ def ==(o) tel == o.tel && fax == o.fax && tel_mobile == o.tel_mobile && - memo == o.memo && + other == o.other && points == o.points && member == o.member && - sales_count == o.sales_count + sales_count == o.sales_count && + receive_mail_magazine == o.receive_mail_magazine && + answer_free_form1 == o.answer_free_form1 && + answer_free_form2 == o.answer_free_form2 && + answer_free_form3 == o.answer_free_form3 end # @see the `==` method @@ -296,39 +387,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [id, account_id, name, furigana, hojin, busho, sex, postal, pref_id, pref_name, address1, address2, mail, tel, fax, tel_mobile, memo, points, member, sales_count].hash + [id, account_id, name, furigana, hojin, busho, sex, birthday, postal, pref_id, pref_name, address1, address2, mail, tel, fax, tel_mobile, other, points, member, sales_count, receive_mail_magazine, answer_free_form1, answer_free_form2, answer_free_form3].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -337,7 +431,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -358,8 +452,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -381,7 +476,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -404,5 +503,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/delivery.rb b/lib/color_me_shop/models/delivery.rb index 47c7815..25bd930 100644 --- a/lib/color_me_shop/models/delivery.rb +++ b/lib/color_me_shop/models/delivery.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class Delivery @@ -23,6 +24,9 @@ class Delivery # 配送方法名 attr_accessor :name + # 配送方法区分 - `other`: そのほか - `yamato`: クロネコヤマト - `yamato_pickup`: ヤマト自宅外受け取り - `sagawa`: 佐川急便 - `jp`: 日本郵便 + attr_accessor :method_type + # 配送方法画像URL attr_accessor :image_url @@ -35,7 +39,6 @@ class Delivery # 配送料の計算方法 - `fixed`: 固定額 - `by_price`: 注文金額によって決定 - `by_area`: 配送先都道府県によって決定 - `by_weight`: 商品重量によって決定 attr_accessor :charge_type - # 配送料設定の詳細。上記の`charge_free_type`や`charge_type`に基づいて、この中から配送料が決定される attr_accessor :charge # 送料が税込み料金であるか否か @@ -65,6 +68,9 @@ class Delivery # 配送時間帯を指定可能か attr_accessor :preferred_period_use + # 利用不可決済方法の配列 + attr_accessor :unavailable_payment_ids + # 配送方法作成日時 attr_accessor :make_date @@ -99,6 +105,7 @@ def self.attribute_map :'id' => :'id', :'account_id' => :'account_id', :'name' => :'name', + :'method_type' => :'method_type', :'image_url' => :'image_url', :'charge_free_type' => :'charge_free_type', :'charge_free_limit' => :'charge_free_limit', @@ -113,117 +120,154 @@ def self.attribute_map :'display_state' => :'display_state', :'preferred_date_use' => :'preferred_date_use', :'preferred_period_use' => :'preferred_period_use', + :'unavailable_payment_ids' => :'unavailable_payment_ids', :'make_date' => :'make_date', :'update_date' => :'update_date' } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { :'id' => :'Integer', :'account_id' => :'String', :'name' => :'String', + :'method_type' => :'String', :'image_url' => :'String', :'charge_free_type' => :'String', :'charge_free_limit' => :'Integer', :'charge_type' => :'String', - :'charge' => :'Object', - :'tax_included' => :'BOOLEAN', - :'slip_number_use' => :'BOOLEAN', + :'charge' => :'GetDeliveries200ResponseDeliveriesInnerCharge', + :'tax_included' => :'Boolean', + :'slip_number_use' => :'Boolean', :'slip_number_url' => :'String', :'memo' => :'String', :'memo2' => :'String', :'sort' => :'Integer', :'display_state' => :'String', - :'preferred_date_use' => :'BOOLEAN', - :'preferred_period_use' => :'BOOLEAN', + :'preferred_date_use' => :'Boolean', + :'preferred_period_use' => :'Boolean', + :'unavailable_payment_ids' => :'Array', :'make_date' => :'Integer', :'update_date' => :'Integer' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'charge_free_limit', + :'slip_number_url', + :'memo', + :'memo2', + :'sort', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::Delivery` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::Delivery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'image_url') + if attributes.key?(:'method_type') + self.method_type = attributes[:'method_type'] + end + + if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end - if attributes.has_key?(:'charge_free_type') + if attributes.key?(:'charge_free_type') self.charge_free_type = attributes[:'charge_free_type'] end - if attributes.has_key?(:'charge_free_limit') + if attributes.key?(:'charge_free_limit') self.charge_free_limit = attributes[:'charge_free_limit'] end - if attributes.has_key?(:'charge_type') + if attributes.key?(:'charge_type') self.charge_type = attributes[:'charge_type'] end - if attributes.has_key?(:'charge') + if attributes.key?(:'charge') self.charge = attributes[:'charge'] end - if attributes.has_key?(:'tax_included') + if attributes.key?(:'tax_included') self.tax_included = attributes[:'tax_included'] end - if attributes.has_key?(:'slip_number_use') + if attributes.key?(:'slip_number_use') self.slip_number_use = attributes[:'slip_number_use'] end - if attributes.has_key?(:'slip_number_url') + if attributes.key?(:'slip_number_url') self.slip_number_url = attributes[:'slip_number_url'] end - if attributes.has_key?(:'memo') + if attributes.key?(:'memo') self.memo = attributes[:'memo'] end - if attributes.has_key?(:'memo2') + if attributes.key?(:'memo2') self.memo2 = attributes[:'memo2'] end - if attributes.has_key?(:'sort') + if attributes.key?(:'sort') self.sort = attributes[:'sort'] end - if attributes.has_key?(:'display_state') + if attributes.key?(:'display_state') self.display_state = attributes[:'display_state'] end - if attributes.has_key?(:'preferred_date_use') + if attributes.key?(:'preferred_date_use') self.preferred_date_use = attributes[:'preferred_date_use'] end - if attributes.has_key?(:'preferred_period_use') + if attributes.key?(:'preferred_period_use') self.preferred_period_use = attributes[:'preferred_period_use'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'unavailable_payment_ids') + if (value = attributes[:'unavailable_payment_ids']).is_a?(Array) + self.unavailable_payment_ids = value + end + end + + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end end @@ -231,6 +275,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -238,21 +283,34 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - charge_free_type_validator = EnumAttributeValidator.new('String', ['not_free', 'free', 'free_to_limit']) + warn '[DEPRECATED] the `valid?` method is obsolete' + method_type_validator = EnumAttributeValidator.new('String', ["other", "yamato", "yamato_pickup", "sagawa", "jp"]) + return false unless method_type_validator.valid?(@method_type) + charge_free_type_validator = EnumAttributeValidator.new('String', ["not_free", "free", "free_to_limit"]) return false unless charge_free_type_validator.valid?(@charge_free_type) - charge_type_validator = EnumAttributeValidator.new('String', ['fixed', 'by_price', 'by_area', 'by_weight']) + charge_type_validator = EnumAttributeValidator.new('String', ["fixed", "by_price", "by_area", "by_weight"]) return false unless charge_type_validator.valid?(@charge_type) - display_state_validator = EnumAttributeValidator.new('String', ['showing', 'hidden']) + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden"]) return false unless display_state_validator.valid?(@display_state) true end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] method_type Object to be assigned + def method_type=(method_type) + validator = EnumAttributeValidator.new('String', ["other", "yamato", "yamato_pickup", "sagawa", "jp"]) + unless validator.valid?(method_type) + fail ArgumentError, "invalid value for \"method_type\", must be one of #{validator.allowable_values}." + end + @method_type = method_type + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] charge_free_type Object to be assigned def charge_free_type=(charge_free_type) - validator = EnumAttributeValidator.new('String', ['not_free', 'free', 'free_to_limit']) + validator = EnumAttributeValidator.new('String', ["not_free", "free", "free_to_limit"]) unless validator.valid?(charge_free_type) - fail ArgumentError, 'invalid value for "charge_free_type", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"charge_free_type\", must be one of #{validator.allowable_values}." end @charge_free_type = charge_free_type end @@ -260,9 +318,9 @@ def charge_free_type=(charge_free_type) # Custom attribute writer method checking allowed values (enum). # @param [Object] charge_type Object to be assigned def charge_type=(charge_type) - validator = EnumAttributeValidator.new('String', ['fixed', 'by_price', 'by_area', 'by_weight']) + validator = EnumAttributeValidator.new('String', ["fixed", "by_price", "by_area", "by_weight"]) unless validator.valid?(charge_type) - fail ArgumentError, 'invalid value for "charge_type", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"charge_type\", must be one of #{validator.allowable_values}." end @charge_type = charge_type end @@ -270,9 +328,9 @@ def charge_type=(charge_type) # Custom attribute writer method checking allowed values (enum). # @param [Object] display_state Object to be assigned def display_state=(display_state) - validator = EnumAttributeValidator.new('String', ['showing', 'hidden']) + validator = EnumAttributeValidator.new('String', ["showing", "hidden"]) unless validator.valid?(display_state) - fail ArgumentError, 'invalid value for "display_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." end @display_state = display_state end @@ -285,6 +343,7 @@ def ==(o) id == o.id && account_id == o.account_id && name == o.name && + method_type == o.method_type && image_url == o.image_url && charge_free_type == o.charge_free_type && charge_free_limit == o.charge_free_limit && @@ -299,6 +358,7 @@ def ==(o) display_state == o.display_state && preferred_date_use == o.preferred_date_use && preferred_period_use == o.preferred_period_use && + unavailable_payment_ids == o.unavailable_payment_ids && make_date == o.make_date && update_date == o.update_date end @@ -310,39 +370,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [id, account_id, name, image_url, charge_free_type, charge_free_limit, charge_type, charge, tax_included, slip_number_use, slip_number_url, memo, memo2, sort, display_state, preferred_date_use, preferred_period_use, make_date, update_date].hash + [id, account_id, name, method_type, image_url, charge_free_type, charge_free_limit, charge_type, charge, tax_included, slip_number_use, slip_number_url, memo, memo2, sort, display_state, preferred_date_use, preferred_period_use, unavailable_payment_ids, make_date, update_date].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -351,7 +414,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -372,8 +435,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -395,7 +459,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -418,5 +486,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/delivery_charge_by_prefecture.rb b/lib/color_me_shop/models/delivery_charge_by_prefecture.rb index 6cfb00d..31b6706 100644 --- a/lib/color_me_shop/models/delivery_charge_by_prefecture.rb +++ b/lib/color_me_shop/models/delivery_charge_by_prefecture.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class DeliveryChargeByPrefecture @@ -32,6 +33,11 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -41,23 +47,36 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::DeliveryChargeByPrefecture` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::DeliveryChargeByPrefecture`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'pref_id') + if attributes.key?(:'pref_id') self.pref_id = attributes[:'pref_id'] end - if attributes.has_key?(:'pref_name') + if attributes.key?(:'pref_name') self.pref_name = attributes[:'pref_name'] end - if attributes.has_key?(:'charge') + if attributes.key?(:'charge') self.charge = attributes[:'charge'] end end @@ -65,6 +84,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@pref_id.nil? && @pref_id > 48 invalid_properties.push('invalid value for "pref_id", must be smaller than or equal to 48.') @@ -80,6 +100,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@pref_id.nil? && @pref_id > 48 return false if !@pref_id.nil? && @pref_id < 1 true @@ -88,11 +109,15 @@ def valid? # Custom attribute writer method with validation # @param [Object] pref_id Value to be assigned def pref_id=(pref_id) - if !pref_id.nil? && pref_id > 48 + if pref_id.nil? + fail ArgumentError, 'pref_id cannot be nil' + end + + if pref_id > 48 fail ArgumentError, 'invalid value for "pref_id", must be smaller than or equal to 48.' end - if !pref_id.nil? && pref_id < 1 + if pref_id < 1 fail ArgumentError, 'invalid value for "pref_id", must be greater than or equal to 1.' end @@ -116,7 +141,7 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [pref_id, pref_name, charge].hash end @@ -124,31 +149,34 @@ def hash # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -157,7 +185,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -178,8 +206,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -201,7 +230,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -224,5 +257,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/delivery_date_setting.rb b/lib/color_me_shop/models/delivery_date_setting.rb index 8276d35..9b68cb0 100644 --- a/lib/color_me_shop/models/delivery_date_setting.rb +++ b/lib/color_me_shop/models/delivery_date_setting.rb @@ -1,26 +1,25 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class DeliveryDateSetting # ショップアカウントID attr_accessor :account_id - # 配送希望日の設定 attr_accessor :days - # 配送時間帯の設定 attr_accessor :times # 配送日時設定作成日時 @@ -40,42 +39,62 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { :'account_id' => :'String', - :'days' => :'Object', - :'times' => :'Object', + :'days' => :'GetDeliveryDateSetting200ResponseDeliveryDateDays', + :'times' => :'GetDeliveryDateSetting200ResponseDeliveryDateTimes', :'make_date' => :'Integer', :'update_date' => :'Integer' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'make_date', + :'update_date' + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::DeliveryDateSetting` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::DeliveryDateSetting`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'days') + if attributes.key?(:'days') self.days = attributes[:'days'] end - if attributes.has_key?(:'times') + if attributes.key?(:'times') self.times = attributes[:'times'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end end @@ -83,6 +102,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -90,6 +110,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' true end @@ -112,7 +133,7 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [account_id, days, times, make_date, update_date].hash end @@ -120,31 +141,34 @@ def hash # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -153,7 +177,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -174,8 +198,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -197,7 +222,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -220,5 +249,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/get_coupon200_response.rb b/lib/color_me_shop/models/get_coupon200_response.rb new file mode 100644 index 0000000..f18661a --- /dev/null +++ b/lib/color_me_shop/models/get_coupon200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetCoupon200Response + attr_accessor :shop_coupon + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'shop_coupon' => :'shop_coupon' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'shop_coupon' => :'GetCoupons200ResponseShopCouponsInner' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetCoupon200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetCoupon200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'shop_coupon') + self.shop_coupon = attributes[:'shop_coupon'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + shop_coupon == o.shop_coupon + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [shop_coupon].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_coupons200_response.rb b/lib/color_me_shop/models/get_coupons200_response.rb new file mode 100644 index 0000000..eab6a1d --- /dev/null +++ b/lib/color_me_shop/models/get_coupons200_response.rb @@ -0,0 +1,216 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetCoupons200Response + attr_accessor :shop_coupons + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'shop_coupons' => :'shop_coupons' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'shop_coupons' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetCoupons200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetCoupons200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'shop_coupons') + if (value = attributes[:'shop_coupons']).is_a?(Array) + self.shop_coupons = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + shop_coupons == o.shop_coupons + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [shop_coupons].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_coupons200_response_shop_coupons_inner.rb b/lib/color_me_shop/models/get_coupons200_response_shop_coupons_inner.rb new file mode 100644 index 0000000..7507050 --- /dev/null +++ b/lib/color_me_shop/models/get_coupons200_response_shop_coupons_inner.rb @@ -0,0 +1,415 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetCoupons200ResponseShopCouponsInner + # Coupon ID + attr_accessor :id + + # クーポン名 + attr_accessor :name + + # クーポンコード + attr_accessor :code + + # クーポン種別 - `amount`: 定額 - `rate`: 定率 - `delivery_charge`: 送料無料 + attr_accessor :coupon_type + + # 割引金額または割引率 + attr_accessor :discount_amount + + # 利用最低額 + attr_accessor :minimum_amount + + # 利用開始日 + attr_accessor :starts_at + + # 利用終了日 + attr_accessor :ends_at + + # 総利用可能数 + attr_accessor :total_usage_limit + + # ユーザ毎の利用可能数 - `indisposable`: 無制限 - `disposable`: 一度のみ + attr_accessor :usage_limit + + # 商品グループによる制限 - `none`: 無制限 - `including`: 含む - `excluding`: 除外 + attr_accessor :group_limit_type + + # クーポンの利用可否 - `unavailable`: 利用不可 - `available`: 利用可能 + attr_accessor :status + + # 作成日時 + attr_accessor :created_at + + # 更新日時 + attr_accessor :updated_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'code' => :'code', + :'coupon_type' => :'coupon_type', + :'discount_amount' => :'discount_amount', + :'minimum_amount' => :'minimum_amount', + :'starts_at' => :'starts_at', + :'ends_at' => :'ends_at', + :'total_usage_limit' => :'total_usage_limit', + :'usage_limit' => :'usage_limit', + :'group_limit_type' => :'group_limit_type', + :'status' => :'status', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'name' => :'String', + :'code' => :'String', + :'coupon_type' => :'String', + :'discount_amount' => :'Integer', + :'minimum_amount' => :'Integer', + :'starts_at' => :'Integer', + :'ends_at' => :'Integer', + :'total_usage_limit' => :'Integer', + :'usage_limit' => :'String', + :'group_limit_type' => :'String', + :'status' => :'String', + :'created_at' => :'Integer', + :'updated_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetCoupons200ResponseShopCouponsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetCoupons200ResponseShopCouponsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'coupon_type') + self.coupon_type = attributes[:'coupon_type'] + end + + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + + if attributes.key?(:'minimum_amount') + self.minimum_amount = attributes[:'minimum_amount'] + end + + if attributes.key?(:'starts_at') + self.starts_at = attributes[:'starts_at'] + end + + if attributes.key?(:'ends_at') + self.ends_at = attributes[:'ends_at'] + end + + if attributes.key?(:'total_usage_limit') + self.total_usage_limit = attributes[:'total_usage_limit'] + end + + if attributes.key?(:'usage_limit') + self.usage_limit = attributes[:'usage_limit'] + end + + if attributes.key?(:'group_limit_type') + self.group_limit_type = attributes[:'group_limit_type'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + coupon_type_validator = EnumAttributeValidator.new('String', ["amount", "rate", "delivery_charge"]) + return false unless coupon_type_validator.valid?(@coupon_type) + usage_limit_validator = EnumAttributeValidator.new('String', ["indisposable", "disposable"]) + return false unless usage_limit_validator.valid?(@usage_limit) + group_limit_type_validator = EnumAttributeValidator.new('String', ["none", "including", "excluding"]) + return false unless group_limit_type_validator.valid?(@group_limit_type) + status_validator = EnumAttributeValidator.new('String', ["unavailable", "available"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] coupon_type Object to be assigned + def coupon_type=(coupon_type) + validator = EnumAttributeValidator.new('String', ["amount", "rate", "delivery_charge"]) + unless validator.valid?(coupon_type) + fail ArgumentError, "invalid value for \"coupon_type\", must be one of #{validator.allowable_values}." + end + @coupon_type = coupon_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] usage_limit Object to be assigned + def usage_limit=(usage_limit) + validator = EnumAttributeValidator.new('String', ["indisposable", "disposable"]) + unless validator.valid?(usage_limit) + fail ArgumentError, "invalid value for \"usage_limit\", must be one of #{validator.allowable_values}." + end + @usage_limit = usage_limit + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] group_limit_type Object to be assigned + def group_limit_type=(group_limit_type) + validator = EnumAttributeValidator.new('String', ["none", "including", "excluding"]) + unless validator.valid?(group_limit_type) + fail ArgumentError, "invalid value for \"group_limit_type\", must be one of #{validator.allowable_values}." + end + @group_limit_type = group_limit_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["unavailable", "available"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + code == o.code && + coupon_type == o.coupon_type && + discount_amount == o.discount_amount && + minimum_amount == o.minimum_amount && + starts_at == o.starts_at && + ends_at == o.ends_at && + total_usage_limit == o.total_usage_limit && + usage_limit == o.usage_limit && + group_limit_type == o.group_limit_type && + status == o.status && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, code, coupon_type, discount_amount, minimum_amount, starts_at, ends_at, total_usage_limit, usage_limit, group_limit_type, status, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_customer200_response.rb b/lib/color_me_shop/models/get_customer200_response.rb new file mode 100644 index 0000000..81132d1 --- /dev/null +++ b/lib/color_me_shop/models/get_customer200_response.rb @@ -0,0 +1,223 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetCustomer200Response + attr_accessor :customer + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer' => :'customer', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'customer' => :'GetSales200ResponseSalesInnerCustomer', + :'meta' => :'GetCustomer200ResponseMeta' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetCustomer200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetCustomer200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + customer == o.customer && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [customer, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_customer200_response_meta.rb b/lib/color_me_shop/models/get_customer200_response_meta.rb new file mode 100644 index 0000000..2531d80 --- /dev/null +++ b/lib/color_me_shop/models/get_customer200_response_meta.rb @@ -0,0 +1,232 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetCustomer200ResponseMeta + attr_accessor :total + + attr_accessor :limit + + attr_accessor :offset + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total' => :'total', + :'limit' => :'limit', + :'offset' => :'offset' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total' => :'Integer', + :'limit' => :'Integer', + :'offset' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetCustomer200ResponseMeta` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetCustomer200ResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + end + + if attributes.key?(:'offset') + self.offset = attributes[:'offset'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total == o.total && + limit == o.limit && + offset == o.offset + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total, limit, offset].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_customers200_response.rb b/lib/color_me_shop/models/get_customers200_response.rb new file mode 100644 index 0000000..abe7bce --- /dev/null +++ b/lib/color_me_shop/models/get_customers200_response.rb @@ -0,0 +1,225 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetCustomers200Response + attr_accessor :customers + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customers' => :'customers', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'customers' => :'Array', + :'meta' => :'GetSales200ResponseMeta' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetCustomers200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetCustomers200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'customers') + if (value = attributes[:'customers']).is_a?(Array) + self.customers = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + customers == o.customers && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [customers, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_deliveries200_response.rb b/lib/color_me_shop/models/get_deliveries200_response.rb new file mode 100644 index 0000000..2984136 --- /dev/null +++ b/lib/color_me_shop/models/get_deliveries200_response.rb @@ -0,0 +1,216 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetDeliveries200Response + attr_accessor :deliveries + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'deliveries' => :'deliveries' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'deliveries' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetDeliveries200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetDeliveries200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'deliveries') + if (value = attributes[:'deliveries']).is_a?(Array) + self.deliveries = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + deliveries == o.deliveries + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [deliveries].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner.rb b/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner.rb new file mode 100644 index 0000000..4399891 --- /dev/null +++ b/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner.rb @@ -0,0 +1,492 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetDeliveries200ResponseDeliveriesInner + # 配送方法ID + attr_accessor :id + + # ショップアカウントID + attr_accessor :account_id + + # 配送方法名 + attr_accessor :name + + # 配送方法区分 - `other`: そのほか - `yamato`: クロネコヤマト - `yamato_pickup`: ヤマト自宅外受け取り - `sagawa`: 佐川急便 - `jp`: 日本郵便 + attr_accessor :method_type + + # 配送方法画像URL + attr_accessor :image_url + + # 配送料が無料になる基準 - `not_free`: 有料 - `free`: 無料 - `free_to_limit`: 注文金額が一定以上の場合は無料 + attr_accessor :charge_free_type + + # 配送料が無料になる金額。`charge_free_type`が`free_to_limit`の場合のみ意味を持つ + attr_accessor :charge_free_limit + + # 配送料の計算方法 - `fixed`: 固定額 - `by_price`: 注文金額によって決定 - `by_area`: 配送先都道府県によって決定 - `by_weight`: 商品重量によって決定 + attr_accessor :charge_type + + attr_accessor :charge + + # 送料が税込み料金であるか否か + attr_accessor :tax_included + + # 配送伝票番号設定を使用するか否か + attr_accessor :slip_number_use + + # 配送伝票番号確認URL + attr_accessor :slip_number_url + + # 配送方法の説明 + attr_accessor :memo + + # フィーチャーフォン向けショップ用の配送方法説明 + attr_accessor :memo2 + + # 表示順 + attr_accessor :sort + + # 表示状態 + attr_accessor :display_state + + # 配送希望日を指定可能か + attr_accessor :preferred_date_use + + # 配送時間帯を指定可能か + attr_accessor :preferred_period_use + + # 利用不可決済方法の配列 + attr_accessor :unavailable_payment_ids + + # 配送方法作成日時 + attr_accessor :make_date + + # 配送方法更新日時 + attr_accessor :update_date + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'account_id', + :'name' => :'name', + :'method_type' => :'method_type', + :'image_url' => :'image_url', + :'charge_free_type' => :'charge_free_type', + :'charge_free_limit' => :'charge_free_limit', + :'charge_type' => :'charge_type', + :'charge' => :'charge', + :'tax_included' => :'tax_included', + :'slip_number_use' => :'slip_number_use', + :'slip_number_url' => :'slip_number_url', + :'memo' => :'memo', + :'memo2' => :'memo2', + :'sort' => :'sort', + :'display_state' => :'display_state', + :'preferred_date_use' => :'preferred_date_use', + :'preferred_period_use' => :'preferred_period_use', + :'unavailable_payment_ids' => :'unavailable_payment_ids', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'account_id' => :'String', + :'name' => :'String', + :'method_type' => :'String', + :'image_url' => :'String', + :'charge_free_type' => :'String', + :'charge_free_limit' => :'Integer', + :'charge_type' => :'String', + :'charge' => :'GetDeliveries200ResponseDeliveriesInnerCharge', + :'tax_included' => :'Boolean', + :'slip_number_use' => :'Boolean', + :'slip_number_url' => :'String', + :'memo' => :'String', + :'memo2' => :'String', + :'sort' => :'Integer', + :'display_state' => :'String', + :'preferred_date_use' => :'Boolean', + :'preferred_period_use' => :'Boolean', + :'unavailable_payment_ids' => :'Array', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'charge_free_limit', + :'slip_number_url', + :'memo', + :'memo2', + :'sort', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetDeliveries200ResponseDeliveriesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetDeliveries200ResponseDeliveriesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'method_type') + self.method_type = attributes[:'method_type'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'charge_free_type') + self.charge_free_type = attributes[:'charge_free_type'] + end + + if attributes.key?(:'charge_free_limit') + self.charge_free_limit = attributes[:'charge_free_limit'] + end + + if attributes.key?(:'charge_type') + self.charge_type = attributes[:'charge_type'] + end + + if attributes.key?(:'charge') + self.charge = attributes[:'charge'] + end + + if attributes.key?(:'tax_included') + self.tax_included = attributes[:'tax_included'] + end + + if attributes.key?(:'slip_number_use') + self.slip_number_use = attributes[:'slip_number_use'] + end + + if attributes.key?(:'slip_number_url') + self.slip_number_url = attributes[:'slip_number_url'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'memo2') + self.memo2 = attributes[:'memo2'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'preferred_date_use') + self.preferred_date_use = attributes[:'preferred_date_use'] + end + + if attributes.key?(:'preferred_period_use') + self.preferred_period_use = attributes[:'preferred_period_use'] + end + + if attributes.key?(:'unavailable_payment_ids') + if (value = attributes[:'unavailable_payment_ids']).is_a?(Array) + self.unavailable_payment_ids = value + end + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + method_type_validator = EnumAttributeValidator.new('String', ["other", "yamato", "yamato_pickup", "sagawa", "jp"]) + return false unless method_type_validator.valid?(@method_type) + charge_free_type_validator = EnumAttributeValidator.new('String', ["not_free", "free", "free_to_limit"]) + return false unless charge_free_type_validator.valid?(@charge_free_type) + charge_type_validator = EnumAttributeValidator.new('String', ["fixed", "by_price", "by_area", "by_weight"]) + return false unless charge_type_validator.valid?(@charge_type) + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden"]) + return false unless display_state_validator.valid?(@display_state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] method_type Object to be assigned + def method_type=(method_type) + validator = EnumAttributeValidator.new('String', ["other", "yamato", "yamato_pickup", "sagawa", "jp"]) + unless validator.valid?(method_type) + fail ArgumentError, "invalid value for \"method_type\", must be one of #{validator.allowable_values}." + end + @method_type = method_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] charge_free_type Object to be assigned + def charge_free_type=(charge_free_type) + validator = EnumAttributeValidator.new('String', ["not_free", "free", "free_to_limit"]) + unless validator.valid?(charge_free_type) + fail ArgumentError, "invalid value for \"charge_free_type\", must be one of #{validator.allowable_values}." + end + @charge_free_type = charge_free_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] charge_type Object to be assigned + def charge_type=(charge_type) + validator = EnumAttributeValidator.new('String', ["fixed", "by_price", "by_area", "by_weight"]) + unless validator.valid?(charge_type) + fail ArgumentError, "invalid value for \"charge_type\", must be one of #{validator.allowable_values}." + end + @charge_type = charge_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + name == o.name && + method_type == o.method_type && + image_url == o.image_url && + charge_free_type == o.charge_free_type && + charge_free_limit == o.charge_free_limit && + charge_type == o.charge_type && + charge == o.charge && + tax_included == o.tax_included && + slip_number_use == o.slip_number_use && + slip_number_url == o.slip_number_url && + memo == o.memo && + memo2 == o.memo2 && + sort == o.sort && + display_state == o.display_state && + preferred_date_use == o.preferred_date_use && + preferred_period_use == o.preferred_period_use && + unavailable_payment_ids == o.unavailable_payment_ids && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, account_id, name, method_type, image_url, charge_free_type, charge_free_limit, charge_type, charge, tax_included, slip_number_use, slip_number_url, memo, memo2, sort, display_state, preferred_date_use, preferred_period_use, unavailable_payment_ids, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge.rb b/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge.rb new file mode 100644 index 0000000..8afc880 --- /dev/null +++ b/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge.rb @@ -0,0 +1,296 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + # 配送料設定の詳細。上記の`charge_free_type`や`charge_type`に基づいて、この中から配送料が決定される + class GetDeliveries200ResponseDeliveriesInnerCharge + # 配送方法ID + attr_accessor :delivery_id + + # ショップアカウントID + attr_accessor :account_id + + # 配送料が固定の場合の金額 + attr_accessor :charge_fixed + + # 配送料が変わる決済金額の区分 `[3000, 100]`であれば、3000円以下の場合、手数料は100円であることを表す + attr_accessor :charge_ranges_by_price + + # `charge_ranges_by_price`に設定されている区分以上の金額の場合の手数料 + attr_accessor :charge_max_price + + # 都道府県ごとの配送料 + attr_accessor :charge_ranges_by_area + + # 配送料が変わる重量の区分 以下の値の場合、 - 1000g未満の商品を青森県に届ける際の配送料は300円 - 3000g未満の商品を青森県に届ける際の配送料は500円 であることを表す。 ```json [ [ 1000, [ { \"pref_id\": 2, \"pref_name\": \"青森県\", \"charge\": 300 } ] ], [ 3000, [ { \"pref_id\": 2, \"pref_name\": \"青森県\", \"charge\": 500 } ] ] ] ``` + attr_accessor :charge_ranges_by_weight + + # `charge_ranges_by_weight`に設定されている区分以上の重量の場合の手数料 + attr_accessor :charge_ranges_max_weight + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'delivery_id' => :'delivery_id', + :'account_id' => :'account_id', + :'charge_fixed' => :'charge_fixed', + :'charge_ranges_by_price' => :'charge_ranges_by_price', + :'charge_max_price' => :'charge_max_price', + :'charge_ranges_by_area' => :'charge_ranges_by_area', + :'charge_ranges_by_weight' => :'charge_ranges_by_weight', + :'charge_ranges_max_weight' => :'charge_ranges_max_weight' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'delivery_id' => :'Integer', + :'account_id' => :'String', + :'charge_fixed' => :'Integer', + :'charge_ranges_by_price' => :'Array>', + :'charge_max_price' => :'Integer', + :'charge_ranges_by_area' => :'Array', + :'charge_ranges_by_weight' => :'Array>', + :'charge_ranges_max_weight' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'charge_fixed', + :'charge_max_price', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'delivery_id') + self.delivery_id = attributes[:'delivery_id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'charge_fixed') + self.charge_fixed = attributes[:'charge_fixed'] + end + + if attributes.key?(:'charge_ranges_by_price') + if (value = attributes[:'charge_ranges_by_price']).is_a?(Array) + self.charge_ranges_by_price = value + end + end + + if attributes.key?(:'charge_max_price') + self.charge_max_price = attributes[:'charge_max_price'] + end + + if attributes.key?(:'charge_ranges_by_area') + if (value = attributes[:'charge_ranges_by_area']).is_a?(Array) + self.charge_ranges_by_area = value + end + end + + if attributes.key?(:'charge_ranges_by_weight') + if (value = attributes[:'charge_ranges_by_weight']).is_a?(Array) + self.charge_ranges_by_weight = value + end + end + + if attributes.key?(:'charge_ranges_max_weight') + if (value = attributes[:'charge_ranges_max_weight']).is_a?(Array) + self.charge_ranges_max_weight = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + delivery_id == o.delivery_id && + account_id == o.account_id && + charge_fixed == o.charge_fixed && + charge_ranges_by_price == o.charge_ranges_by_price && + charge_max_price == o.charge_max_price && + charge_ranges_by_area == o.charge_ranges_by_area && + charge_ranges_by_weight == o.charge_ranges_by_weight && + charge_ranges_max_weight == o.charge_ranges_max_weight + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [delivery_id, account_id, charge_fixed, charge_ranges_by_price, charge_max_price, charge_ranges_by_area, charge_ranges_by_weight, charge_ranges_max_weight].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner.rb b/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner.rb new file mode 100644 index 0000000..c826120 --- /dev/null +++ b/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner.rb @@ -0,0 +1,263 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner + # 都道府県の通し番号。北海道が1、沖縄が47、海外が48 + attr_accessor :pref_id + + # 都道府県名 + attr_accessor :pref_name + + # 配送料 + attr_accessor :charge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pref_id' => :'pref_id', + :'pref_name' => :'pref_name', + :'charge' => :'charge' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'pref_id' => :'Integer', + :'pref_name' => :'String', + :'charge' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pref_id') + self.pref_id = attributes[:'pref_id'] + end + + if attributes.key?(:'pref_name') + self.pref_name = attributes[:'pref_name'] + end + + if attributes.key?(:'charge') + self.charge = attributes[:'charge'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@pref_id.nil? && @pref_id > 48 + invalid_properties.push('invalid value for "pref_id", must be smaller than or equal to 48.') + end + + if !@pref_id.nil? && @pref_id < 1 + invalid_properties.push('invalid value for "pref_id", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@pref_id.nil? && @pref_id > 48 + return false if !@pref_id.nil? && @pref_id < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] pref_id Value to be assigned + def pref_id=(pref_id) + if pref_id.nil? + fail ArgumentError, 'pref_id cannot be nil' + end + + if pref_id > 48 + fail ArgumentError, 'invalid value for "pref_id", must be smaller than or equal to 48.' + end + + if pref_id < 1 + fail ArgumentError, 'invalid value for "pref_id", must be greater than or equal to 1.' + end + + @pref_id = pref_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pref_id == o.pref_id && + pref_name == o.pref_name && + charge == o.charge + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pref_id, pref_name, charge].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner.rb b/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner.rb new file mode 100644 index 0000000..7ac2636 --- /dev/null +++ b/lib/color_me_shop/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner.rb @@ -0,0 +1,105 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + module GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner', + :'Integer' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = ColorMeShop.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/color_me_shop/models/get_delivery_date_setting200_response.rb b/lib/color_me_shop/models/get_delivery_date_setting200_response.rb new file mode 100644 index 0000000..05c2788 --- /dev/null +++ b/lib/color_me_shop/models/get_delivery_date_setting200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetDeliveryDateSetting200Response + attr_accessor :delivery_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'delivery_date' => :'delivery_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'delivery_date' => :'GetDeliveryDateSetting200ResponseDeliveryDate' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetDeliveryDateSetting200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetDeliveryDateSetting200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'delivery_date') + self.delivery_date = attributes[:'delivery_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + delivery_date == o.delivery_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [delivery_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date.rb b/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date.rb new file mode 100644 index 0000000..2edcaf8 --- /dev/null +++ b/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date.rb @@ -0,0 +1,255 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetDeliveryDateSetting200ResponseDeliveryDate + # ショップアカウントID + attr_accessor :account_id + + attr_accessor :days + + attr_accessor :times + + # 配送日時設定作成日時 + attr_accessor :make_date + + # 配送日時設定更新日時 + attr_accessor :update_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id', + :'days' => :'days', + :'times' => :'times', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'days' => :'GetDeliveryDateSetting200ResponseDeliveryDateDays', + :'times' => :'GetDeliveryDateSetting200ResponseDeliveryDateTimes', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'make_date', + :'update_date' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'days') + self.days = attributes[:'days'] + end + + if attributes.key?(:'times') + self.times = attributes[:'times'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + days == o.days && + times == o.times && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_id, days, times, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date_days.rb b/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date_days.rb new file mode 100644 index 0000000..557d0e8 --- /dev/null +++ b/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date_days.rb @@ -0,0 +1,259 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + # 配送希望日の設定 + class GetDeliveryDateSetting200ResponseDeliveryDateDays + # 配送希望日選択が有効であるか + attr_accessor :enabled + + # デフォルトで選択される希望日。注文日からn日後の数値 + attr_accessor :default + + # 選択できる最も早い配送日。注文日からn日後の数値 + attr_accessor :min + + # 選択できる最も遅い配送日。注文日からn日後の数値 + attr_accessor :max + + # 配送希望日に関する注意事項 + attr_accessor :comment + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'default' => :'default', + :'min' => :'min', + :'max' => :'max', + :'comment' => :'comment' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'default' => :'Integer', + :'min' => :'Integer', + :'max' => :'Integer', + :'comment' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'enabled', + :'default', + :'comment' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'default') + self.default = attributes[:'default'] + end + + if attributes.key?(:'min') + self.min = attributes[:'min'] + end + + if attributes.key?(:'max') + self.max = attributes[:'max'] + end + + if attributes.key?(:'comment') + self.comment = attributes[:'comment'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + default == o.default && + min == o.min && + max == o.max && + comment == o.comment + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, default, min, max, comment].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date_times.rb b/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date_times.rb new file mode 100644 index 0000000..096a624 --- /dev/null +++ b/lib/color_me_shop/models/get_delivery_date_setting200_response_delivery_date_times.rb @@ -0,0 +1,240 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + # 配送時間帯の設定 + class GetDeliveryDateSetting200ResponseDeliveryDateTimes + # 配送時間帯選択が有効であるか + attr_accessor :enabled + + # 配送時間帯の選択肢の配列 + attr_accessor :periods + + # 配送時間帯に関する注意事項 + attr_accessor :comment + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'periods' => :'periods', + :'comment' => :'comment' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'periods' => :'Array', + :'comment' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'enabled', + :'comment' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'periods') + if (value = attributes[:'periods']).is_a?(Array) + self.periods = value + end + end + + if attributes.key?(:'comment') + self.comment = attributes[:'comment'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + periods == o.periods && + comment == o.comment + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, periods, comment].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_gift200_response.rb b/lib/color_me_shop/models/get_gift200_response.rb new file mode 100644 index 0000000..3a64aba --- /dev/null +++ b/lib/color_me_shop/models/get_gift200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetGift200Response + attr_accessor :gift + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'gift' => :'gift' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'gift' => :'GetGift200ResponseGift' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetGift200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetGift200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'gift') + self.gift = attributes[:'gift'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + gift == o.gift + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [gift].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_gift200_response_gift.rb b/lib/color_me_shop/models/get_gift200_response_gift.rb new file mode 100644 index 0000000..dac4ad8 --- /dev/null +++ b/lib/color_me_shop/models/get_gift200_response_gift.rb @@ -0,0 +1,271 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetGift200ResponseGift + attr_accessor :account_id + + attr_accessor :enabled + + attr_accessor :noshi + + attr_accessor :card + + attr_accessor :wrapping + + attr_accessor :make_date + + attr_accessor :update_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id', + :'enabled' => :'enabled', + :'noshi' => :'noshi', + :'card' => :'card', + :'wrapping' => :'wrapping', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'enabled' => :'Boolean', + :'noshi' => :'GetGift200ResponseGiftNoshi', + :'card' => :'GetGift200ResponseGiftCard', + :'wrapping' => :'GetGift200ResponseGiftWrapping', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'enabled', + :'make_date', + :'update_date' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetGift200ResponseGift` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetGift200ResponseGift`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'noshi') + self.noshi = attributes[:'noshi'] + end + + if attributes.key?(:'card') + self.card = attributes[:'card'] + end + + if attributes.key?(:'wrapping') + self.wrapping = attributes[:'wrapping'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + enabled == o.enabled && + noshi == o.noshi && + card == o.card && + wrapping == o.wrapping && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_id, enabled, noshi, card, wrapping, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_gift200_response_gift_card.rb b/lib/color_me_shop/models/get_gift200_response_gift_card.rb new file mode 100644 index 0000000..77047ad --- /dev/null +++ b/lib/color_me_shop/models/get_gift200_response_gift_card.rb @@ -0,0 +1,246 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetGift200ResponseGiftCard + attr_accessor :enabled + + attr_accessor :text_enabled + + attr_accessor :types + + attr_accessor :comment + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'text_enabled' => :'text_enabled', + :'types' => :'types', + :'comment' => :'comment' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'text_enabled' => :'Boolean', + :'types' => :'Array', + :'comment' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'enabled', + :'text_enabled', + :'comment' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetGift200ResponseGiftCard` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetGift200ResponseGiftCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'text_enabled') + self.text_enabled = attributes[:'text_enabled'] + end + + if attributes.key?(:'types') + if (value = attributes[:'types']).is_a?(Array) + self.types = value + end + end + + if attributes.key?(:'comment') + self.comment = attributes[:'comment'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + text_enabled == o.text_enabled && + types == o.types && + comment == o.comment + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, text_enabled, types, comment].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_gift200_response_gift_card_types_inner.rb b/lib/color_me_shop/models/get_gift200_response_gift_card_types_inner.rb new file mode 100644 index 0000000..267329b --- /dev/null +++ b/lib/color_me_shop/models/get_gift200_response_gift_card_types_inner.rb @@ -0,0 +1,223 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetGift200ResponseGiftCardTypesInner + attr_accessor :name + + attr_accessor :charge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'charge' => :'charge' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'charge' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetGift200ResponseGiftCardTypesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetGift200ResponseGiftCardTypesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'charge') + self.charge = attributes[:'charge'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + charge == o.charge + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, charge].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_gift200_response_gift_noshi.rb b/lib/color_me_shop/models/get_gift200_response_gift_noshi.rb new file mode 100644 index 0000000..88332d1 --- /dev/null +++ b/lib/color_me_shop/models/get_gift200_response_gift_noshi.rb @@ -0,0 +1,256 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetGift200ResponseGiftNoshi + attr_accessor :enabled + + attr_accessor :text_enabled + + attr_accessor :text_charge + + attr_accessor :types + + attr_accessor :comment + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'text_enabled' => :'text_enabled', + :'text_charge' => :'text_charge', + :'types' => :'types', + :'comment' => :'comment' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'text_enabled' => :'Boolean', + :'text_charge' => :'Integer', + :'types' => :'Array', + :'comment' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'enabled', + :'text_enabled', + :'text_charge', + :'comment' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetGift200ResponseGiftNoshi` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetGift200ResponseGiftNoshi`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'text_enabled') + self.text_enabled = attributes[:'text_enabled'] + end + + if attributes.key?(:'text_charge') + self.text_charge = attributes[:'text_charge'] + end + + if attributes.key?(:'types') + if (value = attributes[:'types']).is_a?(Array) + self.types = value + end + end + + if attributes.key?(:'comment') + self.comment = attributes[:'comment'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + text_enabled == o.text_enabled && + text_charge == o.text_charge && + types == o.types && + comment == o.comment + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, text_enabled, text_charge, types, comment].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_gift200_response_gift_noshi_types_inner.rb b/lib/color_me_shop/models/get_gift200_response_gift_noshi_types_inner.rb new file mode 100644 index 0000000..877e7e6 --- /dev/null +++ b/lib/color_me_shop/models/get_gift200_response_gift_noshi_types_inner.rb @@ -0,0 +1,223 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetGift200ResponseGiftNoshiTypesInner + attr_accessor :name + + attr_accessor :charge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'charge' => :'charge' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'charge' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetGift200ResponseGiftNoshiTypesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetGift200ResponseGiftNoshiTypesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'charge') + self.charge = attributes[:'charge'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + charge == o.charge + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, charge].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_gift200_response_gift_wrapping.rb b/lib/color_me_shop/models/get_gift200_response_gift_wrapping.rb new file mode 100644 index 0000000..15c91e1 --- /dev/null +++ b/lib/color_me_shop/models/get_gift200_response_gift_wrapping.rb @@ -0,0 +1,236 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetGift200ResponseGiftWrapping + attr_accessor :enabled + + attr_accessor :types + + attr_accessor :comment + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enabled' => :'enabled', + :'types' => :'types', + :'comment' => :'comment' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'enabled' => :'Boolean', + :'types' => :'Array', + :'comment' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'enabled', + :'comment' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetGift200ResponseGiftWrapping` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetGift200ResponseGiftWrapping`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'types') + if (value = attributes[:'types']).is_a?(Array) + self.types = value + end + end + + if attributes.key?(:'comment') + self.comment = attributes[:'comment'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enabled == o.enabled && + types == o.types && + comment == o.comment + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enabled, types, comment].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_gift200_response_gift_wrapping_types_inner.rb b/lib/color_me_shop/models/get_gift200_response_gift_wrapping_types_inner.rb new file mode 100644 index 0000000..8e3d4e7 --- /dev/null +++ b/lib/color_me_shop/models/get_gift200_response_gift_wrapping_types_inner.rb @@ -0,0 +1,223 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetGift200ResponseGiftWrappingTypesInner + attr_accessor :name + + attr_accessor :charge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'charge' => :'charge' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'charge' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetGift200ResponseGiftWrappingTypesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetGift200ResponseGiftWrappingTypesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'charge') + self.charge = attributes[:'charge'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + charge == o.charge + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, charge].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_payments200_response.rb b/lib/color_me_shop/models/get_payments200_response.rb new file mode 100644 index 0000000..c6ac423 --- /dev/null +++ b/lib/color_me_shop/models/get_payments200_response.rb @@ -0,0 +1,216 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetPayments200Response + attr_accessor :payments + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'payments' => :'payments' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'payments' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetPayments200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetPayments200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'payments') + if (value = attributes[:'payments']).is_a?(Array) + self.payments = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + payments == o.payments + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [payments].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_payments200_response_payments_inner.rb b/lib/color_me_shop/models/get_payments200_response_payments_inner.rb new file mode 100644 index 0000000..a3cb047 --- /dev/null +++ b/lib/color_me_shop/models/get_payments200_response_payments_inner.rb @@ -0,0 +1,408 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetPayments200ResponsePaymentsInner + # 決済方法ID + attr_accessor :id + + # ショップアカウントID + attr_accessor :account_id + + # 決済名 + attr_accessor :name + + # 決済手数料 + attr_accessor :fee + + # GMOイプシロン等との契約コード + attr_accessor :ip_code + + # 説明 + attr_accessor :memo + + # 説明 + attr_accessor :order_end_note + + # フィーチャーフォン向けショップ用の説明 + attr_accessor :memo_mobile + + # 表示順 + attr_accessor :sort + + # 決済画像URL + attr_accessor :image_url + + # 決済タイプを表す数値。 |type|決済| |---|---| |0|代引き| |1|銀行振込| |2|郵便振替| |3|クレジット(ZEUS)| |4|クロネコ@ペイメント| |5|NP後払い| |6|クレジット(イプシロン)| |7|コンビニ決済(イプシロン)| |8|カラーミークレジット| |9|その他決済| |10|ウェブマネー| |11|イーバンクデビット| |12|ネット銀行(イプシロン)| |13|電子マネー(イプシロン)| |14|ATM・コンビニ・ネット銀行決済(ペイジェント)| |15|Do-Link決済(イプシロン)| |16|ペイジー(イプシロン)| |17|後払い.com| |18|ジャパンネット銀行(送料無料キャンペーン)| |19|クロネコwebコレクト| |20|PayPal(イプシロン)| |21|Yahoo!ウォレット(イプシロン)| |22|全額ポイント利用| |23|スマートフォンキャリア決済(イプシロン)| |24|GMO PG マルチペイメントクレジットカード| |25|住信SBIネット銀行(イプシロン)| |26|GMO後払い(イプシロン)| |27|GMO後払い(GMOペイメントサービス)| |28| - | |29|ATM(ペイジー)(ペイジェント)| |30|カード(ペイジェント)| |31|コンビニ番号方式(ペイジェント)| |32|インターネットバンキング(ペイジェント)| |33|PayPal(ペイパル)| |34|SMBC GMO PAYMENTクレジットカード| |35|Amazon Pay(イプシロン)| |36|楽天ペイ(オンライン決済)| |37|銀行振込(バーチャル口座)(イプシロン)| |38|Amazon Pay(アマゾンペイ)| |39|クレジットカード(SGシステム)| |40|LINE Pay(イプシロン)| |41|PayPal Commerce Platform(ペイパル)| |42|PayPay(イプシロン)| |43|Amazon Pay V2(アマゾンペイ)| |44|Amazon Pay V2(イプシロン)| |45|Square対面決済| + attr_accessor :type + + # 表示設定。`true`なら表示される + attr_accessor :display + + # フィーチャーフォン向けショップでの表示設定 + attr_accessor :use_mobile + + # 決済作成日時 + attr_accessor :make_date + + # 決済更新日時 + attr_accessor :update_date + + attr_accessor :cod + + attr_accessor :card + + attr_accessor :financial + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'account_id', + :'name' => :'name', + :'fee' => :'fee', + :'ip_code' => :'ip_code', + :'memo' => :'memo', + :'order_end_note' => :'order_end_note', + :'memo_mobile' => :'memo_mobile', + :'sort' => :'sort', + :'image_url' => :'image_url', + :'type' => :'type', + :'display' => :'display', + :'use_mobile' => :'use_mobile', + :'make_date' => :'make_date', + :'update_date' => :'update_date', + :'cod' => :'cod', + :'card' => :'card', + :'financial' => :'financial' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'account_id' => :'String', + :'name' => :'String', + :'fee' => :'Integer', + :'ip_code' => :'String', + :'memo' => :'String', + :'order_end_note' => :'String', + :'memo_mobile' => :'String', + :'sort' => :'Integer', + :'image_url' => :'String', + :'type' => :'Integer', + :'display' => :'Boolean', + :'use_mobile' => :'Boolean', + :'make_date' => :'Integer', + :'update_date' => :'Integer', + :'cod' => :'GetPayments200ResponsePaymentsInnerCod', + :'card' => :'GetPayments200ResponsePaymentsInnerCard', + :'financial' => :'GetPayments200ResponsePaymentsInnerFinancial' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'fee', + :'ip_code', + :'memo', + :'order_end_note', + :'memo_mobile', + :'sort', + :'image_url', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetPayments200ResponsePaymentsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetPayments200ResponsePaymentsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'fee') + self.fee = attributes[:'fee'] + end + + if attributes.key?(:'ip_code') + self.ip_code = attributes[:'ip_code'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'order_end_note') + self.order_end_note = attributes[:'order_end_note'] + end + + if attributes.key?(:'memo_mobile') + self.memo_mobile = attributes[:'memo_mobile'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'display') + self.display = attributes[:'display'] + end + + if attributes.key?(:'use_mobile') + self.use_mobile = attributes[:'use_mobile'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + + if attributes.key?(:'cod') + self.cod = attributes[:'cod'] + end + + if attributes.key?(:'card') + self.card = attributes[:'card'] + end + + if attributes.key?(:'financial') + self.financial = attributes[:'financial'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@type.nil? && @type < 0 + invalid_properties.push('invalid value for "type", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@type.nil? && @type < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] type Value to be assigned + def type=(type) + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + if type < 0 + fail ArgumentError, 'invalid value for "type", must be greater than or equal to 0.' + end + + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + name == o.name && + fee == o.fee && + ip_code == o.ip_code && + memo == o.memo && + order_end_note == o.order_end_note && + memo_mobile == o.memo_mobile && + sort == o.sort && + image_url == o.image_url && + type == o.type && + display == o.display && + use_mobile == o.use_mobile && + make_date == o.make_date && + update_date == o.update_date && + cod == o.cod && + card == o.card && + financial == o.financial + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, account_id, name, fee, ip_code, memo, order_end_note, memo_mobile, sort, image_url, type, display, use_mobile, make_date, update_date, cod, card, financial].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_payments200_response_payments_inner_card.rb b/lib/color_me_shop/models/get_payments200_response_payments_inner_card.rb new file mode 100644 index 0000000..f3a37ca --- /dev/null +++ b/lib/color_me_shop/models/get_payments200_response_payments_inner_card.rb @@ -0,0 +1,217 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + # クレジットカードの設定情報。クレジットカード決済の場合のみ存在する + class GetPayments200ResponsePaymentsInnerCard + attr_accessor :brands + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'brands' => :'brands' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'brands' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetPayments200ResponsePaymentsInnerCard` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetPayments200ResponsePaymentsInnerCard`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'brands') + if (value = attributes[:'brands']).is_a?(Array) + self.brands = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + brands == o.brands + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [brands].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_payments200_response_payments_inner_card_brands_inner.rb b/lib/color_me_shop/models/get_payments200_response_payments_inner_card_brands_inner.rb new file mode 100644 index 0000000..703d394 --- /dev/null +++ b/lib/color_me_shop/models/get_payments200_response_payments_inner_card_brands_inner.rb @@ -0,0 +1,225 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetPayments200ResponsePaymentsInnerCardBrandsInner + # ブランドID + attr_accessor :id + + # ブランド名 + attr_accessor :name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_payments200_response_payments_inner_cod.rb b/lib/color_me_shop/models/get_payments200_response_payments_inner_cod.rb new file mode 100644 index 0000000..31b6882 --- /dev/null +++ b/lib/color_me_shop/models/get_payments200_response_payments_inner_cod.rb @@ -0,0 +1,248 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + # 代引き決済の設定情報。代引き決済の場合のみ存在する + class GetPayments200ResponsePaymentsInnerCod + # 手数料が決済金額によって変わるか否か + attr_accessor :changeable + + # 手数料が変わる決済金額の区分 `[3000, 100]`であれば、3000円以下の場合、手数料は100円であることを表す + attr_accessor :fees + + # `fees`に設定されている区分以上の金額の場合の手数料 + attr_accessor :fee_max + + # 手数料計算に用いる決済総額を用いるか否か - `true`: 決済総額で計算 - `false`: 商品合計額で計算 + attr_accessor :changeable_by_total + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'changeable' => :'changeable', + :'fees' => :'fees', + :'fee_max' => :'fee_max', + :'changeable_by_total' => :'changeable_by_total' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'changeable' => :'Boolean', + :'fees' => :'Array>', + :'fee_max' => :'Integer', + :'changeable_by_total' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetPayments200ResponsePaymentsInnerCod` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetPayments200ResponsePaymentsInnerCod`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'changeable') + self.changeable = attributes[:'changeable'] + end + + if attributes.key?(:'fees') + if (value = attributes[:'fees']).is_a?(Array) + self.fees = value + end + end + + if attributes.key?(:'fee_max') + self.fee_max = attributes[:'fee_max'] + end + + if attributes.key?(:'changeable_by_total') + self.changeable_by_total = attributes[:'changeable_by_total'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + changeable == o.changeable && + fees == o.fees && + fee_max == o.fee_max && + changeable_by_total == o.changeable_by_total + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [changeable, fees, fee_max, changeable_by_total].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_payments200_response_payments_inner_financial.rb b/lib/color_me_shop/models/get_payments200_response_payments_inner_financial.rb new file mode 100644 index 0000000..ce4d7f7 --- /dev/null +++ b/lib/color_me_shop/models/get_payments200_response_payments_inner_financial.rb @@ -0,0 +1,290 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + # 銀行振り込みの設定情報。銀行振り込み決済の場合のみ存在する + class GetPayments200ResponsePaymentsInnerFinancial + # 金融機関名 + attr_accessor :name + + # 支店名 + attr_accessor :branch_name + + # 講座種別 - `saving`: 普通 - `checking`: 当座 + attr_accessor :kouza_type + + # 口座番号 + attr_accessor :kouza_number + + # 口座名義 + attr_accessor :kouza_name + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'branch_name' => :'branch_name', + :'kouza_type' => :'kouza_type', + :'kouza_number' => :'kouza_number', + :'kouza_name' => :'kouza_name' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'branch_name' => :'String', + :'kouza_type' => :'String', + :'kouza_number' => :'String', + :'kouza_name' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'branch_name') + self.branch_name = attributes[:'branch_name'] + end + + if attributes.key?(:'kouza_type') + self.kouza_type = attributes[:'kouza_type'] + end + + if attributes.key?(:'kouza_number') + self.kouza_number = attributes[:'kouza_number'] + end + + if attributes.key?(:'kouza_name') + self.kouza_name = attributes[:'kouza_name'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + kouza_type_validator = EnumAttributeValidator.new('String', ["saving", "checking"]) + return false unless kouza_type_validator.valid?(@kouza_type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kouza_type Object to be assigned + def kouza_type=(kouza_type) + validator = EnumAttributeValidator.new('String', ["saving", "checking"]) + unless validator.valid?(kouza_type) + fail ArgumentError, "invalid value for \"kouza_type\", must be one of #{validator.allowable_values}." + end + @kouza_type = kouza_type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + branch_name == o.branch_name && + kouza_type == o.kouza_type && + kouza_number == o.kouza_number && + kouza_name == o.kouza_name + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, branch_name, kouza_type, kouza_number, kouza_name].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_product_categories200_response.rb b/lib/color_me_shop/models/get_product_categories200_response.rb new file mode 100644 index 0000000..1ade79d --- /dev/null +++ b/lib/color_me_shop/models/get_product_categories200_response.rb @@ -0,0 +1,217 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProductCategories200Response + # 商品カテゴリー情報一覧 + attr_accessor :categories + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'categories' => :'categories' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'categories' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProductCategories200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProductCategories200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'categories') + if (value = attributes[:'categories']).is_a?(Array) + self.categories = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + categories == o.categories + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [categories].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_product_categories200_response_categories_inner.rb b/lib/color_me_shop/models/get_product_categories200_response_categories_inner.rb new file mode 100644 index 0000000..5ea4463 --- /dev/null +++ b/lib/color_me_shop/models/get_product_categories200_response_categories_inner.rb @@ -0,0 +1,354 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProductCategories200ResponseCategoriesInner + # 大カテゴリーID + attr_accessor :id_big + + # 小カテゴリーID。大カテゴリーのことを表している場合は0 + attr_accessor :id_small + + # ショップアカウントID + attr_accessor :account_id + + # 商品カテゴリー名 + attr_accessor :name + + # 商品カテゴリー画像URL + attr_accessor :image_url + + # 商品カテゴリー説明 + attr_accessor :expl + + # 表示順 + attr_accessor :sort + + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `members_only`: 会員にのみ掲載 + attr_accessor :display_state + + # 商品カテゴリー作成日時 + attr_accessor :make_date + + # 商品カテゴリー更新日時 + attr_accessor :update_date + + # 子カテゴリー + attr_accessor :children + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id_big' => :'id_big', + :'id_small' => :'id_small', + :'account_id' => :'account_id', + :'name' => :'name', + :'image_url' => :'image_url', + :'expl' => :'expl', + :'sort' => :'sort', + :'display_state' => :'display_state', + :'make_date' => :'make_date', + :'update_date' => :'update_date', + :'children' => :'children' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id_big' => :'Integer', + :'id_small' => :'Integer', + :'account_id' => :'String', + :'name' => :'String', + :'image_url' => :'String', + :'expl' => :'String', + :'sort' => :'Integer', + :'display_state' => :'String', + :'make_date' => :'Integer', + :'update_date' => :'Integer', + :'children' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'expl', + :'sort', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProductCategories200ResponseCategoriesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProductCategories200ResponseCategoriesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id_big') + self.id_big = attributes[:'id_big'] + end + + if attributes.key?(:'id_small') + self.id_small = attributes[:'id_small'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'expl') + self.expl = attributes[:'expl'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + + if attributes.key?(:'children') + if (value = attributes[:'children']).is_a?(Array) + self.children = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + return false unless display_state_validator.valid?(@display_state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id_big == o.id_big && + id_small == o.id_small && + account_id == o.account_id && + name == o.name && + image_url == o.image_url && + expl == o.expl && + sort == o.sort && + display_state == o.display_state && + make_date == o.make_date && + update_date == o.update_date && + children == o.children + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id_big, id_small, account_id, name, image_url, expl, sort, display_state, make_date, update_date, children].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_product_categories200_response_categories_inner_children_inner.rb b/lib/color_me_shop/models/get_product_categories200_response_categories_inner_children_inner.rb new file mode 100644 index 0000000..af2e06d --- /dev/null +++ b/lib/color_me_shop/models/get_product_categories200_response_categories_inner_children_inner.rb @@ -0,0 +1,342 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProductCategories200ResponseCategoriesInnerChildrenInner + # 大カテゴリーID + attr_accessor :id_big + + # 小カテゴリーID。大カテゴリーのことを表している場合は0 + attr_accessor :id_small + + # ショップアカウントID + attr_accessor :account_id + + # 商品カテゴリー名 + attr_accessor :name + + # 商品カテゴリー画像URL + attr_accessor :image_url + + # 商品カテゴリー説明 + attr_accessor :expl + + # 表示順 + attr_accessor :sort + + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `members_only`: 会員にのみ掲載 + attr_accessor :display_state + + # 商品カテゴリー作成日時 + attr_accessor :make_date + + # 商品カテゴリー更新日時 + attr_accessor :update_date + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id_big' => :'id_big', + :'id_small' => :'id_small', + :'account_id' => :'account_id', + :'name' => :'name', + :'image_url' => :'image_url', + :'expl' => :'expl', + :'sort' => :'sort', + :'display_state' => :'display_state', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id_big' => :'Integer', + :'id_small' => :'Integer', + :'account_id' => :'String', + :'name' => :'String', + :'image_url' => :'String', + :'expl' => :'String', + :'sort' => :'Integer', + :'display_state' => :'String', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'expl', + :'sort', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id_big') + self.id_big = attributes[:'id_big'] + end + + if attributes.key?(:'id_small') + self.id_small = attributes[:'id_small'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'expl') + self.expl = attributes[:'expl'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + return false unless display_state_validator.valid?(@display_state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id_big == o.id_big && + id_small == o.id_small && + account_id == o.account_id && + name == o.name && + image_url == o.image_url && + expl == o.expl && + sort == o.sort && + display_state == o.display_state && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id_big, id_small, account_id, name, image_url, expl, sort, display_state, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_product_groups200_response.rb b/lib/color_me_shop/models/get_product_groups200_response.rb new file mode 100644 index 0000000..46c4793 --- /dev/null +++ b/lib/color_me_shop/models/get_product_groups200_response.rb @@ -0,0 +1,217 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProductGroups200Response + # グループ情報一覧 + attr_accessor :groups + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'groups' => :'groups' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'groups' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProductGroups200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProductGroups200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'groups') + if (value = attributes[:'groups']).is_a?(Array) + self.groups = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + groups == o.groups + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [groups].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_product_groups200_response_groups_inner.rb b/lib/color_me_shop/models/get_product_groups200_response_groups_inner.rb new file mode 100644 index 0000000..c661cd3 --- /dev/null +++ b/lib/color_me_shop/models/get_product_groups200_response_groups_inner.rb @@ -0,0 +1,322 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProductGroups200ResponseGroupsInner + # 商品グループID + attr_accessor :id + + # ショップアカウントID + attr_accessor :account_id + + # 商品グループ名 + attr_accessor :name + + # 商品グループ画像URL + attr_accessor :image_url + + # 商品グループ説明 + attr_accessor :expl + + # 表示順 + attr_accessor :sort + + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + attr_accessor :display_state + + # 親の商品グループID + attr_accessor :parent_group_id + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'account_id', + :'name' => :'name', + :'image_url' => :'image_url', + :'expl' => :'expl', + :'sort' => :'sort', + :'display_state' => :'display_state', + :'parent_group_id' => :'parent_group_id' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'account_id' => :'String', + :'name' => :'String', + :'image_url' => :'String', + :'expl' => :'String', + :'sort' => :'Integer', + :'display_state' => :'String', + :'parent_group_id' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'expl', + :'sort', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProductGroups200ResponseGroupsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProductGroups200ResponseGroupsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'expl') + self.expl = attributes[:'expl'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'parent_group_id') + self.parent_group_id = attributes[:'parent_group_id'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + return false unless display_state_validator.valid?(@display_state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + name == o.name && + image_url == o.image_url && + expl == o.expl && + sort == o.sort && + display_state == o.display_state && + parent_group_id == o.parent_group_id + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, account_id, name, image_url, expl, sort, display_state, parent_group_id].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_product_variants200_response.rb b/lib/color_me_shop/models/get_product_variants200_response.rb new file mode 100644 index 0000000..2f5dd4c --- /dev/null +++ b/lib/color_me_shop/models/get_product_variants200_response.rb @@ -0,0 +1,225 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProductVariants200Response + attr_accessor :variants + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'variants' => :'variants', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'variants' => :'Array', + :'meta' => :'GetSales200ResponseMeta' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProductVariants200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProductVariants200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'variants') + if (value = attributes[:'variants']).is_a?(Array) + self.variants = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + variants == o.variants && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [variants, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_products200_response.rb b/lib/color_me_shop/models/get_products200_response.rb new file mode 100644 index 0000000..ed72c92 --- /dev/null +++ b/lib/color_me_shop/models/get_products200_response.rb @@ -0,0 +1,225 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProducts200Response + attr_accessor :products + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'products' => :'products', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'products' => :'Array', + :'meta' => :'GetSales200ResponseMeta' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProducts200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProducts200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'products') + if (value = attributes[:'products']).is_a?(Array) + self.products = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + products == o.products && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [products, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_products200_response_products_inner.rb b/lib/color_me_shop/models/get_products200_response_products_inner.rb new file mode 100644 index 0000000..0abe8c5 --- /dev/null +++ b/lib/color_me_shop/models/get_products200_response_products_inner.rb @@ -0,0 +1,795 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProducts200ResponseProductsInner + # ショップアカウントID + attr_accessor :account_id + + # 商品ID + attr_accessor :id + + # 商品名 + attr_accessor :name + + # 在庫数 + attr_accessor :stocks + + # 在庫管理するか否か + attr_accessor :stock_managed + + # 残りわずかとなる在庫数 + attr_accessor :few_num + + # 型番 + attr_accessor :model_number + + attr_accessor :category + + # 商品が属するグループのIDの配列 + attr_accessor :group_ids + + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + attr_accessor :display_state + + # 販売価格 + attr_accessor :sales_price + + # 消費税込販売価格 + attr_accessor :sales_price_including_tax + + # 消費税額 + attr_accessor :sales_price_tax + + # 定価 + attr_accessor :price + + # 会員価格 + attr_accessor :members_price + + # 消費税込会員価格 + attr_accessor :members_price_including_tax + + # 会員価格の消費税額 + attr_accessor :members_price_tax + + # 原価 + attr_accessor :cost + + # 個別送料 + attr_accessor :delivery_charge + + # クール便の追加料金 + attr_accessor :cool_charge + + # 利用不可決済方法の配列 + attr_accessor :unavailable_payment_ids + + # 利用不可配送方法の配列 + attr_accessor :unavailable_delivery_ids + + # 最小購入数量 + attr_accessor :min_num + + # 最大購入数量 + attr_accessor :max_num + + # 掲載開始時刻 + attr_accessor :sale_start_date + + # 掲載終了時刻 + attr_accessor :sale_end_date + + # 単位 + attr_accessor :unit + + # 重量(グラム単位) + attr_accessor :weight + + # 売り切れているときもショップに表示するか + attr_accessor :soldout_display + + # 表示順 + attr_accessor :sort + + # 簡易説明 + attr_accessor :simple_expl + + # 商品説明 + attr_accessor :expl + + # フィーチャーフォン向けショップの商品説明 + attr_accessor :mobile_expl + + # スマホ向けショップの商品説明 + attr_accessor :smartphone_expl + + # 商品作成日時 + attr_accessor :make_date + + # 商品更新日時 + attr_accessor :update_date + + # 備考 + attr_accessor :memo + + # メインの商品画像URL + attr_accessor :image_url + + # メインの商品画像のモバイル用URL + attr_accessor :mobile_image_url + + # メインの商品画像のサムネイルURL + attr_accessor :thumbnail_image_url + + # メインの商品画像以外の3つの画像に関する、PC用とモバイル用の画像URL + attr_accessor :images + + # 選択できるオプションの一覧 + attr_accessor :options + + # オプションのバリエーション一覧 + attr_accessor :variants + + # おすすめ商品情報 ※おすすめ商品種別が「3: 新着商品」の情報は、「[新着商品管理](https://shop-pro.jp/manual/new_item_lst)」が「手動モード」の場合のみ取得できます。 + attr_accessor :pickups + + # デジタルコンテンツ商品かどうか + attr_accessor :digital_conent + + # 定期購入商品かどうか + attr_accessor :regular_purchase + + # 軽減税率対象なら `true` + attr_accessor :tax_reduced + + # 配送不要商品なら `true` + attr_accessor :without_shipping + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id', + :'id' => :'id', + :'name' => :'name', + :'stocks' => :'stocks', + :'stock_managed' => :'stock_managed', + :'few_num' => :'few_num', + :'model_number' => :'model_number', + :'category' => :'category', + :'group_ids' => :'group_ids', + :'display_state' => :'display_state', + :'sales_price' => :'sales_price', + :'sales_price_including_tax' => :'sales_price_including_tax', + :'sales_price_tax' => :'sales_price_tax', + :'price' => :'price', + :'members_price' => :'members_price', + :'members_price_including_tax' => :'members_price_including_tax', + :'members_price_tax' => :'members_price_tax', + :'cost' => :'cost', + :'delivery_charge' => :'delivery_charge', + :'cool_charge' => :'cool_charge', + :'unavailable_payment_ids' => :'unavailable_payment_ids', + :'unavailable_delivery_ids' => :'unavailable_delivery_ids', + :'min_num' => :'min_num', + :'max_num' => :'max_num', + :'sale_start_date' => :'sale_start_date', + :'sale_end_date' => :'sale_end_date', + :'unit' => :'unit', + :'weight' => :'weight', + :'soldout_display' => :'soldout_display', + :'sort' => :'sort', + :'simple_expl' => :'simple_expl', + :'expl' => :'expl', + :'mobile_expl' => :'mobile_expl', + :'smartphone_expl' => :'smartphone_expl', + :'make_date' => :'make_date', + :'update_date' => :'update_date', + :'memo' => :'memo', + :'image_url' => :'image_url', + :'mobile_image_url' => :'mobile_image_url', + :'thumbnail_image_url' => :'thumbnail_image_url', + :'images' => :'images', + :'options' => :'options', + :'variants' => :'variants', + :'pickups' => :'pickups', + :'digital_conent' => :'digital_conent', + :'regular_purchase' => :'regular_purchase', + :'tax_reduced' => :'tax_reduced', + :'without_shipping' => :'without_shipping' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'id' => :'Integer', + :'name' => :'String', + :'stocks' => :'Integer', + :'stock_managed' => :'Boolean', + :'few_num' => :'Integer', + :'model_number' => :'String', + :'category' => :'GetProducts200ResponseProductsInnerCategory', + :'group_ids' => :'Array', + :'display_state' => :'String', + :'sales_price' => :'Integer', + :'sales_price_including_tax' => :'Integer', + :'sales_price_tax' => :'Integer', + :'price' => :'Integer', + :'members_price' => :'Integer', + :'members_price_including_tax' => :'Integer', + :'members_price_tax' => :'Integer', + :'cost' => :'Integer', + :'delivery_charge' => :'Integer', + :'cool_charge' => :'Integer', + :'unavailable_payment_ids' => :'Array', + :'unavailable_delivery_ids' => :'Array', + :'min_num' => :'Integer', + :'max_num' => :'Integer', + :'sale_start_date' => :'Integer', + :'sale_end_date' => :'Integer', + :'unit' => :'String', + :'weight' => :'Integer', + :'soldout_display' => :'Boolean', + :'sort' => :'Integer', + :'simple_expl' => :'String', + :'expl' => :'String', + :'mobile_expl' => :'String', + :'smartphone_expl' => :'String', + :'make_date' => :'Integer', + :'update_date' => :'Integer', + :'memo' => :'String', + :'image_url' => :'String', + :'mobile_image_url' => :'String', + :'thumbnail_image_url' => :'String', + :'images' => :'Array', + :'options' => :'Array', + :'variants' => :'Array', + :'pickups' => :'Array', + :'digital_conent' => :'Boolean', + :'regular_purchase' => :'Boolean', + :'tax_reduced' => :'Boolean', + :'without_shipping' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'stocks', + :'few_num', + :'model_number', + :'category', + :'sales_price', + :'price', + :'members_price', + :'cost', + :'delivery_charge', + :'cool_charge', + :'min_num', + :'max_num', + :'sale_start_date', + :'sale_end_date', + :'unit', + :'weight', + :'sort', + :'simple_expl', + :'expl', + :'mobile_expl', + :'smartphone_expl', + :'memo', + :'image_url', + :'mobile_image_url', + :'thumbnail_image_url', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProducts200ResponseProductsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProducts200ResponseProductsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'stocks') + self.stocks = attributes[:'stocks'] + end + + if attributes.key?(:'stock_managed') + self.stock_managed = attributes[:'stock_managed'] + end + + if attributes.key?(:'few_num') + self.few_num = attributes[:'few_num'] + end + + if attributes.key?(:'model_number') + self.model_number = attributes[:'model_number'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'group_ids') + if (value = attributes[:'group_ids']).is_a?(Array) + self.group_ids = value + end + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'sales_price') + self.sales_price = attributes[:'sales_price'] + end + + if attributes.key?(:'sales_price_including_tax') + self.sales_price_including_tax = attributes[:'sales_price_including_tax'] + end + + if attributes.key?(:'sales_price_tax') + self.sales_price_tax = attributes[:'sales_price_tax'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'members_price') + self.members_price = attributes[:'members_price'] + end + + if attributes.key?(:'members_price_including_tax') + self.members_price_including_tax = attributes[:'members_price_including_tax'] + end + + if attributes.key?(:'members_price_tax') + self.members_price_tax = attributes[:'members_price_tax'] + end + + if attributes.key?(:'cost') + self.cost = attributes[:'cost'] + end + + if attributes.key?(:'delivery_charge') + self.delivery_charge = attributes[:'delivery_charge'] + end + + if attributes.key?(:'cool_charge') + self.cool_charge = attributes[:'cool_charge'] + end + + if attributes.key?(:'unavailable_payment_ids') + if (value = attributes[:'unavailable_payment_ids']).is_a?(Array) + self.unavailable_payment_ids = value + end + end + + if attributes.key?(:'unavailable_delivery_ids') + if (value = attributes[:'unavailable_delivery_ids']).is_a?(Array) + self.unavailable_delivery_ids = value + end + end + + if attributes.key?(:'min_num') + self.min_num = attributes[:'min_num'] + end + + if attributes.key?(:'max_num') + self.max_num = attributes[:'max_num'] + end + + if attributes.key?(:'sale_start_date') + self.sale_start_date = attributes[:'sale_start_date'] + end + + if attributes.key?(:'sale_end_date') + self.sale_end_date = attributes[:'sale_end_date'] + end + + if attributes.key?(:'unit') + self.unit = attributes[:'unit'] + end + + if attributes.key?(:'weight') + self.weight = attributes[:'weight'] + end + + if attributes.key?(:'soldout_display') + self.soldout_display = attributes[:'soldout_display'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'simple_expl') + self.simple_expl = attributes[:'simple_expl'] + end + + if attributes.key?(:'expl') + self.expl = attributes[:'expl'] + end + + if attributes.key?(:'mobile_expl') + self.mobile_expl = attributes[:'mobile_expl'] + end + + if attributes.key?(:'smartphone_expl') + self.smartphone_expl = attributes[:'smartphone_expl'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'mobile_image_url') + self.mobile_image_url = attributes[:'mobile_image_url'] + end + + if attributes.key?(:'thumbnail_image_url') + self.thumbnail_image_url = attributes[:'thumbnail_image_url'] + end + + if attributes.key?(:'images') + if (value = attributes[:'images']).is_a?(Array) + self.images = value + end + end + + if attributes.key?(:'options') + if (value = attributes[:'options']).is_a?(Array) + self.options = value + end + end + + if attributes.key?(:'variants') + if (value = attributes[:'variants']).is_a?(Array) + self.variants = value + end + end + + if attributes.key?(:'pickups') + if (value = attributes[:'pickups']).is_a?(Array) + self.pickups = value + end + end + + if attributes.key?(:'digital_conent') + self.digital_conent = attributes[:'digital_conent'] + end + + if attributes.key?(:'regular_purchase') + self.regular_purchase = attributes[:'regular_purchase'] + end + + if attributes.key?(:'tax_reduced') + self.tax_reduced = attributes[:'tax_reduced'] + end + + if attributes.key?(:'without_shipping') + self.without_shipping = attributes[:'without_shipping'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@group_ids.nil? && @group_ids.length < 0 + invalid_properties.push('invalid value for "group_ids", number of items must be greater than or equal to 0.') + end + + if !@images.nil? && @images.length > 6 + invalid_properties.push('invalid value for "images", number of items must be less than or equal to 6.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@group_ids.nil? && @group_ids.length < 0 + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + return false unless display_state_validator.valid?(@display_state) + return false if !@images.nil? && @images.length > 6 + true + end + + # Custom attribute writer method with validation + # @param [Object] group_ids Value to be assigned + def group_ids=(group_ids) + if group_ids.nil? + fail ArgumentError, 'group_ids cannot be nil' + end + + if group_ids.length < 0 + fail ArgumentError, 'invalid value for "group_ids", number of items must be greater than or equal to 0.' + end + + @group_ids = group_ids + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Custom attribute writer method with validation + # @param [Object] images Value to be assigned + def images=(images) + if images.nil? + fail ArgumentError, 'images cannot be nil' + end + + if images.length > 6 + fail ArgumentError, 'invalid value for "images", number of items must be less than or equal to 6.' + end + + @images = images + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + id == o.id && + name == o.name && + stocks == o.stocks && + stock_managed == o.stock_managed && + few_num == o.few_num && + model_number == o.model_number && + category == o.category && + group_ids == o.group_ids && + display_state == o.display_state && + sales_price == o.sales_price && + sales_price_including_tax == o.sales_price_including_tax && + sales_price_tax == o.sales_price_tax && + price == o.price && + members_price == o.members_price && + members_price_including_tax == o.members_price_including_tax && + members_price_tax == o.members_price_tax && + cost == o.cost && + delivery_charge == o.delivery_charge && + cool_charge == o.cool_charge && + unavailable_payment_ids == o.unavailable_payment_ids && + unavailable_delivery_ids == o.unavailable_delivery_ids && + min_num == o.min_num && + max_num == o.max_num && + sale_start_date == o.sale_start_date && + sale_end_date == o.sale_end_date && + unit == o.unit && + weight == o.weight && + soldout_display == o.soldout_display && + sort == o.sort && + simple_expl == o.simple_expl && + expl == o.expl && + mobile_expl == o.mobile_expl && + smartphone_expl == o.smartphone_expl && + make_date == o.make_date && + update_date == o.update_date && + memo == o.memo && + image_url == o.image_url && + mobile_image_url == o.mobile_image_url && + thumbnail_image_url == o.thumbnail_image_url && + images == o.images && + options == o.options && + variants == o.variants && + pickups == o.pickups && + digital_conent == o.digital_conent && + regular_purchase == o.regular_purchase && + tax_reduced == o.tax_reduced && + without_shipping == o.without_shipping + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_id, id, name, stocks, stock_managed, few_num, model_number, category, group_ids, display_state, sales_price, sales_price_including_tax, sales_price_tax, price, members_price, members_price_including_tax, members_price_tax, cost, delivery_charge, cool_charge, unavailable_payment_ids, unavailable_delivery_ids, min_num, max_num, sale_start_date, sale_end_date, unit, weight, soldout_display, sort, simple_expl, expl, mobile_expl, smartphone_expl, make_date, update_date, memo, image_url, mobile_image_url, thumbnail_image_url, images, options, variants, pickups, digital_conent, regular_purchase, tax_reduced, without_shipping].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_products200_response_products_inner_category.rb b/lib/color_me_shop/models/get_products200_response_products_inner_category.rb new file mode 100644 index 0000000..48d2f19 --- /dev/null +++ b/lib/color_me_shop/models/get_products200_response_products_inner_category.rb @@ -0,0 +1,225 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProducts200ResponseProductsInnerCategory + # 大カテゴリーID + attr_accessor :id_big + + # 小カテゴリーID + attr_accessor :id_small + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id_big' => :'id_big', + :'id_small' => :'id_small' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id_big' => :'Integer', + :'id_small' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProducts200ResponseProductsInnerCategory` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProducts200ResponseProductsInnerCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id_big') + self.id_big = attributes[:'id_big'] + end + + if attributes.key?(:'id_small') + self.id_small = attributes[:'id_small'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id_big == o.id_big && + id_small == o.id_small + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id_big, id_small].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_products200_response_products_inner_images_inner.rb b/lib/color_me_shop/models/get_products200_response_products_inner_images_inner.rb new file mode 100644 index 0000000..ee55ce3 --- /dev/null +++ b/lib/color_me_shop/models/get_products200_response_products_inner_images_inner.rb @@ -0,0 +1,263 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProducts200ResponseProductsInnerImagesInner + # 画像URL + attr_accessor :src + + # 表示順 + attr_accessor :position + + # モバイル用であるか否か + attr_accessor :mobile + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'src' => :'src', + :'position' => :'position', + :'mobile' => :'mobile' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'src' => :'String', + :'position' => :'Integer', + :'mobile' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProducts200ResponseProductsInnerImagesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProducts200ResponseProductsInnerImagesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'src') + self.src = attributes[:'src'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'mobile') + self.mobile = attributes[:'mobile'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@position.nil? && @position > 3 + invalid_properties.push('invalid value for "position", must be smaller than or equal to 3.') + end + + if !@position.nil? && @position < 1 + invalid_properties.push('invalid value for "position", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@position.nil? && @position > 3 + return false if !@position.nil? && @position < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] position Value to be assigned + def position=(position) + if position.nil? + fail ArgumentError, 'position cannot be nil' + end + + if position > 3 + fail ArgumentError, 'invalid value for "position", must be smaller than or equal to 3.' + end + + if position < 1 + fail ArgumentError, 'invalid value for "position", must be greater than or equal to 1.' + end + + @position = position + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + src == o.src && + position == o.position && + mobile == o.mobile + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [src, position, mobile].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_products200_response_products_inner_options_inner.rb b/lib/color_me_shop/models/get_products200_response_products_inner_options_inner.rb new file mode 100644 index 0000000..378fd9c --- /dev/null +++ b/lib/color_me_shop/models/get_products200_response_products_inner_options_inner.rb @@ -0,0 +1,277 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProducts200ResponseProductsInnerOptionsInner + # オプションID + attr_accessor :id + + # 商品ID + attr_accessor :product_id + + # ショップアカウントID + attr_accessor :account_id + + # オプション名 + attr_accessor :name + + # オプション値の配列 + attr_accessor :values + + # オプション作成日時 + attr_accessor :make_date + + # オプション更新日時 + attr_accessor :update_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'product_id' => :'product_id', + :'account_id' => :'account_id', + :'name' => :'name', + :'values' => :'values', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'product_id' => :'Integer', + :'account_id' => :'String', + :'name' => :'String', + :'values' => :'Array', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'values') + if (value = attributes[:'values']).is_a?(Array) + self.values = value + end + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + product_id == o.product_id && + account_id == o.account_id && + name == o.name && + values == o.values && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, product_id, account_id, name, values, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_products200_response_products_inner_pickups_inner.rb b/lib/color_me_shop/models/get_products200_response_products_inner_pickups_inner.rb new file mode 100644 index 0000000..7cf1d24 --- /dev/null +++ b/lib/color_me_shop/models/get_products200_response_products_inner_pickups_inner.rb @@ -0,0 +1,246 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProducts200ResponseProductsInnerPickupsInner + # おすすめ商品情報種別 + attr_accessor :pickup_type + + # 商品の表示順 + attr_accessor :order_num + + # 作成日時 + attr_accessor :make_date + + # 更新日時 + attr_accessor :update_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pickup_type' => :'pickup_type', + :'order_num' => :'order_num', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'pickup_type' => :'Integer', + :'order_num' => :'Integer', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order_num', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pickup_type') + self.pickup_type = attributes[:'pickup_type'] + end + + if attributes.key?(:'order_num') + self.order_num = attributes[:'order_num'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pickup_type == o.pickup_type && + order_num == o.order_num && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pickup_type, order_num, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_products200_response_products_inner_variants_inner.rb b/lib/color_me_shop/models/get_products200_response_products_inner_variants_inner.rb new file mode 100644 index 0000000..381a09e --- /dev/null +++ b/lib/color_me_shop/models/get_products200_response_products_inner_variants_inner.rb @@ -0,0 +1,372 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetProducts200ResponseProductsInnerVariantsInner + # 商品ID + attr_accessor :product_id + + # ショップアカウントID + attr_accessor :account_id + + # オプション1の値 + attr_accessor :option1_value + + # オプション2の値 + attr_accessor :option2_value + + # オプション1とオプション2の名前を\" x \"で結合した表示名。オプションが1つしか設定されていない場合はそのオプションの名前に等しい + attr_accessor :title + + # 在庫数 + attr_accessor :stocks + + # 残りわずかとなる在庫数 + attr_accessor :few_num + + # 型番 + attr_accessor :model_number + + # 販売価格 + attr_accessor :option_price + + # 消費税込販売価格 + attr_accessor :option_price_including_tax + + # 消費税額 + attr_accessor :option_price_tax + + # 会員価格 + attr_accessor :option_members_price + + # 消費税込会員価格 + attr_accessor :option_members_price_including_tax + + # 会員価格の消費税額 + attr_accessor :option_members_price_tax + + # オプション作成日時 + attr_accessor :make_date + + # オプション更新日時 + attr_accessor :update_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'product_id' => :'product_id', + :'account_id' => :'account_id', + :'option1_value' => :'option1_value', + :'option2_value' => :'option2_value', + :'title' => :'title', + :'stocks' => :'stocks', + :'few_num' => :'few_num', + :'model_number' => :'model_number', + :'option_price' => :'option_price', + :'option_price_including_tax' => :'option_price_including_tax', + :'option_price_tax' => :'option_price_tax', + :'option_members_price' => :'option_members_price', + :'option_members_price_including_tax' => :'option_members_price_including_tax', + :'option_members_price_tax' => :'option_members_price_tax', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'product_id' => :'Integer', + :'account_id' => :'String', + :'option1_value' => :'String', + :'option2_value' => :'String', + :'title' => :'String', + :'stocks' => :'Integer', + :'few_num' => :'Integer', + :'model_number' => :'String', + :'option_price' => :'Integer', + :'option_price_including_tax' => :'Integer', + :'option_price_tax' => :'Integer', + :'option_members_price' => :'Integer', + :'option_members_price_including_tax' => :'Integer', + :'option_members_price_tax' => :'Integer', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'option1_value', + :'option2_value', + :'stocks', + :'few_num', + :'model_number', + :'option_price', + :'option_members_price', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'option1_value') + self.option1_value = attributes[:'option1_value'] + end + + if attributes.key?(:'option2_value') + self.option2_value = attributes[:'option2_value'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'stocks') + self.stocks = attributes[:'stocks'] + end + + if attributes.key?(:'few_num') + self.few_num = attributes[:'few_num'] + end + + if attributes.key?(:'model_number') + self.model_number = attributes[:'model_number'] + end + + if attributes.key?(:'option_price') + self.option_price = attributes[:'option_price'] + end + + if attributes.key?(:'option_price_including_tax') + self.option_price_including_tax = attributes[:'option_price_including_tax'] + end + + if attributes.key?(:'option_price_tax') + self.option_price_tax = attributes[:'option_price_tax'] + end + + if attributes.key?(:'option_members_price') + self.option_members_price = attributes[:'option_members_price'] + end + + if attributes.key?(:'option_members_price_including_tax') + self.option_members_price_including_tax = attributes[:'option_members_price_including_tax'] + end + + if attributes.key?(:'option_members_price_tax') + self.option_members_price_tax = attributes[:'option_members_price_tax'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + product_id == o.product_id && + account_id == o.account_id && + option1_value == o.option1_value && + option2_value == o.option2_value && + title == o.title && + stocks == o.stocks && + few_num == o.few_num && + model_number == o.model_number && + option_price == o.option_price && + option_price_including_tax == o.option_price_including_tax && + option_price_tax == o.option_price_tax && + option_members_price == o.option_members_price && + option_members_price_including_tax == o.option_members_price_including_tax && + option_members_price_tax == o.option_members_price_tax && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [product_id, account_id, option1_value, option2_value, title, stocks, few_num, model_number, option_price, option_price_including_tax, option_price_tax, option_members_price, option_members_price_including_tax, option_members_price_tax, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sale200_response.rb b/lib/color_me_shop/models/get_sale200_response.rb new file mode 100644 index 0000000..e78a74c --- /dev/null +++ b/lib/color_me_shop/models/get_sale200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSale200Response + attr_accessor :sale + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sale' => :'sale' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sale' => :'GetSale200ResponseSale' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSale200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSale200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sale') + self.sale = attributes[:'sale'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sale == o.sale + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sale].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sale200_response_sale.rb b/lib/color_me_shop/models/get_sale200_response_sale.rb new file mode 100644 index 0000000..ce07f3c --- /dev/null +++ b/lib/color_me_shop/models/get_sale200_response_sale.rb @@ -0,0 +1,736 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSale200ResponseSale + # 売上ID + attr_accessor :id + + # ショップアカウントID + attr_accessor :account_id + + # 受注日時 + attr_accessor :make_date + + # 受注更新日時 + attr_accessor :update_date + + # 備考 + attr_accessor :memo + + # 使用された決済方法ID + attr_accessor :payment_id + + # モバイルからの注文であるか否か + attr_accessor :mobile + + # 入金済みであるか否か + attr_accessor :paid + + # 発送済みである否か + attr_accessor :delivered + + # キャンセル済みであるか否か + attr_accessor :canceled + + # 受注メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + attr_accessor :accepted_mail_state + + # 入金メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + attr_accessor :paid_mail_state + + # 発送メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + attr_accessor :delivered_mail_state + + # 受注メールの送信日時 + attr_accessor :accepted_mail_sent_date + + # 入金メールの送信日時 + attr_accessor :paid_mail_sent_date + + # 発送メールの送信日時 + attr_accessor :delivered_mail_sent_date + + # ショップポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み + attr_accessor :point_state + + # GMOポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み + attr_accessor :gmo_point_state + + # Yahooポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み + attr_accessor :yahoo_point_state + + # 商品の合計金額 + attr_accessor :product_total_price + + # 配送料 + attr_accessor :delivery_total_charge + + # 決済手数料 + attr_accessor :fee + + # 商品合計金額に対する消費税 + attr_accessor :tax + + # 熨斗料金 + attr_accessor :noshi_total_charge + + # メッセージカード料金 + attr_accessor :card_total_charge + + # ラッピング料金 + attr_accessor :wrapping_total_charge + + # ショップポイントによる割引額 + attr_accessor :point_discount + + # GMOポイントによる割引額 + attr_accessor :gmo_point_discount + + # その他、クーポン等による割引額 + attr_accessor :other_discount + + # その他割引の名称 + attr_accessor :other_discount_name + + # 注文総額 + attr_accessor :total_price + + # 付与されたショップポイント数 + attr_accessor :granted_points + + # 使用されたショップポイント数 + attr_accessor :use_points + + # 付与されたGMOポイント数 + attr_accessor :granted_gmo_points + + # 使用されたGMOポイント数 + attr_accessor :use_gmo_points + + # 付与されたYahooポイント数 + attr_accessor :granted_yahoo_points + + # 使用されたYahooポイント数 + attr_accessor :use_yahoo_points + + # 外部システムで発行された決済識別番号 該当受注の決済が、楽天ペイ(オンライン決済)、LINE Pay、PayPal Commerce Platform、Amazon Pay、Amazon Pay V2、Square対面決済のいずれかである場合、その決済の決済識別番号を返します。 それ以外の決済に関しては空文字列を返します。 + attr_accessor :external_order_id + + attr_accessor :customer + + attr_accessor :details + + attr_accessor :sale_deliveries + + attr_accessor :segment + + attr_accessor :totals + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'account_id', + :'make_date' => :'make_date', + :'update_date' => :'update_date', + :'memo' => :'memo', + :'payment_id' => :'payment_id', + :'mobile' => :'mobile', + :'paid' => :'paid', + :'delivered' => :'delivered', + :'canceled' => :'canceled', + :'accepted_mail_state' => :'accepted_mail_state', + :'paid_mail_state' => :'paid_mail_state', + :'delivered_mail_state' => :'delivered_mail_state', + :'accepted_mail_sent_date' => :'accepted_mail_sent_date', + :'paid_mail_sent_date' => :'paid_mail_sent_date', + :'delivered_mail_sent_date' => :'delivered_mail_sent_date', + :'point_state' => :'point_state', + :'gmo_point_state' => :'gmo_point_state', + :'yahoo_point_state' => :'yahoo_point_state', + :'product_total_price' => :'product_total_price', + :'delivery_total_charge' => :'delivery_total_charge', + :'fee' => :'fee', + :'tax' => :'tax', + :'noshi_total_charge' => :'noshi_total_charge', + :'card_total_charge' => :'card_total_charge', + :'wrapping_total_charge' => :'wrapping_total_charge', + :'point_discount' => :'point_discount', + :'gmo_point_discount' => :'gmo_point_discount', + :'other_discount' => :'other_discount', + :'other_discount_name' => :'other_discount_name', + :'total_price' => :'total_price', + :'granted_points' => :'granted_points', + :'use_points' => :'use_points', + :'granted_gmo_points' => :'granted_gmo_points', + :'use_gmo_points' => :'use_gmo_points', + :'granted_yahoo_points' => :'granted_yahoo_points', + :'use_yahoo_points' => :'use_yahoo_points', + :'external_order_id' => :'external_order_id', + :'customer' => :'customer', + :'details' => :'details', + :'sale_deliveries' => :'sale_deliveries', + :'segment' => :'segment', + :'totals' => :'totals' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'account_id' => :'String', + :'make_date' => :'Integer', + :'update_date' => :'Integer', + :'memo' => :'String', + :'payment_id' => :'Integer', + :'mobile' => :'Boolean', + :'paid' => :'Boolean', + :'delivered' => :'Boolean', + :'canceled' => :'Boolean', + :'accepted_mail_state' => :'String', + :'paid_mail_state' => :'String', + :'delivered_mail_state' => :'String', + :'accepted_mail_sent_date' => :'Integer', + :'paid_mail_sent_date' => :'Integer', + :'delivered_mail_sent_date' => :'Integer', + :'point_state' => :'String', + :'gmo_point_state' => :'String', + :'yahoo_point_state' => :'String', + :'product_total_price' => :'Integer', + :'delivery_total_charge' => :'Integer', + :'fee' => :'Integer', + :'tax' => :'Integer', + :'noshi_total_charge' => :'Integer', + :'card_total_charge' => :'Integer', + :'wrapping_total_charge' => :'Integer', + :'point_discount' => :'Integer', + :'gmo_point_discount' => :'Integer', + :'other_discount' => :'Integer', + :'other_discount_name' => :'String', + :'total_price' => :'Integer', + :'granted_points' => :'Integer', + :'use_points' => :'Integer', + :'granted_gmo_points' => :'Integer', + :'use_gmo_points' => :'Integer', + :'granted_yahoo_points' => :'Integer', + :'use_yahoo_points' => :'Integer', + :'external_order_id' => :'String', + :'customer' => :'GetSales200ResponseSalesInnerCustomer', + :'details' => :'Array', + :'sale_deliveries' => :'Array', + :'segment' => :'GetSale200ResponseSaleAllOfSegment', + :'totals' => :'GetSales200ResponseSalesInnerTotals' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'memo', + :'accepted_mail_sent_date', + :'paid_mail_sent_date', + :'delivered_mail_sent_date', + :'gmo_point_state', + :'yahoo_point_state', + :'segment', + :'totals' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSale200ResponseSale` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSale200ResponseSale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'payment_id') + self.payment_id = attributes[:'payment_id'] + end + + if attributes.key?(:'mobile') + self.mobile = attributes[:'mobile'] + end + + if attributes.key?(:'paid') + self.paid = attributes[:'paid'] + end + + if attributes.key?(:'delivered') + self.delivered = attributes[:'delivered'] + end + + if attributes.key?(:'canceled') + self.canceled = attributes[:'canceled'] + end + + if attributes.key?(:'accepted_mail_state') + self.accepted_mail_state = attributes[:'accepted_mail_state'] + end + + if attributes.key?(:'paid_mail_state') + self.paid_mail_state = attributes[:'paid_mail_state'] + end + + if attributes.key?(:'delivered_mail_state') + self.delivered_mail_state = attributes[:'delivered_mail_state'] + end + + if attributes.key?(:'accepted_mail_sent_date') + self.accepted_mail_sent_date = attributes[:'accepted_mail_sent_date'] + end + + if attributes.key?(:'paid_mail_sent_date') + self.paid_mail_sent_date = attributes[:'paid_mail_sent_date'] + end + + if attributes.key?(:'delivered_mail_sent_date') + self.delivered_mail_sent_date = attributes[:'delivered_mail_sent_date'] + end + + if attributes.key?(:'point_state') + self.point_state = attributes[:'point_state'] + end + + if attributes.key?(:'gmo_point_state') + self.gmo_point_state = attributes[:'gmo_point_state'] + end + + if attributes.key?(:'yahoo_point_state') + self.yahoo_point_state = attributes[:'yahoo_point_state'] + end + + if attributes.key?(:'product_total_price') + self.product_total_price = attributes[:'product_total_price'] + end + + if attributes.key?(:'delivery_total_charge') + self.delivery_total_charge = attributes[:'delivery_total_charge'] + end + + if attributes.key?(:'fee') + self.fee = attributes[:'fee'] + end + + if attributes.key?(:'tax') + self.tax = attributes[:'tax'] + end + + if attributes.key?(:'noshi_total_charge') + self.noshi_total_charge = attributes[:'noshi_total_charge'] + end + + if attributes.key?(:'card_total_charge') + self.card_total_charge = attributes[:'card_total_charge'] + end + + if attributes.key?(:'wrapping_total_charge') + self.wrapping_total_charge = attributes[:'wrapping_total_charge'] + end + + if attributes.key?(:'point_discount') + self.point_discount = attributes[:'point_discount'] + end + + if attributes.key?(:'gmo_point_discount') + self.gmo_point_discount = attributes[:'gmo_point_discount'] + end + + if attributes.key?(:'other_discount') + self.other_discount = attributes[:'other_discount'] + end + + if attributes.key?(:'other_discount_name') + self.other_discount_name = attributes[:'other_discount_name'] + end + + if attributes.key?(:'total_price') + self.total_price = attributes[:'total_price'] + end + + if attributes.key?(:'granted_points') + self.granted_points = attributes[:'granted_points'] + end + + if attributes.key?(:'use_points') + self.use_points = attributes[:'use_points'] + end + + if attributes.key?(:'granted_gmo_points') + self.granted_gmo_points = attributes[:'granted_gmo_points'] + end + + if attributes.key?(:'use_gmo_points') + self.use_gmo_points = attributes[:'use_gmo_points'] + end + + if attributes.key?(:'granted_yahoo_points') + self.granted_yahoo_points = attributes[:'granted_yahoo_points'] + end + + if attributes.key?(:'use_yahoo_points') + self.use_yahoo_points = attributes[:'use_yahoo_points'] + end + + if attributes.key?(:'external_order_id') + self.external_order_id = attributes[:'external_order_id'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'details') + if (value = attributes[:'details']).is_a?(Array) + self.details = value + end + end + + if attributes.key?(:'sale_deliveries') + if (value = attributes[:'sale_deliveries']).is_a?(Array) + self.sale_deliveries = value + end + end + + if attributes.key?(:'segment') + self.segment = attributes[:'segment'] + end + + if attributes.key?(:'totals') + self.totals = attributes[:'totals'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + accepted_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + return false unless accepted_mail_state_validator.valid?(@accepted_mail_state) + paid_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + return false unless paid_mail_state_validator.valid?(@paid_mail_state) + delivered_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + return false unless delivered_mail_state_validator.valid?(@delivered_mail_state) + point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + return false unless point_state_validator.valid?(@point_state) + gmo_point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + return false unless gmo_point_state_validator.valid?(@gmo_point_state) + yahoo_point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + return false unless yahoo_point_state_validator.valid?(@yahoo_point_state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] accepted_mail_state Object to be assigned + def accepted_mail_state=(accepted_mail_state) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + unless validator.valid?(accepted_mail_state) + fail ArgumentError, "invalid value for \"accepted_mail_state\", must be one of #{validator.allowable_values}." + end + @accepted_mail_state = accepted_mail_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] paid_mail_state Object to be assigned + def paid_mail_state=(paid_mail_state) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + unless validator.valid?(paid_mail_state) + fail ArgumentError, "invalid value for \"paid_mail_state\", must be one of #{validator.allowable_values}." + end + @paid_mail_state = paid_mail_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] delivered_mail_state Object to be assigned + def delivered_mail_state=(delivered_mail_state) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + unless validator.valid?(delivered_mail_state) + fail ArgumentError, "invalid value for \"delivered_mail_state\", must be one of #{validator.allowable_values}." + end + @delivered_mail_state = delivered_mail_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] point_state Object to be assigned + def point_state=(point_state) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + unless validator.valid?(point_state) + fail ArgumentError, "invalid value for \"point_state\", must be one of #{validator.allowable_values}." + end + @point_state = point_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gmo_point_state Object to be assigned + def gmo_point_state=(gmo_point_state) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + unless validator.valid?(gmo_point_state) + fail ArgumentError, "invalid value for \"gmo_point_state\", must be one of #{validator.allowable_values}." + end + @gmo_point_state = gmo_point_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] yahoo_point_state Object to be assigned + def yahoo_point_state=(yahoo_point_state) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + unless validator.valid?(yahoo_point_state) + fail ArgumentError, "invalid value for \"yahoo_point_state\", must be one of #{validator.allowable_values}." + end + @yahoo_point_state = yahoo_point_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + make_date == o.make_date && + update_date == o.update_date && + memo == o.memo && + payment_id == o.payment_id && + mobile == o.mobile && + paid == o.paid && + delivered == o.delivered && + canceled == o.canceled && + accepted_mail_state == o.accepted_mail_state && + paid_mail_state == o.paid_mail_state && + delivered_mail_state == o.delivered_mail_state && + accepted_mail_sent_date == o.accepted_mail_sent_date && + paid_mail_sent_date == o.paid_mail_sent_date && + delivered_mail_sent_date == o.delivered_mail_sent_date && + point_state == o.point_state && + gmo_point_state == o.gmo_point_state && + yahoo_point_state == o.yahoo_point_state && + product_total_price == o.product_total_price && + delivery_total_charge == o.delivery_total_charge && + fee == o.fee && + tax == o.tax && + noshi_total_charge == o.noshi_total_charge && + card_total_charge == o.card_total_charge && + wrapping_total_charge == o.wrapping_total_charge && + point_discount == o.point_discount && + gmo_point_discount == o.gmo_point_discount && + other_discount == o.other_discount && + other_discount_name == o.other_discount_name && + total_price == o.total_price && + granted_points == o.granted_points && + use_points == o.use_points && + granted_gmo_points == o.granted_gmo_points && + use_gmo_points == o.use_gmo_points && + granted_yahoo_points == o.granted_yahoo_points && + use_yahoo_points == o.use_yahoo_points && + external_order_id == o.external_order_id && + customer == o.customer && + details == o.details && + sale_deliveries == o.sale_deliveries && + segment == o.segment && + totals == o.totals + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, account_id, make_date, update_date, memo, payment_id, mobile, paid, delivered, canceled, accepted_mail_state, paid_mail_state, delivered_mail_state, accepted_mail_sent_date, paid_mail_sent_date, delivered_mail_sent_date, point_state, gmo_point_state, yahoo_point_state, product_total_price, delivery_total_charge, fee, tax, noshi_total_charge, card_total_charge, wrapping_total_charge, point_discount, gmo_point_discount, other_discount, other_discount_name, total_price, granted_points, use_points, granted_gmo_points, use_gmo_points, granted_yahoo_points, use_yahoo_points, external_order_id, customer, details, sale_deliveries, segment, totals].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sale200_response_sale_all_of_segment.rb b/lib/color_me_shop/models/get_sale200_response_sale_all_of_segment.rb new file mode 100644 index 0000000..ef4517d --- /dev/null +++ b/lib/color_me_shop/models/get_sale200_response_sale_all_of_segment.rb @@ -0,0 +1,217 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSale200ResponseSaleAllOfSegment + # 分割された受注ID + attr_accessor :siblings_sale_ids + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'siblings_sale_ids' => :'siblings_sale_ids' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'siblings_sale_ids' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSale200ResponseSaleAllOfSegment` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSale200ResponseSaleAllOfSegment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'siblings_sale_ids') + if (value = attributes[:'siblings_sale_ids']).is_a?(Array) + self.siblings_sale_ids = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + siblings_sale_ids == o.siblings_sale_ids + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [siblings_sale_ids].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sales200_response.rb b/lib/color_me_shop/models/get_sales200_response.rb new file mode 100644 index 0000000..b2bc1aa --- /dev/null +++ b/lib/color_me_shop/models/get_sales200_response.rb @@ -0,0 +1,225 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSales200Response + attr_accessor :sales + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sales' => :'sales', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sales' => :'Array', + :'meta' => :'GetSales200ResponseMeta' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSales200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSales200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sales') + if (value = attributes[:'sales']).is_a?(Array) + self.sales = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sales == o.sales && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sales, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sales200_response_meta.rb b/lib/color_me_shop/models/get_sales200_response_meta.rb new file mode 100644 index 0000000..93d5fcb --- /dev/null +++ b/lib/color_me_shop/models/get_sales200_response_meta.rb @@ -0,0 +1,235 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSales200ResponseMeta + # トータルの件数 + attr_accessor :total + + # 実効limit + attr_accessor :limit + + # 実効offset + attr_accessor :offset + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'total' => :'total', + :'limit' => :'limit', + :'offset' => :'offset' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'total' => :'Integer', + :'limit' => :'Integer', + :'offset' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSales200ResponseMeta` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSales200ResponseMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + end + + if attributes.key?(:'offset') + self.offset = attributes[:'offset'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + total == o.total && + limit == o.limit && + offset == o.offset + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [total, limit, offset].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sales200_response_sales_inner.rb b/lib/color_me_shop/models/get_sales200_response_sales_inner.rb new file mode 100644 index 0000000..4cea09a --- /dev/null +++ b/lib/color_me_shop/models/get_sales200_response_sales_inner.rb @@ -0,0 +1,736 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSales200ResponseSalesInner + # 売上ID + attr_accessor :id + + # ショップアカウントID + attr_accessor :account_id + + # 受注日時 + attr_accessor :make_date + + # 受注更新日時 + attr_accessor :update_date + + # 備考 + attr_accessor :memo + + # 使用された決済方法ID + attr_accessor :payment_id + + # モバイルからの注文であるか否か + attr_accessor :mobile + + # 入金済みであるか否か + attr_accessor :paid + + # 発送済みである否か + attr_accessor :delivered + + # キャンセル済みであるか否か + attr_accessor :canceled + + # 受注メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + attr_accessor :accepted_mail_state + + # 入金メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + attr_accessor :paid_mail_state + + # 発送メールの送信状態 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + attr_accessor :delivered_mail_state + + # 受注メールの送信日時 + attr_accessor :accepted_mail_sent_date + + # 入金メールの送信日時 + attr_accessor :paid_mail_sent_date + + # 発送メールの送信日時 + attr_accessor :delivered_mail_sent_date + + # ショップポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み + attr_accessor :point_state + + # GMOポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み + attr_accessor :gmo_point_state + + # Yahooポイント付与状態 - `assumed`: 仮付与 - `fixed`: 確定済み - `canceled`: キャンセル済み + attr_accessor :yahoo_point_state + + # 商品の合計金額 + attr_accessor :product_total_price + + # 配送料 + attr_accessor :delivery_total_charge + + # 決済手数料 + attr_accessor :fee + + # 商品合計金額に対する消費税 + attr_accessor :tax + + # 熨斗料金 + attr_accessor :noshi_total_charge + + # メッセージカード料金 + attr_accessor :card_total_charge + + # ラッピング料金 + attr_accessor :wrapping_total_charge + + # ショップポイントによる割引額 + attr_accessor :point_discount + + # GMOポイントによる割引額 + attr_accessor :gmo_point_discount + + # その他、クーポン等による割引額 + attr_accessor :other_discount + + # その他割引の名称 + attr_accessor :other_discount_name + + # 注文総額 + attr_accessor :total_price + + # 付与されたショップポイント数 + attr_accessor :granted_points + + # 使用されたショップポイント数 + attr_accessor :use_points + + # 付与されたGMOポイント数 + attr_accessor :granted_gmo_points + + # 使用されたGMOポイント数 + attr_accessor :use_gmo_points + + # 付与されたYahooポイント数 + attr_accessor :granted_yahoo_points + + # 使用されたYahooポイント数 + attr_accessor :use_yahoo_points + + # 外部システムで発行された決済識別番号 該当受注の決済が、楽天ペイ(オンライン決済)、LINE Pay、PayPal Commerce Platform、Amazon Pay、Amazon Pay V2、Square対面決済のいずれかである場合、その決済の決済識別番号を返します。 それ以外の決済に関しては空文字列を返します。 + attr_accessor :external_order_id + + attr_accessor :customer + + attr_accessor :details + + attr_accessor :sale_deliveries + + attr_accessor :segment + + attr_accessor :totals + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'account_id', + :'make_date' => :'make_date', + :'update_date' => :'update_date', + :'memo' => :'memo', + :'payment_id' => :'payment_id', + :'mobile' => :'mobile', + :'paid' => :'paid', + :'delivered' => :'delivered', + :'canceled' => :'canceled', + :'accepted_mail_state' => :'accepted_mail_state', + :'paid_mail_state' => :'paid_mail_state', + :'delivered_mail_state' => :'delivered_mail_state', + :'accepted_mail_sent_date' => :'accepted_mail_sent_date', + :'paid_mail_sent_date' => :'paid_mail_sent_date', + :'delivered_mail_sent_date' => :'delivered_mail_sent_date', + :'point_state' => :'point_state', + :'gmo_point_state' => :'gmo_point_state', + :'yahoo_point_state' => :'yahoo_point_state', + :'product_total_price' => :'product_total_price', + :'delivery_total_charge' => :'delivery_total_charge', + :'fee' => :'fee', + :'tax' => :'tax', + :'noshi_total_charge' => :'noshi_total_charge', + :'card_total_charge' => :'card_total_charge', + :'wrapping_total_charge' => :'wrapping_total_charge', + :'point_discount' => :'point_discount', + :'gmo_point_discount' => :'gmo_point_discount', + :'other_discount' => :'other_discount', + :'other_discount_name' => :'other_discount_name', + :'total_price' => :'total_price', + :'granted_points' => :'granted_points', + :'use_points' => :'use_points', + :'granted_gmo_points' => :'granted_gmo_points', + :'use_gmo_points' => :'use_gmo_points', + :'granted_yahoo_points' => :'granted_yahoo_points', + :'use_yahoo_points' => :'use_yahoo_points', + :'external_order_id' => :'external_order_id', + :'customer' => :'customer', + :'details' => :'details', + :'sale_deliveries' => :'sale_deliveries', + :'segment' => :'segment', + :'totals' => :'totals' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'account_id' => :'String', + :'make_date' => :'Integer', + :'update_date' => :'Integer', + :'memo' => :'String', + :'payment_id' => :'Integer', + :'mobile' => :'Boolean', + :'paid' => :'Boolean', + :'delivered' => :'Boolean', + :'canceled' => :'Boolean', + :'accepted_mail_state' => :'String', + :'paid_mail_state' => :'String', + :'delivered_mail_state' => :'String', + :'accepted_mail_sent_date' => :'Integer', + :'paid_mail_sent_date' => :'Integer', + :'delivered_mail_sent_date' => :'Integer', + :'point_state' => :'String', + :'gmo_point_state' => :'String', + :'yahoo_point_state' => :'String', + :'product_total_price' => :'Integer', + :'delivery_total_charge' => :'Integer', + :'fee' => :'Integer', + :'tax' => :'Integer', + :'noshi_total_charge' => :'Integer', + :'card_total_charge' => :'Integer', + :'wrapping_total_charge' => :'Integer', + :'point_discount' => :'Integer', + :'gmo_point_discount' => :'Integer', + :'other_discount' => :'Integer', + :'other_discount_name' => :'String', + :'total_price' => :'Integer', + :'granted_points' => :'Integer', + :'use_points' => :'Integer', + :'granted_gmo_points' => :'Integer', + :'use_gmo_points' => :'Integer', + :'granted_yahoo_points' => :'Integer', + :'use_yahoo_points' => :'Integer', + :'external_order_id' => :'String', + :'customer' => :'GetSales200ResponseSalesInnerCustomer', + :'details' => :'Array', + :'sale_deliveries' => :'Array', + :'segment' => :'GetSales200ResponseSalesInnerSegment', + :'totals' => :'GetSales200ResponseSalesInnerTotals' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'memo', + :'accepted_mail_sent_date', + :'paid_mail_sent_date', + :'delivered_mail_sent_date', + :'gmo_point_state', + :'yahoo_point_state', + :'segment', + :'totals' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSales200ResponseSalesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSales200ResponseSalesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'payment_id') + self.payment_id = attributes[:'payment_id'] + end + + if attributes.key?(:'mobile') + self.mobile = attributes[:'mobile'] + end + + if attributes.key?(:'paid') + self.paid = attributes[:'paid'] + end + + if attributes.key?(:'delivered') + self.delivered = attributes[:'delivered'] + end + + if attributes.key?(:'canceled') + self.canceled = attributes[:'canceled'] + end + + if attributes.key?(:'accepted_mail_state') + self.accepted_mail_state = attributes[:'accepted_mail_state'] + end + + if attributes.key?(:'paid_mail_state') + self.paid_mail_state = attributes[:'paid_mail_state'] + end + + if attributes.key?(:'delivered_mail_state') + self.delivered_mail_state = attributes[:'delivered_mail_state'] + end + + if attributes.key?(:'accepted_mail_sent_date') + self.accepted_mail_sent_date = attributes[:'accepted_mail_sent_date'] + end + + if attributes.key?(:'paid_mail_sent_date') + self.paid_mail_sent_date = attributes[:'paid_mail_sent_date'] + end + + if attributes.key?(:'delivered_mail_sent_date') + self.delivered_mail_sent_date = attributes[:'delivered_mail_sent_date'] + end + + if attributes.key?(:'point_state') + self.point_state = attributes[:'point_state'] + end + + if attributes.key?(:'gmo_point_state') + self.gmo_point_state = attributes[:'gmo_point_state'] + end + + if attributes.key?(:'yahoo_point_state') + self.yahoo_point_state = attributes[:'yahoo_point_state'] + end + + if attributes.key?(:'product_total_price') + self.product_total_price = attributes[:'product_total_price'] + end + + if attributes.key?(:'delivery_total_charge') + self.delivery_total_charge = attributes[:'delivery_total_charge'] + end + + if attributes.key?(:'fee') + self.fee = attributes[:'fee'] + end + + if attributes.key?(:'tax') + self.tax = attributes[:'tax'] + end + + if attributes.key?(:'noshi_total_charge') + self.noshi_total_charge = attributes[:'noshi_total_charge'] + end + + if attributes.key?(:'card_total_charge') + self.card_total_charge = attributes[:'card_total_charge'] + end + + if attributes.key?(:'wrapping_total_charge') + self.wrapping_total_charge = attributes[:'wrapping_total_charge'] + end + + if attributes.key?(:'point_discount') + self.point_discount = attributes[:'point_discount'] + end + + if attributes.key?(:'gmo_point_discount') + self.gmo_point_discount = attributes[:'gmo_point_discount'] + end + + if attributes.key?(:'other_discount') + self.other_discount = attributes[:'other_discount'] + end + + if attributes.key?(:'other_discount_name') + self.other_discount_name = attributes[:'other_discount_name'] + end + + if attributes.key?(:'total_price') + self.total_price = attributes[:'total_price'] + end + + if attributes.key?(:'granted_points') + self.granted_points = attributes[:'granted_points'] + end + + if attributes.key?(:'use_points') + self.use_points = attributes[:'use_points'] + end + + if attributes.key?(:'granted_gmo_points') + self.granted_gmo_points = attributes[:'granted_gmo_points'] + end + + if attributes.key?(:'use_gmo_points') + self.use_gmo_points = attributes[:'use_gmo_points'] + end + + if attributes.key?(:'granted_yahoo_points') + self.granted_yahoo_points = attributes[:'granted_yahoo_points'] + end + + if attributes.key?(:'use_yahoo_points') + self.use_yahoo_points = attributes[:'use_yahoo_points'] + end + + if attributes.key?(:'external_order_id') + self.external_order_id = attributes[:'external_order_id'] + end + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + + if attributes.key?(:'details') + if (value = attributes[:'details']).is_a?(Array) + self.details = value + end + end + + if attributes.key?(:'sale_deliveries') + if (value = attributes[:'sale_deliveries']).is_a?(Array) + self.sale_deliveries = value + end + end + + if attributes.key?(:'segment') + self.segment = attributes[:'segment'] + end + + if attributes.key?(:'totals') + self.totals = attributes[:'totals'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + accepted_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + return false unless accepted_mail_state_validator.valid?(@accepted_mail_state) + paid_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + return false unless paid_mail_state_validator.valid?(@paid_mail_state) + delivered_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + return false unless delivered_mail_state_validator.valid?(@delivered_mail_state) + point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + return false unless point_state_validator.valid?(@point_state) + gmo_point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + return false unless gmo_point_state_validator.valid?(@gmo_point_state) + yahoo_point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + return false unless yahoo_point_state_validator.valid?(@yahoo_point_state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] accepted_mail_state Object to be assigned + def accepted_mail_state=(accepted_mail_state) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + unless validator.valid?(accepted_mail_state) + fail ArgumentError, "invalid value for \"accepted_mail_state\", must be one of #{validator.allowable_values}." + end + @accepted_mail_state = accepted_mail_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] paid_mail_state Object to be assigned + def paid_mail_state=(paid_mail_state) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + unless validator.valid?(paid_mail_state) + fail ArgumentError, "invalid value for \"paid_mail_state\", must be one of #{validator.allowable_values}." + end + @paid_mail_state = paid_mail_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] delivered_mail_state Object to be assigned + def delivered_mail_state=(delivered_mail_state) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + unless validator.valid?(delivered_mail_state) + fail ArgumentError, "invalid value for \"delivered_mail_state\", must be one of #{validator.allowable_values}." + end + @delivered_mail_state = delivered_mail_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] point_state Object to be assigned + def point_state=(point_state) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + unless validator.valid?(point_state) + fail ArgumentError, "invalid value for \"point_state\", must be one of #{validator.allowable_values}." + end + @point_state = point_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] gmo_point_state Object to be assigned + def gmo_point_state=(gmo_point_state) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + unless validator.valid?(gmo_point_state) + fail ArgumentError, "invalid value for \"gmo_point_state\", must be one of #{validator.allowable_values}." + end + @gmo_point_state = gmo_point_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] yahoo_point_state Object to be assigned + def yahoo_point_state=(yahoo_point_state) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + unless validator.valid?(yahoo_point_state) + fail ArgumentError, "invalid value for \"yahoo_point_state\", must be one of #{validator.allowable_values}." + end + @yahoo_point_state = yahoo_point_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + make_date == o.make_date && + update_date == o.update_date && + memo == o.memo && + payment_id == o.payment_id && + mobile == o.mobile && + paid == o.paid && + delivered == o.delivered && + canceled == o.canceled && + accepted_mail_state == o.accepted_mail_state && + paid_mail_state == o.paid_mail_state && + delivered_mail_state == o.delivered_mail_state && + accepted_mail_sent_date == o.accepted_mail_sent_date && + paid_mail_sent_date == o.paid_mail_sent_date && + delivered_mail_sent_date == o.delivered_mail_sent_date && + point_state == o.point_state && + gmo_point_state == o.gmo_point_state && + yahoo_point_state == o.yahoo_point_state && + product_total_price == o.product_total_price && + delivery_total_charge == o.delivery_total_charge && + fee == o.fee && + tax == o.tax && + noshi_total_charge == o.noshi_total_charge && + card_total_charge == o.card_total_charge && + wrapping_total_charge == o.wrapping_total_charge && + point_discount == o.point_discount && + gmo_point_discount == o.gmo_point_discount && + other_discount == o.other_discount && + other_discount_name == o.other_discount_name && + total_price == o.total_price && + granted_points == o.granted_points && + use_points == o.use_points && + granted_gmo_points == o.granted_gmo_points && + use_gmo_points == o.use_gmo_points && + granted_yahoo_points == o.granted_yahoo_points && + use_yahoo_points == o.use_yahoo_points && + external_order_id == o.external_order_id && + customer == o.customer && + details == o.details && + sale_deliveries == o.sale_deliveries && + segment == o.segment && + totals == o.totals + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, account_id, make_date, update_date, memo, payment_id, mobile, paid, delivered, canceled, accepted_mail_state, paid_mail_state, delivered_mail_state, accepted_mail_sent_date, paid_mail_sent_date, delivered_mail_sent_date, point_state, gmo_point_state, yahoo_point_state, product_total_price, delivery_total_charge, fee, tax, noshi_total_charge, card_total_charge, wrapping_total_charge, point_discount, gmo_point_discount, other_discount, other_discount_name, total_price, granted_points, use_points, granted_gmo_points, use_gmo_points, granted_yahoo_points, use_yahoo_points, external_order_id, customer, details, sale_deliveries, segment, totals].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sales200_response_sales_inner_customer.rb b/lib/color_me_shop/models/get_sales200_response_sales_inner_customer.rb new file mode 100644 index 0000000..caa26a7 --- /dev/null +++ b/lib/color_me_shop/models/get_sales200_response_sales_inner_customer.rb @@ -0,0 +1,509 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSales200ResponseSalesInnerCustomer + # 顧客ID + attr_accessor :id + + # ショップアカウントID + attr_accessor :account_id + + # 顧客の名前 + attr_accessor :name + + # 名前のフリガナ + attr_accessor :furigana + + # 法人名 + attr_accessor :hojin + + # 部署名 + attr_accessor :busho + + # 性別 + attr_accessor :sex + + # 誕生日 + attr_accessor :birthday + + # 郵便番号 + attr_accessor :postal + + # 都道府県の通し番号。北海道が1、沖縄が47 + attr_accessor :pref_id + + # 都道府県名 + attr_accessor :pref_name + + # 住所1 + attr_accessor :address1 + + # 住所2 + attr_accessor :address2 + + # メールアドレス + attr_accessor :mail + + # 電話番号 + attr_accessor :tel + + # FAX番号 + attr_accessor :fax + + # 携帯電話番号 + attr_accessor :tel_mobile + + # 備考 + attr_accessor :other + + # 保有ポイント数 + attr_accessor :points + + # 会員登録済みであるか否か + attr_accessor :member + + # これまでの購入回数 + attr_accessor :sales_count + + # メルマガ受信可否 + attr_accessor :receive_mail_magazine + + # フリー項目1の入力内容 + attr_accessor :answer_free_form1 + + # フリー項目2の入力内容 + attr_accessor :answer_free_form2 + + # フリー項目3の入力内容 + attr_accessor :answer_free_form3 + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'account_id', + :'name' => :'name', + :'furigana' => :'furigana', + :'hojin' => :'hojin', + :'busho' => :'busho', + :'sex' => :'sex', + :'birthday' => :'birthday', + :'postal' => :'postal', + :'pref_id' => :'pref_id', + :'pref_name' => :'pref_name', + :'address1' => :'address1', + :'address2' => :'address2', + :'mail' => :'mail', + :'tel' => :'tel', + :'fax' => :'fax', + :'tel_mobile' => :'tel_mobile', + :'other' => :'other', + :'points' => :'points', + :'member' => :'member', + :'sales_count' => :'sales_count', + :'receive_mail_magazine' => :'receive_mail_magazine', + :'answer_free_form1' => :'answer_free_form1', + :'answer_free_form2' => :'answer_free_form2', + :'answer_free_form3' => :'answer_free_form3' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'account_id' => :'String', + :'name' => :'String', + :'furigana' => :'String', + :'hojin' => :'String', + :'busho' => :'String', + :'sex' => :'String', + :'birthday' => :'String', + :'postal' => :'String', + :'pref_id' => :'Integer', + :'pref_name' => :'String', + :'address1' => :'String', + :'address2' => :'String', + :'mail' => :'String', + :'tel' => :'String', + :'fax' => :'String', + :'tel_mobile' => :'String', + :'other' => :'String', + :'points' => :'Integer', + :'member' => :'Boolean', + :'sales_count' => :'Integer', + :'receive_mail_magazine' => :'Boolean', + :'answer_free_form1' => :'String', + :'answer_free_form2' => :'String', + :'answer_free_form3' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'name', + :'furigana', + :'hojin', + :'busho', + :'sex', + :'birthday', + :'postal', + :'pref_id', + :'pref_name', + :'address1', + :'address2', + :'mail', + :'tel', + :'fax', + :'tel_mobile', + :'other', + :'receive_mail_magazine', + :'answer_free_form1', + :'answer_free_form2', + :'answer_free_form3' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSales200ResponseSalesInnerCustomer` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSales200ResponseSalesInnerCustomer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'furigana') + self.furigana = attributes[:'furigana'] + end + + if attributes.key?(:'hojin') + self.hojin = attributes[:'hojin'] + end + + if attributes.key?(:'busho') + self.busho = attributes[:'busho'] + end + + if attributes.key?(:'sex') + self.sex = attributes[:'sex'] + end + + if attributes.key?(:'birthday') + self.birthday = attributes[:'birthday'] + end + + if attributes.key?(:'postal') + self.postal = attributes[:'postal'] + end + + if attributes.key?(:'pref_id') + self.pref_id = attributes[:'pref_id'] + end + + if attributes.key?(:'pref_name') + self.pref_name = attributes[:'pref_name'] + end + + if attributes.key?(:'address1') + self.address1 = attributes[:'address1'] + end + + if attributes.key?(:'address2') + self.address2 = attributes[:'address2'] + end + + if attributes.key?(:'mail') + self.mail = attributes[:'mail'] + end + + if attributes.key?(:'tel') + self.tel = attributes[:'tel'] + end + + if attributes.key?(:'fax') + self.fax = attributes[:'fax'] + end + + if attributes.key?(:'tel_mobile') + self.tel_mobile = attributes[:'tel_mobile'] + end + + if attributes.key?(:'other') + self.other = attributes[:'other'] + end + + if attributes.key?(:'points') + self.points = attributes[:'points'] + end + + if attributes.key?(:'member') + self.member = attributes[:'member'] + end + + if attributes.key?(:'sales_count') + self.sales_count = attributes[:'sales_count'] + end + + if attributes.key?(:'receive_mail_magazine') + self.receive_mail_magazine = attributes[:'receive_mail_magazine'] + end + + if attributes.key?(:'answer_free_form1') + self.answer_free_form1 = attributes[:'answer_free_form1'] + end + + if attributes.key?(:'answer_free_form2') + self.answer_free_form2 = attributes[:'answer_free_form2'] + end + + if attributes.key?(:'answer_free_form3') + self.answer_free_form3 = attributes[:'answer_free_form3'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + sex_validator = EnumAttributeValidator.new('String', ["male", "female"]) + return false unless sex_validator.valid?(@sex) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] sex Object to be assigned + def sex=(sex) + validator = EnumAttributeValidator.new('String', ["male", "female"]) + unless validator.valid?(sex) + fail ArgumentError, "invalid value for \"sex\", must be one of #{validator.allowable_values}." + end + @sex = sex + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + name == o.name && + furigana == o.furigana && + hojin == o.hojin && + busho == o.busho && + sex == o.sex && + birthday == o.birthday && + postal == o.postal && + pref_id == o.pref_id && + pref_name == o.pref_name && + address1 == o.address1 && + address2 == o.address2 && + mail == o.mail && + tel == o.tel && + fax == o.fax && + tel_mobile == o.tel_mobile && + other == o.other && + points == o.points && + member == o.member && + sales_count == o.sales_count && + receive_mail_magazine == o.receive_mail_magazine && + answer_free_form1 == o.answer_free_form1 && + answer_free_form2 == o.answer_free_form2 && + answer_free_form3 == o.answer_free_form3 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, account_id, name, furigana, hojin, busho, sex, birthday, postal, pref_id, pref_name, address1, address2, mail, tel, fax, tel_mobile, other, points, member, sales_count, receive_mail_magazine, answer_free_form1, answer_free_form2, answer_free_form3].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sales200_response_sales_inner_details_inner.rb b/lib/color_me_shop/models/get_sales200_response_sales_inner_details_inner.rb new file mode 100644 index 0000000..223f923 --- /dev/null +++ b/lib/color_me_shop/models/get_sales200_response_sales_inner_details_inner.rb @@ -0,0 +1,425 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSales200ResponseSalesInnerDetailsInner + # 受注明細ID + attr_accessor :id + + # 売上ID + attr_accessor :sale_id + + # ショップアカウントID + attr_accessor :account_id + + # 商品ID + attr_accessor :product_id + + # お届け先ID + attr_accessor :sale_delivery_id + + # オプション1の値(最新の商品情報) + attr_accessor :option1_value + + # オプション2の値(最新の商品情報) + attr_accessor :option2_value + + # オプション1の値の選択肢中の位置 + attr_accessor :option1_index + + # オプション2の値の選択肢中の位置 + attr_accessor :option2_index + + # 型番 + attr_accessor :product_model_number + + # 商品名(最新の商品情報) + attr_accessor :product_name + + # 商品名とオプション名(注文時の商品情報) + attr_accessor :pristine_product_full_name + + # 商品原価 + attr_accessor :product_cost + + # 商品画像URL + attr_accessor :product_image_url + + # サムネイル用商品画像URL + attr_accessor :product_thumbnail_image_url + + # モバイル用商品画像URL + attr_accessor :product_mobile_image_url + + # 商品販売価格 + attr_accessor :price + + # 税込み商品価格 + attr_accessor :price_with_tax + + # 商品点数 + attr_accessor :product_num + + # 単位 + attr_accessor :unit + + # 商品小計。販売価格と点数の積 + attr_accessor :subtotal_price + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'sale_id' => :'sale_id', + :'account_id' => :'account_id', + :'product_id' => :'product_id', + :'sale_delivery_id' => :'sale_delivery_id', + :'option1_value' => :'option1_value', + :'option2_value' => :'option2_value', + :'option1_index' => :'option1_index', + :'option2_index' => :'option2_index', + :'product_model_number' => :'product_model_number', + :'product_name' => :'product_name', + :'pristine_product_full_name' => :'pristine_product_full_name', + :'product_cost' => :'product_cost', + :'product_image_url' => :'product_image_url', + :'product_thumbnail_image_url' => :'product_thumbnail_image_url', + :'product_mobile_image_url' => :'product_mobile_image_url', + :'price' => :'price', + :'price_with_tax' => :'price_with_tax', + :'product_num' => :'product_num', + :'unit' => :'unit', + :'subtotal_price' => :'subtotal_price' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'sale_id' => :'Integer', + :'account_id' => :'String', + :'product_id' => :'Integer', + :'sale_delivery_id' => :'Integer', + :'option1_value' => :'String', + :'option2_value' => :'String', + :'option1_index' => :'Integer', + :'option2_index' => :'Integer', + :'product_model_number' => :'String', + :'product_name' => :'String', + :'pristine_product_full_name' => :'String', + :'product_cost' => :'Integer', + :'product_image_url' => :'String', + :'product_thumbnail_image_url' => :'String', + :'product_mobile_image_url' => :'String', + :'price' => :'Integer', + :'price_with_tax' => :'Integer', + :'product_num' => :'Integer', + :'unit' => :'String', + :'subtotal_price' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'sale_delivery_id', + :'option1_value', + :'option2_value', + :'option1_index', + :'option2_index', + :'product_cost', + :'product_image_url', + :'product_thumbnail_image_url', + :'product_mobile_image_url', + :'unit', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSales200ResponseSalesInnerDetailsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSales200ResponseSalesInnerDetailsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'sale_id') + self.sale_id = attributes[:'sale_id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'sale_delivery_id') + self.sale_delivery_id = attributes[:'sale_delivery_id'] + end + + if attributes.key?(:'option1_value') + self.option1_value = attributes[:'option1_value'] + end + + if attributes.key?(:'option2_value') + self.option2_value = attributes[:'option2_value'] + end + + if attributes.key?(:'option1_index') + self.option1_index = attributes[:'option1_index'] + end + + if attributes.key?(:'option2_index') + self.option2_index = attributes[:'option2_index'] + end + + if attributes.key?(:'product_model_number') + self.product_model_number = attributes[:'product_model_number'] + end + + if attributes.key?(:'product_name') + self.product_name = attributes[:'product_name'] + end + + if attributes.key?(:'pristine_product_full_name') + self.pristine_product_full_name = attributes[:'pristine_product_full_name'] + end + + if attributes.key?(:'product_cost') + self.product_cost = attributes[:'product_cost'] + end + + if attributes.key?(:'product_image_url') + self.product_image_url = attributes[:'product_image_url'] + end + + if attributes.key?(:'product_thumbnail_image_url') + self.product_thumbnail_image_url = attributes[:'product_thumbnail_image_url'] + end + + if attributes.key?(:'product_mobile_image_url') + self.product_mobile_image_url = attributes[:'product_mobile_image_url'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'price_with_tax') + self.price_with_tax = attributes[:'price_with_tax'] + end + + if attributes.key?(:'product_num') + self.product_num = attributes[:'product_num'] + end + + if attributes.key?(:'unit') + self.unit = attributes[:'unit'] + end + + if attributes.key?(:'subtotal_price') + self.subtotal_price = attributes[:'subtotal_price'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + sale_id == o.sale_id && + account_id == o.account_id && + product_id == o.product_id && + sale_delivery_id == o.sale_delivery_id && + option1_value == o.option1_value && + option2_value == o.option2_value && + option1_index == o.option1_index && + option2_index == o.option2_index && + product_model_number == o.product_model_number && + product_name == o.product_name && + pristine_product_full_name == o.pristine_product_full_name && + product_cost == o.product_cost && + product_image_url == o.product_image_url && + product_thumbnail_image_url == o.product_thumbnail_image_url && + product_mobile_image_url == o.product_mobile_image_url && + price == o.price && + price_with_tax == o.price_with_tax && + product_num == o.product_num && + unit == o.unit && + subtotal_price == o.subtotal_price + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, sale_id, account_id, product_id, sale_delivery_id, option1_value, option2_value, option1_index, option2_index, product_model_number, product_name, pristine_product_full_name, product_cost, product_image_url, product_thumbnail_image_url, product_mobile_image_url, price, price_with_tax, product_num, unit, subtotal_price].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sales200_response_sales_inner_sale_deliveries_inner.rb b/lib/color_me_shop/models/get_sales200_response_sales_inner_sale_deliveries_inner.rb new file mode 100644 index 0000000..dd53a5f --- /dev/null +++ b/lib/color_me_shop/models/get_sales200_response_sales_inner_sale_deliveries_inner.rb @@ -0,0 +1,503 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSales200ResponseSalesInnerSaleDeliveriesInner + # お届け先ID + attr_accessor :id + + # ショップアカウントID + attr_accessor :account_id + + # 売上ID + attr_accessor :sale_id + + # 使用された配送方法ID + attr_accessor :delivery_id + + # この配送に含まれる受注明細IDの配列 + attr_accessor :detail_ids + + # 宛名 + attr_accessor :name + + # 宛名のフリガナ + attr_accessor :furigana + + # 郵便番号 + attr_accessor :postal + + # 都道府県の通し番号。北海道が1、沖縄が47 + attr_accessor :pref_id + + # 都道府県名 + attr_accessor :pref_name + + # 住所1 + attr_accessor :address1 + + # 住所2 + attr_accessor :address2 + + # 電話番号 + attr_accessor :tel + + # 配送希望日 + attr_accessor :preferred_date + + # 配送希望時間帯 + attr_accessor :preferred_period + + # 配送伝票番号 + attr_accessor :slip_number + + # 熨斗の文言 + attr_accessor :noshi_text + + # 熨斗の料金 + attr_accessor :noshi_charge + + # メッセージカードの表示名 + attr_accessor :card_name + + # メッセージカードのテキスト + attr_accessor :card_text + + # メッセージカードの料金 + attr_accessor :card_charge + + # ラッピングの表示名 + attr_accessor :wrapping_name + + # ラッピングの料金 + attr_accessor :wrapping_charge + + # 配送料 + attr_accessor :delivery_charge + + # 配送料・手数料の小計 + attr_accessor :total_charge + + # 配送状況確認URL + attr_accessor :tracking_url + + # 備考 + attr_accessor :memo + + # 発送済みであるか否か + attr_accessor :delivered + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'account_id' => :'account_id', + :'sale_id' => :'sale_id', + :'delivery_id' => :'delivery_id', + :'detail_ids' => :'detail_ids', + :'name' => :'name', + :'furigana' => :'furigana', + :'postal' => :'postal', + :'pref_id' => :'pref_id', + :'pref_name' => :'pref_name', + :'address1' => :'address1', + :'address2' => :'address2', + :'tel' => :'tel', + :'preferred_date' => :'preferred_date', + :'preferred_period' => :'preferred_period', + :'slip_number' => :'slip_number', + :'noshi_text' => :'noshi_text', + :'noshi_charge' => :'noshi_charge', + :'card_name' => :'card_name', + :'card_text' => :'card_text', + :'card_charge' => :'card_charge', + :'wrapping_name' => :'wrapping_name', + :'wrapping_charge' => :'wrapping_charge', + :'delivery_charge' => :'delivery_charge', + :'total_charge' => :'total_charge', + :'tracking_url' => :'tracking_url', + :'memo' => :'memo', + :'delivered' => :'delivered' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'account_id' => :'String', + :'sale_id' => :'Integer', + :'delivery_id' => :'Integer', + :'detail_ids' => :'Array', + :'name' => :'String', + :'furigana' => :'String', + :'postal' => :'String', + :'pref_id' => :'Integer', + :'pref_name' => :'String', + :'address1' => :'String', + :'address2' => :'String', + :'tel' => :'String', + :'preferred_date' => :'String', + :'preferred_period' => :'String', + :'slip_number' => :'String', + :'noshi_text' => :'String', + :'noshi_charge' => :'Integer', + :'card_name' => :'String', + :'card_text' => :'String', + :'card_charge' => :'Integer', + :'wrapping_name' => :'String', + :'wrapping_charge' => :'Integer', + :'delivery_charge' => :'Integer', + :'total_charge' => :'Integer', + :'tracking_url' => :'String', + :'memo' => :'String', + :'delivered' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'postal', + :'address1', + :'address2', + :'tel', + :'preferred_date', + :'preferred_period', + :'slip_number', + :'noshi_text', + :'noshi_charge', + :'card_name', + :'card_text', + :'card_charge', + :'wrapping_name', + :'wrapping_charge', + :'tracking_url', + :'memo', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'sale_id') + self.sale_id = attributes[:'sale_id'] + end + + if attributes.key?(:'delivery_id') + self.delivery_id = attributes[:'delivery_id'] + end + + if attributes.key?(:'detail_ids') + if (value = attributes[:'detail_ids']).is_a?(Array) + self.detail_ids = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'furigana') + self.furigana = attributes[:'furigana'] + end + + if attributes.key?(:'postal') + self.postal = attributes[:'postal'] + end + + if attributes.key?(:'pref_id') + self.pref_id = attributes[:'pref_id'] + end + + if attributes.key?(:'pref_name') + self.pref_name = attributes[:'pref_name'] + end + + if attributes.key?(:'address1') + self.address1 = attributes[:'address1'] + end + + if attributes.key?(:'address2') + self.address2 = attributes[:'address2'] + end + + if attributes.key?(:'tel') + self.tel = attributes[:'tel'] + end + + if attributes.key?(:'preferred_date') + self.preferred_date = attributes[:'preferred_date'] + end + + if attributes.key?(:'preferred_period') + self.preferred_period = attributes[:'preferred_period'] + end + + if attributes.key?(:'slip_number') + self.slip_number = attributes[:'slip_number'] + end + + if attributes.key?(:'noshi_text') + self.noshi_text = attributes[:'noshi_text'] + end + + if attributes.key?(:'noshi_charge') + self.noshi_charge = attributes[:'noshi_charge'] + end + + if attributes.key?(:'card_name') + self.card_name = attributes[:'card_name'] + end + + if attributes.key?(:'card_text') + self.card_text = attributes[:'card_text'] + end + + if attributes.key?(:'card_charge') + self.card_charge = attributes[:'card_charge'] + end + + if attributes.key?(:'wrapping_name') + self.wrapping_name = attributes[:'wrapping_name'] + end + + if attributes.key?(:'wrapping_charge') + self.wrapping_charge = attributes[:'wrapping_charge'] + end + + if attributes.key?(:'delivery_charge') + self.delivery_charge = attributes[:'delivery_charge'] + end + + if attributes.key?(:'total_charge') + self.total_charge = attributes[:'total_charge'] + end + + if attributes.key?(:'tracking_url') + self.tracking_url = attributes[:'tracking_url'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'delivered') + self.delivered = attributes[:'delivered'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + account_id == o.account_id && + sale_id == o.sale_id && + delivery_id == o.delivery_id && + detail_ids == o.detail_ids && + name == o.name && + furigana == o.furigana && + postal == o.postal && + pref_id == o.pref_id && + pref_name == o.pref_name && + address1 == o.address1 && + address2 == o.address2 && + tel == o.tel && + preferred_date == o.preferred_date && + preferred_period == o.preferred_period && + slip_number == o.slip_number && + noshi_text == o.noshi_text && + noshi_charge == o.noshi_charge && + card_name == o.card_name && + card_text == o.card_text && + card_charge == o.card_charge && + wrapping_name == o.wrapping_name && + wrapping_charge == o.wrapping_charge && + delivery_charge == o.delivery_charge && + total_charge == o.total_charge && + tracking_url == o.tracking_url && + memo == o.memo && + delivered == o.delivered + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, account_id, sale_id, delivery_id, detail_ids, name, furigana, postal, pref_id, pref_name, address1, address2, tel, preferred_date, preferred_period, slip_number, noshi_text, noshi_charge, card_name, card_text, card_charge, wrapping_name, wrapping_charge, delivery_charge, total_charge, tracking_url, memo, delivered].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sales200_response_sales_inner_segment.rb b/lib/color_me_shop/models/get_sales200_response_sales_inner_segment.rb new file mode 100644 index 0000000..b59055d --- /dev/null +++ b/lib/color_me_shop/models/get_sales200_response_sales_inner_segment.rb @@ -0,0 +1,305 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSales200ResponseSalesInnerSegment + # 分割された受注内のID + attr_accessor :id + + # 区分名 + attr_accessor :name + + # 親受注のID。 該当の受注が分割されていない場合、自身の受注IDを返します。 + attr_accessor :parent_sale_id + + # 該当の受注が分割されているか否か + attr_accessor :splitted + + # 分割された受注の商品の合計金額 + attr_accessor :product_total_price + + # 分割された受注の配送料の合計 + attr_accessor :delivery_total_charge + + # 分割された受注金額の総計 + attr_accessor :total_price + + # 分割された受注の熨斗料金の合計 + attr_accessor :noshi_total_charge + + # 分割された受注のメッセージカード料金の合計 + attr_accessor :card_total_charge + + # 分割された受注のラッピング料金の合計 + attr_accessor :wrapping_total_charge + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'parent_sale_id' => :'parent_sale_id', + :'splitted' => :'splitted', + :'product_total_price' => :'product_total_price', + :'delivery_total_charge' => :'delivery_total_charge', + :'total_price' => :'total_price', + :'noshi_total_charge' => :'noshi_total_charge', + :'card_total_charge' => :'card_total_charge', + :'wrapping_total_charge' => :'wrapping_total_charge' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'name' => :'String', + :'parent_sale_id' => :'Integer', + :'splitted' => :'Boolean', + :'product_total_price' => :'Integer', + :'delivery_total_charge' => :'Integer', + :'total_price' => :'Integer', + :'noshi_total_charge' => :'Integer', + :'card_total_charge' => :'Integer', + :'wrapping_total_charge' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSales200ResponseSalesInnerSegment` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSales200ResponseSalesInnerSegment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'parent_sale_id') + self.parent_sale_id = attributes[:'parent_sale_id'] + end + + if attributes.key?(:'splitted') + self.splitted = attributes[:'splitted'] + end + + if attributes.key?(:'product_total_price') + self.product_total_price = attributes[:'product_total_price'] + end + + if attributes.key?(:'delivery_total_charge') + self.delivery_total_charge = attributes[:'delivery_total_charge'] + end + + if attributes.key?(:'total_price') + self.total_price = attributes[:'total_price'] + end + + if attributes.key?(:'noshi_total_charge') + self.noshi_total_charge = attributes[:'noshi_total_charge'] + end + + if attributes.key?(:'card_total_charge') + self.card_total_charge = attributes[:'card_total_charge'] + end + + if attributes.key?(:'wrapping_total_charge') + self.wrapping_total_charge = attributes[:'wrapping_total_charge'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + parent_sale_id == o.parent_sale_id && + splitted == o.splitted && + product_total_price == o.product_total_price && + delivery_total_charge == o.delivery_total_charge && + total_price == o.total_price && + noshi_total_charge == o.noshi_total_charge && + card_total_charge == o.card_total_charge && + wrapping_total_charge == o.wrapping_total_charge + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, parent_sale_id, splitted, product_total_price, delivery_total_charge, total_price, noshi_total_charge, card_total_charge, wrapping_total_charge].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_sales200_response_sales_inner_totals.rb b/lib/color_me_shop/models/get_sales200_response_sales_inner_totals.rb new file mode 100644 index 0000000..aa55cf7 --- /dev/null +++ b/lib/color_me_shop/models/get_sales200_response_sales_inner_totals.rb @@ -0,0 +1,265 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetSales200ResponseSalesInnerTotals + # 受注における通常税率(10%)の消費税 + attr_accessor :normal_tax_amount + + # 受注における軽減税率(8%)の消費税 + attr_accessor :reduced_tax_amount + + # 通常税率(10%)の適用金額を対象としたの割引額 + attr_accessor :discount_amount_for_normal_tax + + # 軽減税率(8%)の適用金額を対象としたの割引額 + attr_accessor :discount_amount_for_reduced_tax + + # 通常税率(10%)の適用金額の税込合計額 + attr_accessor :total_price_with_normal_tax + + # 軽減税率(8%)の適用金額の税込合計額 + attr_accessor :total_price_with_reduced_tax + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'normal_tax_amount' => :'normal_tax_amount', + :'reduced_tax_amount' => :'reduced_tax_amount', + :'discount_amount_for_normal_tax' => :'discount_amount_for_normal_tax', + :'discount_amount_for_reduced_tax' => :'discount_amount_for_reduced_tax', + :'total_price_with_normal_tax' => :'total_price_with_normal_tax', + :'total_price_with_reduced_tax' => :'total_price_with_reduced_tax' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'normal_tax_amount' => :'Integer', + :'reduced_tax_amount' => :'Integer', + :'discount_amount_for_normal_tax' => :'Integer', + :'discount_amount_for_reduced_tax' => :'Integer', + :'total_price_with_normal_tax' => :'Integer', + :'total_price_with_reduced_tax' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetSales200ResponseSalesInnerTotals` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetSales200ResponseSalesInnerTotals`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'normal_tax_amount') + self.normal_tax_amount = attributes[:'normal_tax_amount'] + end + + if attributes.key?(:'reduced_tax_amount') + self.reduced_tax_amount = attributes[:'reduced_tax_amount'] + end + + if attributes.key?(:'discount_amount_for_normal_tax') + self.discount_amount_for_normal_tax = attributes[:'discount_amount_for_normal_tax'] + end + + if attributes.key?(:'discount_amount_for_reduced_tax') + self.discount_amount_for_reduced_tax = attributes[:'discount_amount_for_reduced_tax'] + end + + if attributes.key?(:'total_price_with_normal_tax') + self.total_price_with_normal_tax = attributes[:'total_price_with_normal_tax'] + end + + if attributes.key?(:'total_price_with_reduced_tax') + self.total_price_with_reduced_tax = attributes[:'total_price_with_reduced_tax'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + normal_tax_amount == o.normal_tax_amount && + reduced_tax_amount == o.reduced_tax_amount && + discount_amount_for_normal_tax == o.discount_amount_for_normal_tax && + discount_amount_for_reduced_tax == o.discount_amount_for_reduced_tax && + total_price_with_normal_tax == o.total_price_with_normal_tax && + total_price_with_reduced_tax == o.total_price_with_reduced_tax + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [normal_tax_amount, reduced_tax_amount, discount_amount_for_normal_tax, discount_amount_for_reduced_tax, total_price_with_normal_tax, total_price_with_reduced_tax].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_shop200_response.rb b/lib/color_me_shop/models/get_shop200_response.rb new file mode 100644 index 0000000..34f313e --- /dev/null +++ b/lib/color_me_shop/models/get_shop200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetShop200Response + attr_accessor :shop + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'shop' => :'shop' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'shop' => :'GetShop200ResponseShop' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetShop200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetShop200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'shop') + self.shop = attributes[:'shop'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + shop == o.shop + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [shop].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_shop200_response_shop.rb b/lib/color_me_shop/models/get_shop200_response_shop.rb new file mode 100644 index 0000000..7bb9a01 --- /dev/null +++ b/lib/color_me_shop/models/get_shop200_response_shop.rb @@ -0,0 +1,688 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetShop200ResponseShop + # ショップアカウントID + attr_accessor :id + + # アカウント状態 + attr_accessor :state + + # ドメインプラン + attr_accessor :domain_plan + + # 契約プラン + attr_accessor :contract_plan + + # 契約開始日時 + attr_accessor :contract_start_date + + # 契約終了日時 + attr_accessor :contract_end_date + + # 契約期間 + attr_accessor :contract_term + + # 最終ログイン日時 + attr_accessor :last_login_date + + # 申し込み完了日時 + attr_accessor :setup_date + + # アカウント作成日時 + attr_accessor :make_date + + # ショップURL + attr_accessor :url + + # 開店状態 + attr_accessor :open_state + + # モバイルショップ開店状態 + attr_accessor :mobile_open_state + + # ログインID + attr_accessor :login_id + + # 登録者氏名(姓) + attr_accessor :name1 + + # 登録者氏名(名) + attr_accessor :name2 + + # 登録者氏名カナ(姓) + attr_accessor :name1_kana + + # 登録者氏名カナ(名) + attr_accessor :name2_kana + + # 法人名 + attr_accessor :hojin + + # 法人名カナ + attr_accessor :hojin_kana + + # 登録者メールアドレス + attr_accessor :user_mail + + # 登録者電話番号 + attr_accessor :tel + + # 登録者FAX番号 + attr_accessor :fax + + # 郵便番号 + attr_accessor :postal + + # 都道府県ID + attr_accessor :pref_id + + # 都道府県名 + attr_accessor :pref_name + + # 住所1 + attr_accessor :address1 + + # 住所2 + attr_accessor :address2 + + # ショップ名 + attr_accessor :title + + # メールタイトル用ショップ名 + attr_accessor :title_short + + # 管理者メールアドレス + attr_accessor :shop_mail_1 + + # 管理者携帯メールアドレス + attr_accessor :shop_mail_2 + + # 消費税の内税・外税設定 + attr_accessor :tax_type + + # 消費税率 + attr_accessor :tax + + # 消費税の切り捨て、切り上げ設定 + attr_accessor :tax_rounding_method + + # 軽減税率 + attr_accessor :reduce_tax_rate + + # ショップロゴ画像のURL + attr_accessor :shop_logo_url + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'state' => :'state', + :'domain_plan' => :'domain_plan', + :'contract_plan' => :'contract_plan', + :'contract_start_date' => :'contract_start_date', + :'contract_end_date' => :'contract_end_date', + :'contract_term' => :'contract_term', + :'last_login_date' => :'last_login_date', + :'setup_date' => :'setup_date', + :'make_date' => :'make_date', + :'url' => :'url', + :'open_state' => :'open_state', + :'mobile_open_state' => :'mobile_open_state', + :'login_id' => :'login_id', + :'name1' => :'name1', + :'name2' => :'name2', + :'name1_kana' => :'name1_kana', + :'name2_kana' => :'name2_kana', + :'hojin' => :'hojin', + :'hojin_kana' => :'hojin_kana', + :'user_mail' => :'user_mail', + :'tel' => :'tel', + :'fax' => :'fax', + :'postal' => :'postal', + :'pref_id' => :'pref_id', + :'pref_name' => :'pref_name', + :'address1' => :'address1', + :'address2' => :'address2', + :'title' => :'title', + :'title_short' => :'title_short', + :'shop_mail_1' => :'shop_mail_1', + :'shop_mail_2' => :'shop_mail_2', + :'tax_type' => :'tax_type', + :'tax' => :'tax', + :'tax_rounding_method' => :'tax_rounding_method', + :'reduce_tax_rate' => :'reduce_tax_rate', + :'shop_logo_url' => :'shop_logo_url' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'state' => :'String', + :'domain_plan' => :'String', + :'contract_plan' => :'String', + :'contract_start_date' => :'Integer', + :'contract_end_date' => :'Integer', + :'contract_term' => :'Integer', + :'last_login_date' => :'Integer', + :'setup_date' => :'Integer', + :'make_date' => :'Integer', + :'url' => :'String', + :'open_state' => :'String', + :'mobile_open_state' => :'String', + :'login_id' => :'String', + :'name1' => :'String', + :'name2' => :'String', + :'name1_kana' => :'String', + :'name2_kana' => :'String', + :'hojin' => :'String', + :'hojin_kana' => :'String', + :'user_mail' => :'String', + :'tel' => :'String', + :'fax' => :'String', + :'postal' => :'String', + :'pref_id' => :'Integer', + :'pref_name' => :'String', + :'address1' => :'String', + :'address2' => :'String', + :'title' => :'String', + :'title_short' => :'String', + :'shop_mail_1' => :'String', + :'shop_mail_2' => :'String', + :'tax_type' => :'String', + :'tax' => :'Integer', + :'tax_rounding_method' => :'String', + :'reduce_tax_rate' => :'Integer', + :'shop_logo_url' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'contract_term', + :'hojin', + :'hojin_kana', + :'fax', + :'title_short', + :'shop_mail_2', + :'shop_logo_url' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetShop200ResponseShop` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetShop200ResponseShop`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'state') + self.state = attributes[:'state'] + end + + if attributes.key?(:'domain_plan') + self.domain_plan = attributes[:'domain_plan'] + end + + if attributes.key?(:'contract_plan') + self.contract_plan = attributes[:'contract_plan'] + end + + if attributes.key?(:'contract_start_date') + self.contract_start_date = attributes[:'contract_start_date'] + end + + if attributes.key?(:'contract_end_date') + self.contract_end_date = attributes[:'contract_end_date'] + end + + if attributes.key?(:'contract_term') + self.contract_term = attributes[:'contract_term'] + end + + if attributes.key?(:'last_login_date') + self.last_login_date = attributes[:'last_login_date'] + end + + if attributes.key?(:'setup_date') + self.setup_date = attributes[:'setup_date'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'url') + self.url = attributes[:'url'] + end + + if attributes.key?(:'open_state') + self.open_state = attributes[:'open_state'] + end + + if attributes.key?(:'mobile_open_state') + self.mobile_open_state = attributes[:'mobile_open_state'] + end + + if attributes.key?(:'login_id') + self.login_id = attributes[:'login_id'] + end + + if attributes.key?(:'name1') + self.name1 = attributes[:'name1'] + end + + if attributes.key?(:'name2') + self.name2 = attributes[:'name2'] + end + + if attributes.key?(:'name1_kana') + self.name1_kana = attributes[:'name1_kana'] + end + + if attributes.key?(:'name2_kana') + self.name2_kana = attributes[:'name2_kana'] + end + + if attributes.key?(:'hojin') + self.hojin = attributes[:'hojin'] + end + + if attributes.key?(:'hojin_kana') + self.hojin_kana = attributes[:'hojin_kana'] + end + + if attributes.key?(:'user_mail') + self.user_mail = attributes[:'user_mail'] + end + + if attributes.key?(:'tel') + self.tel = attributes[:'tel'] + end + + if attributes.key?(:'fax') + self.fax = attributes[:'fax'] + end + + if attributes.key?(:'postal') + self.postal = attributes[:'postal'] + end + + if attributes.key?(:'pref_id') + self.pref_id = attributes[:'pref_id'] + end + + if attributes.key?(:'pref_name') + self.pref_name = attributes[:'pref_name'] + end + + if attributes.key?(:'address1') + self.address1 = attributes[:'address1'] + end + + if attributes.key?(:'address2') + self.address2 = attributes[:'address2'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'title_short') + self.title_short = attributes[:'title_short'] + end + + if attributes.key?(:'shop_mail_1') + self.shop_mail_1 = attributes[:'shop_mail_1'] + end + + if attributes.key?(:'shop_mail_2') + self.shop_mail_2 = attributes[:'shop_mail_2'] + end + + if attributes.key?(:'tax_type') + self.tax_type = attributes[:'tax_type'] + end + + if attributes.key?(:'tax') + self.tax = attributes[:'tax'] + end + + if attributes.key?(:'tax_rounding_method') + self.tax_rounding_method = attributes[:'tax_rounding_method'] + end + + if attributes.key?(:'reduce_tax_rate') + self.reduce_tax_rate = attributes[:'reduce_tax_rate'] + end + + if attributes.key?(:'shop_logo_url') + self.shop_logo_url = attributes[:'shop_logo_url'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + state_validator = EnumAttributeValidator.new('String', ["enabled", "suspended", "unsigned"]) + return false unless state_validator.valid?(@state) + domain_plan_validator = EnumAttributeValidator.new('String', ["cmsp_sub_domain", "own_domain", "own_sub_domain"]) + return false unless domain_plan_validator.valid?(@domain_plan) + contract_plan_validator = EnumAttributeValidator.new('String', ["unknown", "economy", "small", "regular", "lolipop", "heteml", "platinum", "goope", "large", "dormant", "free", "premium"]) + return false unless contract_plan_validator.valid?(@contract_plan) + open_state_validator = EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) + return false unless open_state_validator.valid?(@open_state) + mobile_open_state_validator = EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) + return false unless mobile_open_state_validator.valid?(@mobile_open_state) + tax_type_validator = EnumAttributeValidator.new('String', ["excluded", "included"]) + return false unless tax_type_validator.valid?(@tax_type) + tax_rounding_method_validator = EnumAttributeValidator.new('String', ["round_off", "round_down", "round_up"]) + return false unless tax_rounding_method_validator.valid?(@tax_rounding_method) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] state Object to be assigned + def state=(state) + validator = EnumAttributeValidator.new('String', ["enabled", "suspended", "unsigned"]) + unless validator.valid?(state) + fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}." + end + @state = state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] domain_plan Object to be assigned + def domain_plan=(domain_plan) + validator = EnumAttributeValidator.new('String', ["cmsp_sub_domain", "own_domain", "own_sub_domain"]) + unless validator.valid?(domain_plan) + fail ArgumentError, "invalid value for \"domain_plan\", must be one of #{validator.allowable_values}." + end + @domain_plan = domain_plan + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] contract_plan Object to be assigned + def contract_plan=(contract_plan) + validator = EnumAttributeValidator.new('String', ["unknown", "economy", "small", "regular", "lolipop", "heteml", "platinum", "goope", "large", "dormant", "free", "premium"]) + unless validator.valid?(contract_plan) + fail ArgumentError, "invalid value for \"contract_plan\", must be one of #{validator.allowable_values}." + end + @contract_plan = contract_plan + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] open_state Object to be assigned + def open_state=(open_state) + validator = EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) + unless validator.valid?(open_state) + fail ArgumentError, "invalid value for \"open_state\", must be one of #{validator.allowable_values}." + end + @open_state = open_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] mobile_open_state Object to be assigned + def mobile_open_state=(mobile_open_state) + validator = EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) + unless validator.valid?(mobile_open_state) + fail ArgumentError, "invalid value for \"mobile_open_state\", must be one of #{validator.allowable_values}." + end + @mobile_open_state = mobile_open_state + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] tax_type Object to be assigned + def tax_type=(tax_type) + validator = EnumAttributeValidator.new('String', ["excluded", "included"]) + unless validator.valid?(tax_type) + fail ArgumentError, "invalid value for \"tax_type\", must be one of #{validator.allowable_values}." + end + @tax_type = tax_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] tax_rounding_method Object to be assigned + def tax_rounding_method=(tax_rounding_method) + validator = EnumAttributeValidator.new('String', ["round_off", "round_down", "round_up"]) + unless validator.valid?(tax_rounding_method) + fail ArgumentError, "invalid value for \"tax_rounding_method\", must be one of #{validator.allowable_values}." + end + @tax_rounding_method = tax_rounding_method + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + state == o.state && + domain_plan == o.domain_plan && + contract_plan == o.contract_plan && + contract_start_date == o.contract_start_date && + contract_end_date == o.contract_end_date && + contract_term == o.contract_term && + last_login_date == o.last_login_date && + setup_date == o.setup_date && + make_date == o.make_date && + url == o.url && + open_state == o.open_state && + mobile_open_state == o.mobile_open_state && + login_id == o.login_id && + name1 == o.name1 && + name2 == o.name2 && + name1_kana == o.name1_kana && + name2_kana == o.name2_kana && + hojin == o.hojin && + hojin_kana == o.hojin_kana && + user_mail == o.user_mail && + tel == o.tel && + fax == o.fax && + postal == o.postal && + pref_id == o.pref_id && + pref_name == o.pref_name && + address1 == o.address1 && + address2 == o.address2 && + title == o.title && + title_short == o.title_short && + shop_mail_1 == o.shop_mail_1 && + shop_mail_2 == o.shop_mail_2 && + tax_type == o.tax_type && + tax == o.tax && + tax_rounding_method == o.tax_rounding_method && + reduce_tax_rate == o.reduce_tax_rate && + shop_logo_url == o.shop_logo_url + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, state, domain_plan, contract_plan, contract_start_date, contract_end_date, contract_term, last_login_date, setup_date, make_date, url, open_state, mobile_open_state, login_id, name1, name2, name1_kana, name2_kana, hojin, hojin_kana, user_mail, tel, fax, postal, pref_id, pref_name, address1, address2, title, title_short, shop_mail_1, shop_mail_2, tax_type, tax, tax_rounding_method, reduce_tax_rate, shop_logo_url].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_stocks200_response.rb b/lib/color_me_shop/models/get_stocks200_response.rb new file mode 100644 index 0000000..c33bffc --- /dev/null +++ b/lib/color_me_shop/models/get_stocks200_response.rb @@ -0,0 +1,225 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetStocks200Response + attr_accessor :stocks + + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'stocks' => :'stocks', + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'stocks' => :'Array', + :'meta' => :'GetSales200ResponseMeta' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetStocks200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetStocks200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'stocks') + if (value = attributes[:'stocks']).is_a?(Array) + self.stocks = value + end + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + stocks == o.stocks && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [stocks, meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_stocks200_response_stocks_inner.rb b/lib/color_me_shop/models/get_stocks200_response_stocks_inner.rb new file mode 100644 index 0000000..17d71f4 --- /dev/null +++ b/lib/color_me_shop/models/get_stocks200_response_stocks_inner.rb @@ -0,0 +1,647 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetStocks200ResponseStocksInner + # ショップアカウントID + attr_accessor :account_id + + # 商品ID + attr_accessor :product_id + + # 商品名 + attr_accessor :name + + # オプション1の値 + attr_accessor :option1_value + + # オプション2の値 + attr_accessor :option2_value + + # 在庫数 + attr_accessor :stocks + + # 残りわずかとなる在庫数 + attr_accessor :few_num + + # 型番 + attr_accessor :model_number + + # オプションの型番 + attr_accessor :variant_model_number + + attr_accessor :category + + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + attr_accessor :display_state + + # 販売価格 + attr_accessor :sales_price + + # 定価 + attr_accessor :price + + # 会員価格 + attr_accessor :members_price + + # 原価 + attr_accessor :cost + + # 個別送料 + attr_accessor :delivery_charge + + # クール便の追加料金 + attr_accessor :cool_charge + + # 最小購入数量 + attr_accessor :min_num + + # 最大購入数量 + attr_accessor :max_num + + # 掲載開始時刻 + attr_accessor :sale_start_date + + # 掲載終了時刻 + attr_accessor :sale_end_date + + # 単位 + attr_accessor :unit + + # 重量(グラム単位) + attr_accessor :weight + + # 売り切れているときもショップに表示するか + attr_accessor :soldout_display + + # 表示順 + attr_accessor :sort + + # 簡易説明 + attr_accessor :simple_expl + + # 商品説明 + attr_accessor :expl + + # フィーチャーフォン向けショップの商品説明 + attr_accessor :mobile_expl + + # スマホ向けショップの商品説明 + attr_accessor :smartphone_expl + + # 商品作成日時 + attr_accessor :make_date + + # 商品更新日時 + attr_accessor :update_date + + # 備考 + attr_accessor :memo + + # メインの商品画像URL + attr_accessor :image_url + + # メインの商品画像のモバイル用URL + attr_accessor :mobile_image_url + + # メインの商品画像のサムネイルURL + attr_accessor :thumbnail_image_url + + # メインの商品画像以外の3つの画像に関する、PC用とモバイル用の画像URL + attr_accessor :images + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id', + :'product_id' => :'product_id', + :'name' => :'name', + :'option1_value' => :'option1_value', + :'option2_value' => :'option2_value', + :'stocks' => :'stocks', + :'few_num' => :'few_num', + :'model_number' => :'model_number', + :'variant_model_number' => :'variant_model_number', + :'category' => :'category', + :'display_state' => :'display_state', + :'sales_price' => :'sales_price', + :'price' => :'price', + :'members_price' => :'members_price', + :'cost' => :'cost', + :'delivery_charge' => :'delivery_charge', + :'cool_charge' => :'cool_charge', + :'min_num' => :'min_num', + :'max_num' => :'max_num', + :'sale_start_date' => :'sale_start_date', + :'sale_end_date' => :'sale_end_date', + :'unit' => :'unit', + :'weight' => :'weight', + :'soldout_display' => :'soldout_display', + :'sort' => :'sort', + :'simple_expl' => :'simple_expl', + :'expl' => :'expl', + :'mobile_expl' => :'mobile_expl', + :'smartphone_expl' => :'smartphone_expl', + :'make_date' => :'make_date', + :'update_date' => :'update_date', + :'memo' => :'memo', + :'image_url' => :'image_url', + :'mobile_image_url' => :'mobile_image_url', + :'thumbnail_image_url' => :'thumbnail_image_url', + :'images' => :'images' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'product_id' => :'Integer', + :'name' => :'String', + :'option1_value' => :'String', + :'option2_value' => :'String', + :'stocks' => :'Integer', + :'few_num' => :'Integer', + :'model_number' => :'String', + :'variant_model_number' => :'String', + :'category' => :'GetProducts200ResponseProductsInnerCategory', + :'display_state' => :'String', + :'sales_price' => :'Integer', + :'price' => :'Integer', + :'members_price' => :'Integer', + :'cost' => :'Integer', + :'delivery_charge' => :'Integer', + :'cool_charge' => :'Integer', + :'min_num' => :'Integer', + :'max_num' => :'Integer', + :'sale_start_date' => :'Integer', + :'sale_end_date' => :'Integer', + :'unit' => :'String', + :'weight' => :'Integer', + :'soldout_display' => :'Boolean', + :'sort' => :'Integer', + :'simple_expl' => :'String', + :'expl' => :'String', + :'mobile_expl' => :'String', + :'smartphone_expl' => :'String', + :'make_date' => :'Integer', + :'update_date' => :'Integer', + :'memo' => :'String', + :'image_url' => :'String', + :'mobile_image_url' => :'String', + :'thumbnail_image_url' => :'String', + :'images' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'option1_value', + :'option2_value', + :'stocks', + :'few_num', + :'model_number', + :'variant_model_number', + :'category', + :'sales_price', + :'price', + :'members_price', + :'cost', + :'delivery_charge', + :'cool_charge', + :'min_num', + :'max_num', + :'sale_start_date', + :'sale_end_date', + :'unit', + :'weight', + :'sort', + :'simple_expl', + :'expl', + :'mobile_expl', + :'smartphone_expl', + :'memo', + :'image_url', + :'mobile_image_url', + :'thumbnail_image_url', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetStocks200ResponseStocksInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetStocks200ResponseStocksInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'option1_value') + self.option1_value = attributes[:'option1_value'] + end + + if attributes.key?(:'option2_value') + self.option2_value = attributes[:'option2_value'] + end + + if attributes.key?(:'stocks') + self.stocks = attributes[:'stocks'] + end + + if attributes.key?(:'few_num') + self.few_num = attributes[:'few_num'] + end + + if attributes.key?(:'model_number') + self.model_number = attributes[:'model_number'] + end + + if attributes.key?(:'variant_model_number') + self.variant_model_number = attributes[:'variant_model_number'] + end + + if attributes.key?(:'category') + self.category = attributes[:'category'] + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'sales_price') + self.sales_price = attributes[:'sales_price'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'members_price') + self.members_price = attributes[:'members_price'] + end + + if attributes.key?(:'cost') + self.cost = attributes[:'cost'] + end + + if attributes.key?(:'delivery_charge') + self.delivery_charge = attributes[:'delivery_charge'] + end + + if attributes.key?(:'cool_charge') + self.cool_charge = attributes[:'cool_charge'] + end + + if attributes.key?(:'min_num') + self.min_num = attributes[:'min_num'] + end + + if attributes.key?(:'max_num') + self.max_num = attributes[:'max_num'] + end + + if attributes.key?(:'sale_start_date') + self.sale_start_date = attributes[:'sale_start_date'] + end + + if attributes.key?(:'sale_end_date') + self.sale_end_date = attributes[:'sale_end_date'] + end + + if attributes.key?(:'unit') + self.unit = attributes[:'unit'] + end + + if attributes.key?(:'weight') + self.weight = attributes[:'weight'] + end + + if attributes.key?(:'soldout_display') + self.soldout_display = attributes[:'soldout_display'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'simple_expl') + self.simple_expl = attributes[:'simple_expl'] + end + + if attributes.key?(:'expl') + self.expl = attributes[:'expl'] + end + + if attributes.key?(:'mobile_expl') + self.mobile_expl = attributes[:'mobile_expl'] + end + + if attributes.key?(:'smartphone_expl') + self.smartphone_expl = attributes[:'smartphone_expl'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + + if attributes.key?(:'memo') + self.memo = attributes[:'memo'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'mobile_image_url') + self.mobile_image_url = attributes[:'mobile_image_url'] + end + + if attributes.key?(:'thumbnail_image_url') + self.thumbnail_image_url = attributes[:'thumbnail_image_url'] + end + + if attributes.key?(:'images') + if (value = attributes[:'images']).is_a?(Array) + self.images = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@images.nil? && @images.length > 6 + invalid_properties.push('invalid value for "images", number of items must be less than or equal to 6.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + return false unless display_state_validator.valid?(@display_state) + return false if !@images.nil? && @images.length > 6 + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Custom attribute writer method with validation + # @param [Object] images Value to be assigned + def images=(images) + if images.nil? + fail ArgumentError, 'images cannot be nil' + end + + if images.length > 6 + fail ArgumentError, 'invalid value for "images", number of items must be less than or equal to 6.' + end + + @images = images + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + product_id == o.product_id && + name == o.name && + option1_value == o.option1_value && + option2_value == o.option2_value && + stocks == o.stocks && + few_num == o.few_num && + model_number == o.model_number && + variant_model_number == o.variant_model_number && + category == o.category && + display_state == o.display_state && + sales_price == o.sales_price && + price == o.price && + members_price == o.members_price && + cost == o.cost && + delivery_charge == o.delivery_charge && + cool_charge == o.cool_charge && + min_num == o.min_num && + max_num == o.max_num && + sale_start_date == o.sale_start_date && + sale_end_date == o.sale_end_date && + unit == o.unit && + weight == o.weight && + soldout_display == o.soldout_display && + sort == o.sort && + simple_expl == o.simple_expl && + expl == o.expl && + mobile_expl == o.mobile_expl && + smartphone_expl == o.smartphone_expl && + make_date == o.make_date && + update_date == o.update_date && + memo == o.memo && + image_url == o.image_url && + mobile_image_url == o.mobile_image_url && + thumbnail_image_url == o.thumbnail_image_url && + images == o.images + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_id, product_id, name, option1_value, option2_value, stocks, few_num, model_number, variant_model_number, category, display_state, sales_price, price, members_price, cost, delivery_charge, cool_charge, min_num, max_num, sale_start_date, sale_end_date, unit, weight, soldout_display, sort, simple_expl, expl, mobile_expl, smartphone_expl, make_date, update_date, memo, image_url, mobile_image_url, thumbnail_image_url, images].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/get_stocks200_response_stocks_inner_images_inner.rb b/lib/color_me_shop/models/get_stocks200_response_stocks_inner_images_inner.rb new file mode 100644 index 0000000..30d7e1d --- /dev/null +++ b/lib/color_me_shop/models/get_stocks200_response_stocks_inner_images_inner.rb @@ -0,0 +1,263 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class GetStocks200ResponseStocksInnerImagesInner + # 画像URL + attr_accessor :src + + # 表示順 + attr_accessor :position + + # モバイル用であるか否か + attr_accessor :mobile + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'src' => :'src', + :'position' => :'position', + :'mobile' => :'mobile' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'src' => :'String', + :'position' => :'Integer', + :'mobile' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::GetStocks200ResponseStocksInnerImagesInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::GetStocks200ResponseStocksInnerImagesInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'src') + self.src = attributes[:'src'] + end + + if attributes.key?(:'position') + self.position = attributes[:'position'] + end + + if attributes.key?(:'mobile') + self.mobile = attributes[:'mobile'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@position.nil? && @position > 3 + invalid_properties.push('invalid value for "position", must be smaller than or equal to 3.') + end + + if !@position.nil? && @position < 1 + invalid_properties.push('invalid value for "position", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@position.nil? && @position > 3 + return false if !@position.nil? && @position < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] position Value to be assigned + def position=(position) + if position.nil? + fail ArgumentError, 'position cannot be nil' + end + + if position > 3 + fail ArgumentError, 'invalid value for "position", must be smaller than or equal to 3.' + end + + if position < 1 + fail ArgumentError, 'invalid value for "position", must be greater than or equal to 1.' + end + + @position = position + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + src == o.src && + position == o.position && + mobile == o.mobile + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [src, position, mobile].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/meta.rb b/lib/color_me_shop/models/meta.rb index 1c86d57..fbaafd3 100644 --- a/lib/color_me_shop/models/meta.rb +++ b/lib/color_me_shop/models/meta.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class Meta @@ -32,6 +33,11 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -41,23 +47,36 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::Meta` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::Meta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'total') + if attributes.key?(:'total') self.total = attributes[:'total'] end - if attributes.has_key?(:'limit') + if attributes.key?(:'limit') self.limit = attributes[:'limit'] end - if attributes.has_key?(:'offset') + if attributes.key?(:'offset') self.offset = attributes[:'offset'] end end @@ -65,6 +84,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -72,6 +92,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' true end @@ -92,7 +113,7 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [total, limit, offset].hash end @@ -100,31 +121,34 @@ def hash # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -133,7 +157,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -154,8 +178,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -177,7 +202,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -200,5 +229,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/payment.rb b/lib/color_me_shop/models/payment.rb index e24b0f1..3ee9857 100644 --- a/lib/color_me_shop/models/payment.rb +++ b/lib/color_me_shop/models/payment.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class Payment @@ -32,6 +33,9 @@ class Payment # 説明 attr_accessor :memo + # 説明 + attr_accessor :order_end_note + # フィーチャーフォン向けショップ用の説明 attr_accessor :memo_mobile @@ -41,7 +45,7 @@ class Payment # 決済画像URL attr_accessor :image_url - # 決済タイプを表す数値。 |type|決済| |---|---| |0|代引き| |1|銀行振込| |2|郵便振替| |3|クレジット(ZEUS)| |4|クロネコ@ペイメント| |5|NP後払い| |6|クレジット(イプシロン)| |7|コンビニ決済(イプシロン)| |8|カラーミークレジット| |9|その他決済| |10|ウェブマネー| |11|イーバンクデビット| |12|ネット銀行(イプシロン)| |13|電子マネー(イプシロン)| |14|ATM・コンビニ・ネット銀行決済(ペイジェント)| |15|Do-Link決済(イプシロン)| |16|ペイジー(イプシロン)| |17|後払い.com| |18|ジャパンネット銀行(送料無料キャンペーン)| |19|クロネコwebコレクト| |20|PayPal(イプシロン)| |21|Yahoo!ウォレット(イプシロン)| |22|全額ポイント利用| |23|スマートフォンキャリア決済(イプシロン)| |24|GMO PG マルチペイメントクレジットカード| |25|住信SBIネット銀行(イプシロン)| |26|GMO後払い(イプシロン)| |27|GMO後払い(GMOペイメントサービス)| |28| - | |29|ATM(ペイジー)(ペイジェント)| |30|カード(ペイジェント)| |31|コンビニ番号方式(ペイジェント)| |32|インターネットバンキング(ペイジェント)| |33|PayPal(ペイパル)| |34|SMBC GMO PAYMENTクレジットカード| |35|Amazon Pay| |36|楽天ペイ(オンライン決済)| + # 決済タイプを表す数値。 |type|決済| |---|---| |0|代引き| |1|銀行振込| |2|郵便振替| |3|クレジット(ZEUS)| |4|クロネコ@ペイメント| |5|NP後払い| |6|クレジット(イプシロン)| |7|コンビニ決済(イプシロン)| |8|カラーミークレジット| |9|その他決済| |10|ウェブマネー| |11|イーバンクデビット| |12|ネット銀行(イプシロン)| |13|電子マネー(イプシロン)| |14|ATM・コンビニ・ネット銀行決済(ペイジェント)| |15|Do-Link決済(イプシロン)| |16|ペイジー(イプシロン)| |17|後払い.com| |18|ジャパンネット銀行(送料無料キャンペーン)| |19|クロネコwebコレクト| |20|PayPal(イプシロン)| |21|Yahoo!ウォレット(イプシロン)| |22|全額ポイント利用| |23|スマートフォンキャリア決済(イプシロン)| |24|GMO PG マルチペイメントクレジットカード| |25|住信SBIネット銀行(イプシロン)| |26|GMO後払い(イプシロン)| |27|GMO後払い(GMOペイメントサービス)| |28| - | |29|ATM(ペイジー)(ペイジェント)| |30|カード(ペイジェント)| |31|コンビニ番号方式(ペイジェント)| |32|インターネットバンキング(ペイジェント)| |33|PayPal(ペイパル)| |34|SMBC GMO PAYMENTクレジットカード| |35|Amazon Pay(イプシロン)| |36|楽天ペイ(オンライン決済)| |37|銀行振込(バーチャル口座)(イプシロン)| |38|Amazon Pay(アマゾンペイ)| |39|クレジットカード(SGシステム)| |40|LINE Pay(イプシロン)| |41|PayPal Commerce Platform(ペイパル)| |42|PayPay(イプシロン)| |43|Amazon Pay V2(アマゾンペイ)| |44|Amazon Pay V2(イプシロン)| |45|Square対面決済| attr_accessor :type # 表示設定。`true`なら表示される @@ -56,13 +60,10 @@ class Payment # 決済更新日時 attr_accessor :update_date - # 代引き決済の設定情報。代引き決済の場合のみ存在する attr_accessor :cod - # クレジットカードの設定情報。クレジットカード決済の場合のみ存在する attr_accessor :card - # 銀行振り込みの設定情報。銀行振り込み決済の場合のみ存在する attr_accessor :financial # Attribute mapping from ruby-style variable name to JSON key. @@ -74,6 +75,7 @@ def self.attribute_map :'fee' => :'fee', :'ip_code' => :'ip_code', :'memo' => :'memo', + :'order_end_note' => :'order_end_note', :'memo_mobile' => :'memo_mobile', :'sort' => :'sort', :'image_url' => :'image_url', @@ -88,6 +90,11 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -97,93 +104,118 @@ def self.openapi_types :'fee' => :'Integer', :'ip_code' => :'String', :'memo' => :'String', + :'order_end_note' => :'String', :'memo_mobile' => :'String', :'sort' => :'Integer', :'image_url' => :'String', :'type' => :'Integer', - :'display' => :'BOOLEAN', - :'use_mobile' => :'BOOLEAN', + :'display' => :'Boolean', + :'use_mobile' => :'Boolean', :'make_date' => :'Integer', :'update_date' => :'Integer', - :'cod' => :'Object', - :'card' => :'Object', - :'financial' => :'Object' + :'cod' => :'GetPayments200ResponsePaymentsInnerCod', + :'card' => :'GetPayments200ResponsePaymentsInnerCard', + :'financial' => :'GetPayments200ResponsePaymentsInnerFinancial' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'fee', + :'ip_code', + :'memo', + :'order_end_note', + :'memo_mobile', + :'sort', + :'image_url', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::Payment` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::Payment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'fee') + if attributes.key?(:'fee') self.fee = attributes[:'fee'] end - if attributes.has_key?(:'ip_code') + if attributes.key?(:'ip_code') self.ip_code = attributes[:'ip_code'] end - if attributes.has_key?(:'memo') + if attributes.key?(:'memo') self.memo = attributes[:'memo'] end - if attributes.has_key?(:'memo_mobile') + if attributes.key?(:'order_end_note') + self.order_end_note = attributes[:'order_end_note'] + end + + if attributes.key?(:'memo_mobile') self.memo_mobile = attributes[:'memo_mobile'] end - if attributes.has_key?(:'sort') + if attributes.key?(:'sort') self.sort = attributes[:'sort'] end - if attributes.has_key?(:'image_url') + if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end - if attributes.has_key?(:'type') + if attributes.key?(:'type') self.type = attributes[:'type'] end - if attributes.has_key?(:'display') + if attributes.key?(:'display') self.display = attributes[:'display'] end - if attributes.has_key?(:'use_mobile') + if attributes.key?(:'use_mobile') self.use_mobile = attributes[:'use_mobile'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end - if attributes.has_key?(:'cod') + if attributes.key?(:'cod') self.cod = attributes[:'cod'] end - if attributes.has_key?(:'card') + if attributes.key?(:'card') self.card = attributes[:'card'] end - if attributes.has_key?(:'financial') + if attributes.key?(:'financial') self.financial = attributes[:'financial'] end end @@ -191,6 +223,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if !@type.nil? && @type < 0 invalid_properties.push('invalid value for "type", must be greater than or equal to 0.') @@ -202,6 +235,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' return false if !@type.nil? && @type < 0 true end @@ -209,7 +243,11 @@ def valid? # Custom attribute writer method with validation # @param [Object] type Value to be assigned def type=(type) - if !type.nil? && type < 0 + if type.nil? + fail ArgumentError, 'type cannot be nil' + end + + if type < 0 fail ArgumentError, 'invalid value for "type", must be greater than or equal to 0.' end @@ -227,6 +265,7 @@ def ==(o) fee == o.fee && ip_code == o.ip_code && memo == o.memo && + order_end_note == o.order_end_note && memo_mobile == o.memo_mobile && sort == o.sort && image_url == o.image_url && @@ -247,39 +286,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [id, account_id, name, fee, ip_code, memo, memo_mobile, sort, image_url, type, display, use_mobile, make_date, update_date, cod, card, financial].hash + [id, account_id, name, fee, ip_code, memo, order_end_note, memo_mobile, sort, image_url, type, display, use_mobile, make_date, update_date, cod, card, financial].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -288,7 +330,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -309,8 +351,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -332,7 +375,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -355,5 +402,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/post_customers200_response.rb b/lib/color_me_shop/models/post_customers200_response.rb new file mode 100644 index 0000000..85b9007 --- /dev/null +++ b/lib/color_me_shop/models/post_customers200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PostCustomers200Response + attr_accessor :customer + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer' => :'customer' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'customer' => :'GetSales200ResponseSalesInnerCustomer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PostCustomers200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PostCustomers200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + customer == o.customer + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [customer].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/post_customers_request.rb b/lib/color_me_shop/models/post_customers_request.rb new file mode 100644 index 0000000..58f26af --- /dev/null +++ b/lib/color_me_shop/models/post_customers_request.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PostCustomersRequest + attr_accessor :customer + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'customer' => :'customer' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'customer' => :'PostCustomersRequestCustomer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PostCustomersRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PostCustomersRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'customer') + self.customer = attributes[:'customer'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + customer == o.customer + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [customer].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/post_customers_request_customer.rb b/lib/color_me_shop/models/post_customers_request_customer.rb new file mode 100644 index 0000000..e8627ed --- /dev/null +++ b/lib/color_me_shop/models/post_customers_request_customer.rb @@ -0,0 +1,313 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PostCustomersRequestCustomer + # 購入者氏名 + attr_accessor :name + + # メールアドレス + attr_accessor :mail + + # 都道府県id + attr_accessor :pref_id + + # 住所 + attr_accessor :address1 + + # 住所(建物名など) + attr_accessor :address2 + + # 電話番号 + attr_accessor :tel + + # 郵便番号 + attr_accessor :postal + + # 会員登録をするか否か + attr_accessor :add_member + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'mail' => :'mail', + :'pref_id' => :'pref_id', + :'address1' => :'address1', + :'address2' => :'address2', + :'tel' => :'tel', + :'postal' => :'postal', + :'add_member' => :'add_member' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'mail' => :'String', + :'pref_id' => :'Integer', + :'address1' => :'String', + :'address2' => :'String', + :'tel' => :'String', + :'postal' => :'String', + :'add_member' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PostCustomersRequestCustomer` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PostCustomersRequestCustomer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'mail') + self.mail = attributes[:'mail'] + end + + if attributes.key?(:'pref_id') + self.pref_id = attributes[:'pref_id'] + end + + if attributes.key?(:'address1') + self.address1 = attributes[:'address1'] + end + + if attributes.key?(:'address2') + self.address2 = attributes[:'address2'] + end + + if attributes.key?(:'tel') + self.tel = attributes[:'tel'] + end + + if attributes.key?(:'postal') + self.postal = attributes[:'postal'] + end + + if attributes.key?(:'add_member') + self.add_member = attributes[:'add_member'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@pref_id.nil? && @pref_id > 48 + invalid_properties.push('invalid value for "pref_id", must be smaller than or equal to 48.') + end + + if !@pref_id.nil? && @pref_id < 1 + invalid_properties.push('invalid value for "pref_id", must be greater than or equal to 1.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@pref_id.nil? && @pref_id > 48 + return false if !@pref_id.nil? && @pref_id < 1 + true + end + + # Custom attribute writer method with validation + # @param [Object] pref_id Value to be assigned + def pref_id=(pref_id) + if pref_id.nil? + fail ArgumentError, 'pref_id cannot be nil' + end + + if pref_id > 48 + fail ArgumentError, 'invalid value for "pref_id", must be smaller than or equal to 48.' + end + + if pref_id < 1 + fail ArgumentError, 'invalid value for "pref_id", must be greater than or equal to 1.' + end + + @pref_id = pref_id + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + mail == o.mail && + pref_id == o.pref_id && + address1 == o.address1 && + address2 == o.address2 && + tel == o.tel && + postal == o.postal && + add_member == o.add_member + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, mail, pref_id, address1, address2, tel, postal, add_member].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/post_products200_response.rb b/lib/color_me_shop/models/post_products200_response.rb new file mode 100644 index 0000000..a783548 --- /dev/null +++ b/lib/color_me_shop/models/post_products200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PostProducts200Response + attr_accessor :product + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'product' => :'product' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'product' => :'GetProducts200ResponseProductsInner' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PostProducts200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PostProducts200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + product == o.product + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [product].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/post_products_request.rb b/lib/color_me_shop/models/post_products_request.rb new file mode 100644 index 0000000..a1d8054 --- /dev/null +++ b/lib/color_me_shop/models/post_products_request.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PostProductsRequest + attr_accessor :product + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'product' => :'product' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'product' => :'PostProductsRequestProduct' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PostProductsRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PostProductsRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + product == o.product + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [product].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/post_products_request_product.rb b/lib/color_me_shop/models/post_products_request_product.rb new file mode 100644 index 0000000..19e5ff8 --- /dev/null +++ b/lib/color_me_shop/models/post_products_request_product.rb @@ -0,0 +1,327 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PostProductsRequestProduct + # 商品名 + attr_accessor :name + + # 大カテゴリーID + attr_accessor :category_id_big + + # 販売価格 フリープランを利用しているショップの場合、最低価格は100円です。 + attr_accessor :sales_price + + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + attr_accessor :display_state + + # `true` の場合は軽減税率対象 + attr_accessor :tax_reduced + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'category_id_big' => :'category_id_big', + :'sales_price' => :'sales_price', + :'display_state' => :'display_state', + :'tax_reduced' => :'tax_reduced' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'category_id_big' => :'Integer', + :'sales_price' => :'Integer', + :'display_state' => :'String', + :'tax_reduced' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PostProductsRequestProduct` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PostProductsRequestProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'category_id_big') + self.category_id_big = attributes[:'category_id_big'] + end + + if attributes.key?(:'sales_price') + self.sales_price = attributes[:'sales_price'] + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'tax_reduced') + self.tax_reduced = attributes[:'tax_reduced'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@name.nil? && @name.to_s.length > 100 + invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.') + end + + if !@sales_price.nil? && @sales_price < 0 + invalid_properties.push('invalid value for "sales_price", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@name.nil? && @name.to_s.length > 100 + return false if !@sales_price.nil? && @sales_price < 0 + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + return false unless display_state_validator.valid?(@display_state) + true + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + if name.to_s.length > 100 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] sales_price Value to be assigned + def sales_price=(sales_price) + if sales_price.nil? + fail ArgumentError, 'sales_price cannot be nil' + end + + if sales_price < 0 + fail ArgumentError, 'invalid value for "sales_price", must be greater than or equal to 0.' + end + + @sales_price = sales_price + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + category_id_big == o.category_id_big && + sales_price == o.sales_price && + display_state == o.display_state && + tax_reduced == o.tax_reduced + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, category_id_big, sales_price, display_state, tax_reduced].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/product.rb b/lib/color_me_shop/models/product.rb index dea1ece..3515456 100644 --- a/lib/color_me_shop/models/product.rb +++ b/lib/color_me_shop/models/product.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class Product @@ -40,24 +41,45 @@ class Product # 商品が属するグループのIDの配列 attr_accessor :group_ids - # 掲載設定 + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 attr_accessor :display_state # 販売価格 attr_accessor :sales_price + # 消費税込販売価格 + attr_accessor :sales_price_including_tax + + # 消費税額 + attr_accessor :sales_price_tax + # 定価 attr_accessor :price # 会員価格 attr_accessor :members_price + # 消費税込会員価格 + attr_accessor :members_price_including_tax + + # 会員価格の消費税額 + attr_accessor :members_price_tax + # 原価 attr_accessor :cost # 個別送料 attr_accessor :delivery_charge + # クール便の追加料金 + attr_accessor :cool_charge + + # 利用不可決済方法の配列 + attr_accessor :unavailable_payment_ids + + # 利用不可配送方法の配列 + attr_accessor :unavailable_delivery_ids + # 最小購入数量 attr_accessor :min_num @@ -121,9 +143,21 @@ class Product # オプションのバリエーション一覧 attr_accessor :variants - # おすすめ商品情報 + # おすすめ商品情報 ※おすすめ商品種別が「3: 新着商品」の情報は、「[新着商品管理](https://shop-pro.jp/manual/new_item_lst)」が「手動モード」の場合のみ取得できます。 attr_accessor :pickups + # デジタルコンテンツ商品かどうか + attr_accessor :digital_conent + + # 定期購入商品かどうか + attr_accessor :regular_purchase + + # 軽減税率対象なら `true` + attr_accessor :tax_reduced + + # 配送不要商品なら `true` + attr_accessor :without_shipping + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -160,10 +194,17 @@ def self.attribute_map :'group_ids' => :'group_ids', :'display_state' => :'display_state', :'sales_price' => :'sales_price', + :'sales_price_including_tax' => :'sales_price_including_tax', + :'sales_price_tax' => :'sales_price_tax', :'price' => :'price', :'members_price' => :'members_price', + :'members_price_including_tax' => :'members_price_including_tax', + :'members_price_tax' => :'members_price_tax', :'cost' => :'cost', :'delivery_charge' => :'delivery_charge', + :'cool_charge' => :'cool_charge', + :'unavailable_payment_ids' => :'unavailable_payment_ids', + :'unavailable_delivery_ids' => :'unavailable_delivery_ids', :'min_num' => :'min_num', :'max_num' => :'max_num', :'sale_start_date' => :'sale_start_date', @@ -185,10 +226,19 @@ def self.attribute_map :'images' => :'images', :'options' => :'options', :'variants' => :'variants', - :'pickups' => :'pickups' + :'pickups' => :'pickups', + :'digital_conent' => :'digital_conent', + :'regular_purchase' => :'regular_purchase', + :'tax_reduced' => :'tax_reduced', + :'without_shipping' => :'without_shipping' } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -196,24 +246,31 @@ def self.openapi_types :'id' => :'Integer', :'name' => :'String', :'stocks' => :'Integer', - :'stock_managed' => :'BOOLEAN', + :'stock_managed' => :'Boolean', :'few_num' => :'Integer', :'model_number' => :'String', - :'category' => :'Object', + :'category' => :'GetProducts200ResponseProductsInnerCategory', :'group_ids' => :'Array', :'display_state' => :'String', :'sales_price' => :'Integer', + :'sales_price_including_tax' => :'Integer', + :'sales_price_tax' => :'Integer', :'price' => :'Integer', :'members_price' => :'Integer', + :'members_price_including_tax' => :'Integer', + :'members_price_tax' => :'Integer', :'cost' => :'Integer', :'delivery_charge' => :'Integer', + :'cool_charge' => :'Integer', + :'unavailable_payment_ids' => :'Array', + :'unavailable_delivery_ids' => :'Array', :'min_num' => :'Integer', :'max_num' => :'Integer', :'sale_start_date' => :'Integer', :'sale_end_date' => :'Integer', :'unit' => :'String', :'weight' => :'Integer', - :'soldout_display' => :'BOOLEAN', + :'soldout_display' => :'Boolean', :'sort' => :'Integer', :'simple_expl' => :'String', :'expl' => :'String', @@ -225,205 +282,335 @@ def self.openapi_types :'image_url' => :'String', :'mobile_image_url' => :'String', :'thumbnail_image_url' => :'String', - :'images' => :'Array', - :'options' => :'Array', - :'variants' => :'Array', - :'pickups' => :'Array' + :'images' => :'Array', + :'options' => :'Array', + :'variants' => :'Array', + :'pickups' => :'Array', + :'digital_conent' => :'Boolean', + :'regular_purchase' => :'Boolean', + :'tax_reduced' => :'Boolean', + :'without_shipping' => :'Boolean' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'stocks', + :'few_num', + :'model_number', + :'category', + :'sales_price', + :'price', + :'members_price', + :'cost', + :'delivery_charge', + :'cool_charge', + :'min_num', + :'max_num', + :'sale_start_date', + :'sale_end_date', + :'unit', + :'weight', + :'sort', + :'simple_expl', + :'expl', + :'mobile_expl', + :'smartphone_expl', + :'memo', + :'image_url', + :'mobile_image_url', + :'thumbnail_image_url', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::Product` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::Product`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'stocks') + if attributes.key?(:'stocks') self.stocks = attributes[:'stocks'] end - if attributes.has_key?(:'stock_managed') + if attributes.key?(:'stock_managed') self.stock_managed = attributes[:'stock_managed'] end - if attributes.has_key?(:'few_num') + if attributes.key?(:'few_num') self.few_num = attributes[:'few_num'] end - if attributes.has_key?(:'model_number') + if attributes.key?(:'model_number') self.model_number = attributes[:'model_number'] end - if attributes.has_key?(:'category') + if attributes.key?(:'category') self.category = attributes[:'category'] end - if attributes.has_key?(:'group_ids') + if attributes.key?(:'group_ids') if (value = attributes[:'group_ids']).is_a?(Array) self.group_ids = value end end - if attributes.has_key?(:'display_state') + if attributes.key?(:'display_state') self.display_state = attributes[:'display_state'] end - if attributes.has_key?(:'sales_price') + if attributes.key?(:'sales_price') self.sales_price = attributes[:'sales_price'] end - if attributes.has_key?(:'price') + if attributes.key?(:'sales_price_including_tax') + self.sales_price_including_tax = attributes[:'sales_price_including_tax'] + end + + if attributes.key?(:'sales_price_tax') + self.sales_price_tax = attributes[:'sales_price_tax'] + end + + if attributes.key?(:'price') self.price = attributes[:'price'] end - if attributes.has_key?(:'members_price') + if attributes.key?(:'members_price') self.members_price = attributes[:'members_price'] end - if attributes.has_key?(:'cost') + if attributes.key?(:'members_price_including_tax') + self.members_price_including_tax = attributes[:'members_price_including_tax'] + end + + if attributes.key?(:'members_price_tax') + self.members_price_tax = attributes[:'members_price_tax'] + end + + if attributes.key?(:'cost') self.cost = attributes[:'cost'] end - if attributes.has_key?(:'delivery_charge') + if attributes.key?(:'delivery_charge') self.delivery_charge = attributes[:'delivery_charge'] end - if attributes.has_key?(:'min_num') + if attributes.key?(:'cool_charge') + self.cool_charge = attributes[:'cool_charge'] + end + + if attributes.key?(:'unavailable_payment_ids') + if (value = attributes[:'unavailable_payment_ids']).is_a?(Array) + self.unavailable_payment_ids = value + end + end + + if attributes.key?(:'unavailable_delivery_ids') + if (value = attributes[:'unavailable_delivery_ids']).is_a?(Array) + self.unavailable_delivery_ids = value + end + end + + if attributes.key?(:'min_num') self.min_num = attributes[:'min_num'] end - if attributes.has_key?(:'max_num') + if attributes.key?(:'max_num') self.max_num = attributes[:'max_num'] end - if attributes.has_key?(:'sale_start_date') + if attributes.key?(:'sale_start_date') self.sale_start_date = attributes[:'sale_start_date'] end - if attributes.has_key?(:'sale_end_date') + if attributes.key?(:'sale_end_date') self.sale_end_date = attributes[:'sale_end_date'] end - if attributes.has_key?(:'unit') + if attributes.key?(:'unit') self.unit = attributes[:'unit'] end - if attributes.has_key?(:'weight') + if attributes.key?(:'weight') self.weight = attributes[:'weight'] end - if attributes.has_key?(:'soldout_display') + if attributes.key?(:'soldout_display') self.soldout_display = attributes[:'soldout_display'] end - if attributes.has_key?(:'sort') + if attributes.key?(:'sort') self.sort = attributes[:'sort'] end - if attributes.has_key?(:'simple_expl') + if attributes.key?(:'simple_expl') self.simple_expl = attributes[:'simple_expl'] end - if attributes.has_key?(:'expl') + if attributes.key?(:'expl') self.expl = attributes[:'expl'] end - if attributes.has_key?(:'mobile_expl') + if attributes.key?(:'mobile_expl') self.mobile_expl = attributes[:'mobile_expl'] end - if attributes.has_key?(:'smartphone_expl') + if attributes.key?(:'smartphone_expl') self.smartphone_expl = attributes[:'smartphone_expl'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end - if attributes.has_key?(:'memo') + if attributes.key?(:'memo') self.memo = attributes[:'memo'] end - if attributes.has_key?(:'image_url') + if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end - if attributes.has_key?(:'mobile_image_url') + if attributes.key?(:'mobile_image_url') self.mobile_image_url = attributes[:'mobile_image_url'] end - if attributes.has_key?(:'thumbnail_image_url') + if attributes.key?(:'thumbnail_image_url') self.thumbnail_image_url = attributes[:'thumbnail_image_url'] end - if attributes.has_key?(:'images') + if attributes.key?(:'images') if (value = attributes[:'images']).is_a?(Array) self.images = value end end - if attributes.has_key?(:'options') + if attributes.key?(:'options') if (value = attributes[:'options']).is_a?(Array) self.options = value end end - if attributes.has_key?(:'variants') + if attributes.key?(:'variants') if (value = attributes[:'variants']).is_a?(Array) self.variants = value end end - if attributes.has_key?(:'pickups') + if attributes.key?(:'pickups') if (value = attributes[:'pickups']).is_a?(Array) self.pickups = value end end + + if attributes.key?(:'digital_conent') + self.digital_conent = attributes[:'digital_conent'] + end + + if attributes.key?(:'regular_purchase') + self.regular_purchase = attributes[:'regular_purchase'] + end + + if attributes.key?(:'tax_reduced') + self.tax_reduced = attributes[:'tax_reduced'] + end + + if attributes.key?(:'without_shipping') + self.without_shipping = attributes[:'without_shipping'] + end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new + if !@group_ids.nil? && @group_ids.length < 0 + invalid_properties.push('invalid value for "group_ids", number of items must be greater than or equal to 0.') + end + + if !@images.nil? && @images.length > 6 + invalid_properties.push('invalid value for "images", number of items must be less than or equal to 6.') + end + invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - display_state_validator = EnumAttributeValidator.new('String', ['showing', 'hidden', 'showing_for_members', 'sale_for_members']) + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@group_ids.nil? && @group_ids.length < 0 + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) return false unless display_state_validator.valid?(@display_state) + return false if !@images.nil? && @images.length > 6 true end + # Custom attribute writer method with validation + # @param [Object] group_ids Value to be assigned + def group_ids=(group_ids) + if group_ids.nil? + fail ArgumentError, 'group_ids cannot be nil' + end + + if group_ids.length < 0 + fail ArgumentError, 'invalid value for "group_ids", number of items must be greater than or equal to 0.' + end + + @group_ids = group_ids + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] display_state Object to be assigned def display_state=(display_state) - validator = EnumAttributeValidator.new('String', ['showing', 'hidden', 'showing_for_members', 'sale_for_members']) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) unless validator.valid?(display_state) - fail ArgumentError, 'invalid value for "display_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." end @display_state = display_state end + # Custom attribute writer method with validation + # @param [Object] images Value to be assigned + def images=(images) + if images.nil? + fail ArgumentError, 'images cannot be nil' + end + + if images.length > 6 + fail ArgumentError, 'invalid value for "images", number of items must be less than or equal to 6.' + end + + @images = images + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -440,10 +627,17 @@ def ==(o) group_ids == o.group_ids && display_state == o.display_state && sales_price == o.sales_price && + sales_price_including_tax == o.sales_price_including_tax && + sales_price_tax == o.sales_price_tax && price == o.price && members_price == o.members_price && + members_price_including_tax == o.members_price_including_tax && + members_price_tax == o.members_price_tax && cost == o.cost && delivery_charge == o.delivery_charge && + cool_charge == o.cool_charge && + unavailable_payment_ids == o.unavailable_payment_ids && + unavailable_delivery_ids == o.unavailable_delivery_ids && min_num == o.min_num && max_num == o.max_num && sale_start_date == o.sale_start_date && @@ -465,7 +659,11 @@ def ==(o) images == o.images && options == o.options && variants == o.variants && - pickups == o.pickups + pickups == o.pickups && + digital_conent == o.digital_conent && + regular_purchase == o.regular_purchase && + tax_reduced == o.tax_reduced && + without_shipping == o.without_shipping end # @see the `==` method @@ -475,39 +673,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [account_id, id, name, stocks, stock_managed, few_num, model_number, category, group_ids, display_state, sales_price, price, members_price, cost, delivery_charge, min_num, max_num, sale_start_date, sale_end_date, unit, weight, soldout_display, sort, simple_expl, expl, mobile_expl, smartphone_expl, make_date, update_date, memo, image_url, mobile_image_url, thumbnail_image_url, images, options, variants, pickups].hash + [account_id, id, name, stocks, stock_managed, few_num, model_number, category, group_ids, display_state, sales_price, sales_price_including_tax, sales_price_tax, price, members_price, members_price_including_tax, members_price_tax, cost, delivery_charge, cool_charge, unavailable_payment_ids, unavailable_delivery_ids, min_num, max_num, sale_start_date, sale_end_date, unit, weight, soldout_display, sort, simple_expl, expl, mobile_expl, smartphone_expl, make_date, update_date, memo, image_url, mobile_image_url, thumbnail_image_url, images, options, variants, pickups, digital_conent, regular_purchase, tax_reduced, without_shipping].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -516,7 +717,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -537,8 +738,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -560,7 +762,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -583,5 +789,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/product_category.rb b/lib/color_me_shop/models/product_category.rb index f7a796c..6e61005 100644 --- a/lib/color_me_shop/models/product_category.rb +++ b/lib/color_me_shop/models/product_category.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class ProductCategory @@ -35,7 +36,7 @@ class ProductCategory # 表示順 attr_accessor :sort - # 掲載設定 + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `members_only`: 会員にのみ掲載 attr_accessor :display_state # 商品カテゴリー作成日時 @@ -44,7 +45,7 @@ class ProductCategory # 商品カテゴリー更新日時 attr_accessor :update_date - # 子カテゴリー情報。子カテゴリーのことを表している場合はこのキーはレスポンスに含まれない + # 子カテゴリー attr_accessor :children class EnumAttributeValidator @@ -86,6 +87,11 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -99,59 +105,75 @@ def self.openapi_types :'display_state' => :'String', :'make_date' => :'Integer', :'update_date' => :'Integer', - :'children' => :'Array' + :'children' => :'Array' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'expl', + :'sort', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ProductCategory` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ProductCategory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id_big') + if attributes.key?(:'id_big') self.id_big = attributes[:'id_big'] end - if attributes.has_key?(:'id_small') + if attributes.key?(:'id_small') self.id_small = attributes[:'id_small'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'image_url') + if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end - if attributes.has_key?(:'expl') + if attributes.key?(:'expl') self.expl = attributes[:'expl'] end - if attributes.has_key?(:'sort') + if attributes.key?(:'sort') self.sort = attributes[:'sort'] end - if attributes.has_key?(:'display_state') + if attributes.key?(:'display_state') self.display_state = attributes[:'display_state'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end - if attributes.has_key?(:'children') + if attributes.key?(:'children') if (value = attributes[:'children']).is_a?(Array) self.children = value end @@ -161,6 +183,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -168,7 +191,8 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - display_state_validator = EnumAttributeValidator.new('String', ['showing', 'hidden', 'showing_for_members', 'sale_for_members']) + warn '[DEPRECATED] the `valid?` method is obsolete' + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) return false unless display_state_validator.valid?(@display_state) true end @@ -176,9 +200,9 @@ def valid? # Custom attribute writer method checking allowed values (enum). # @param [Object] display_state Object to be assigned def display_state=(display_state) - validator = EnumAttributeValidator.new('String', ['showing', 'hidden', 'showing_for_members', 'sale_for_members']) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) unless validator.valid?(display_state) - fail ArgumentError, 'invalid value for "display_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." end @display_state = display_state end @@ -208,7 +232,7 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [id_big, id_small, account_id, name, image_url, expl, sort, display_state, make_date, update_date, children].hash end @@ -216,31 +240,34 @@ def hash # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -249,7 +276,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -270,8 +297,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -293,7 +321,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -316,5 +348,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/product_category_child.rb b/lib/color_me_shop/models/product_category_child.rb new file mode 100644 index 0000000..d053800 --- /dev/null +++ b/lib/color_me_shop/models/product_category_child.rb @@ -0,0 +1,342 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class ProductCategoryChild + # 大カテゴリーID + attr_accessor :id_big + + # 小カテゴリーID。大カテゴリーのことを表している場合は0 + attr_accessor :id_small + + # ショップアカウントID + attr_accessor :account_id + + # 商品カテゴリー名 + attr_accessor :name + + # 商品カテゴリー画像URL + attr_accessor :image_url + + # 商品カテゴリー説明 + attr_accessor :expl + + # 表示順 + attr_accessor :sort + + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `members_only`: 会員にのみ掲載 + attr_accessor :display_state + + # 商品カテゴリー作成日時 + attr_accessor :make_date + + # 商品カテゴリー更新日時 + attr_accessor :update_date + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id_big' => :'id_big', + :'id_small' => :'id_small', + :'account_id' => :'account_id', + :'name' => :'name', + :'image_url' => :'image_url', + :'expl' => :'expl', + :'sort' => :'sort', + :'display_state' => :'display_state', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id_big' => :'Integer', + :'id_small' => :'Integer', + :'account_id' => :'String', + :'name' => :'String', + :'image_url' => :'String', + :'expl' => :'String', + :'sort' => :'Integer', + :'display_state' => :'String', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'expl', + :'sort', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ProductCategoryChild` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ProductCategoryChild`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id_big') + self.id_big = attributes[:'id_big'] + end + + if attributes.key?(:'id_small') + self.id_small = attributes[:'id_small'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'image_url') + self.image_url = attributes[:'image_url'] + end + + if attributes.key?(:'expl') + self.expl = attributes[:'expl'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + return false unless display_state_validator.valid?(@display_state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id_big == o.id_big && + id_small == o.id_small && + account_id == o.account_id && + name == o.name && + image_url == o.image_url && + expl == o.expl && + sort == o.sort && + display_state == o.display_state && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id_big, id_small, account_id, name, image_url, expl, sort, display_state, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/product_create_request.rb b/lib/color_me_shop/models/product_create_request.rb new file mode 100644 index 0000000..57acb8f --- /dev/null +++ b/lib/color_me_shop/models/product_create_request.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class ProductCreateRequest + attr_accessor :product + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'product' => :'product' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'product' => :'PostProductsRequestProduct' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ProductCreateRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ProductCreateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + product == o.product + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [product].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/product_group.rb b/lib/color_me_shop/models/product_group.rb index ffc3316..d6cb7af 100644 --- a/lib/color_me_shop/models/product_group.rb +++ b/lib/color_me_shop/models/product_group.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class ProductGroup @@ -32,9 +33,12 @@ class ProductGroup # 表示順 attr_accessor :sort - # 掲載設定 + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 attr_accessor :display_state + # 親の商品グループID + attr_accessor :parent_group_id + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -66,10 +70,16 @@ def self.attribute_map :'image_url' => :'image_url', :'expl' => :'expl', :'sort' => :'sort', - :'display_state' => :'display_state' + :'display_state' => :'display_state', + :'parent_group_id' => :'parent_group_id' } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -79,50 +89,72 @@ def self.openapi_types :'image_url' => :'String', :'expl' => :'String', :'sort' => :'Integer', - :'display_state' => :'String' + :'display_state' => :'String', + :'parent_group_id' => :'Integer' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'image_url', + :'expl', + :'sort', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ProductGroup` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ProductGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'image_url') + if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end - if attributes.has_key?(:'expl') + if attributes.key?(:'expl') self.expl = attributes[:'expl'] end - if attributes.has_key?(:'sort') + if attributes.key?(:'sort') self.sort = attributes[:'sort'] end - if attributes.has_key?(:'display_state') + if attributes.key?(:'display_state') self.display_state = attributes[:'display_state'] end + + if attributes.key?(:'parent_group_id') + self.parent_group_id = attributes[:'parent_group_id'] + end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -130,7 +162,8 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - display_state_validator = EnumAttributeValidator.new('String', ['showing', 'hidden', 'showing_for_members', 'sale_for_members']) + warn '[DEPRECATED] the `valid?` method is obsolete' + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) return false unless display_state_validator.valid?(@display_state) true end @@ -138,9 +171,9 @@ def valid? # Custom attribute writer method checking allowed values (enum). # @param [Object] display_state Object to be assigned def display_state=(display_state) - validator = EnumAttributeValidator.new('String', ['showing', 'hidden', 'showing_for_members', 'sale_for_members']) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) unless validator.valid?(display_state) - fail ArgumentError, 'invalid value for "display_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." end @display_state = display_state end @@ -156,7 +189,8 @@ def ==(o) image_url == o.image_url && expl == o.expl && sort == o.sort && - display_state == o.display_state + display_state == o.display_state && + parent_group_id == o.parent_group_id end # @see the `==` method @@ -166,39 +200,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [id, account_id, name, image_url, expl, sort, display_state].hash + [id, account_id, name, image_url, expl, sort, display_state, parent_group_id].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -207,7 +244,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -228,8 +265,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -251,7 +289,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -274,5 +316,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/product_option.rb b/lib/color_me_shop/models/product_option.rb index 8e19a90..f4aca75 100644 --- a/lib/color_me_shop/models/product_option.rb +++ b/lib/color_me_shop/models/product_option.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class ProductOption @@ -48,6 +49,11 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -61,41 +67,54 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ProductOption` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ProductOption`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'product_id') + if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'values') + if attributes.key?(:'values') if (value = attributes[:'values']).is_a?(Array) self.values = value end end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end end @@ -103,6 +122,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -110,6 +130,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' true end @@ -134,7 +155,7 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [id, product_id, account_id, name, values, make_date, update_date].hash end @@ -142,31 +163,34 @@ def hash # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -175,7 +199,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -196,8 +220,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -219,7 +244,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -242,5 +271,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/product_pickup.rb b/lib/color_me_shop/models/product_pickup.rb index 5cc7141..e469b66 100644 --- a/lib/color_me_shop/models/product_pickup.rb +++ b/lib/color_me_shop/models/product_pickup.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class ProductPickup @@ -44,6 +45,11 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -56,35 +62,49 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order_num', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ProductPickup` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ProductPickup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'pickup_type') + if attributes.key?(:'pickup_type') self.pickup_type = attributes[:'pickup_type'] end - if attributes.has_key?(:'product_id') + if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'order_num') + if attributes.key?(:'order_num') self.order_num = attributes[:'order_num'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end end @@ -92,6 +112,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -99,6 +120,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' true end @@ -122,7 +144,7 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [pickup_type, product_id, account_id, order_num, make_date, update_date].hash end @@ -130,31 +152,34 @@ def hash # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -163,7 +188,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -184,8 +209,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -207,7 +233,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -230,5 +260,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/product_update_request.rb b/lib/color_me_shop/models/product_update_request.rb index f2a0a39..55be634 100644 --- a/lib/color_me_shop/models/product_update_request.rb +++ b/lib/color_me_shop/models/product_update_request.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class ProductUpdateRequest @@ -23,22 +24,40 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { - :'product' => :'Object' + :'product' => :'UpdateProductRequestProduct' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ProductUpdateRequest` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ProductUpdateRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'product') + if attributes.key?(:'product') self.product = attributes[:'product'] end end @@ -46,6 +65,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -53,6 +73,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' true end @@ -71,7 +92,7 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash [product].hash end @@ -79,31 +100,34 @@ def hash # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -112,7 +136,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -133,8 +157,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -156,7 +181,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -179,5 +208,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/product_variant.rb b/lib/color_me_shop/models/product_variant.rb index ce0720c..0bb4d51 100644 --- a/lib/color_me_shop/models/product_variant.rb +++ b/lib/color_me_shop/models/product_variant.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class ProductVariant @@ -41,9 +42,21 @@ class ProductVariant # 販売価格 attr_accessor :option_price + # 消費税込販売価格 + attr_accessor :option_price_including_tax + + # 消費税額 + attr_accessor :option_price_tax + # 会員価格 attr_accessor :option_members_price + # 消費税込会員価格 + attr_accessor :option_members_price_including_tax + + # 会員価格の消費税額 + attr_accessor :option_members_price_tax + # オプション作成日時 attr_accessor :make_date @@ -62,12 +75,21 @@ def self.attribute_map :'few_num' => :'few_num', :'model_number' => :'model_number', :'option_price' => :'option_price', + :'option_price_including_tax' => :'option_price_including_tax', + :'option_price_tax' => :'option_price_tax', :'option_members_price' => :'option_members_price', + :'option_members_price_including_tax' => :'option_members_price_including_tax', + :'option_members_price_tax' => :'option_members_price_tax', :'make_date' => :'make_date', :'update_date' => :'update_date' } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -80,65 +102,105 @@ def self.openapi_types :'few_num' => :'Integer', :'model_number' => :'String', :'option_price' => :'Integer', + :'option_price_including_tax' => :'Integer', + :'option_price_tax' => :'Integer', :'option_members_price' => :'Integer', + :'option_members_price_including_tax' => :'Integer', + :'option_members_price_tax' => :'Integer', :'make_date' => :'Integer', :'update_date' => :'Integer' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'option1_value', + :'option2_value', + :'stocks', + :'few_num', + :'model_number', + :'option_price', + :'option_members_price', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ProductVariant` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ProductVariant`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'product_id') + if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'option1_value') + if attributes.key?(:'option1_value') self.option1_value = attributes[:'option1_value'] end - if attributes.has_key?(:'option2_value') + if attributes.key?(:'option2_value') self.option2_value = attributes[:'option2_value'] end - if attributes.has_key?(:'title') + if attributes.key?(:'title') self.title = attributes[:'title'] end - if attributes.has_key?(:'stocks') + if attributes.key?(:'stocks') self.stocks = attributes[:'stocks'] end - if attributes.has_key?(:'few_num') + if attributes.key?(:'few_num') self.few_num = attributes[:'few_num'] end - if attributes.has_key?(:'model_number') + if attributes.key?(:'model_number') self.model_number = attributes[:'model_number'] end - if attributes.has_key?(:'option_price') + if attributes.key?(:'option_price') self.option_price = attributes[:'option_price'] end - if attributes.has_key?(:'option_members_price') + if attributes.key?(:'option_price_including_tax') + self.option_price_including_tax = attributes[:'option_price_including_tax'] + end + + if attributes.key?(:'option_price_tax') + self.option_price_tax = attributes[:'option_price_tax'] + end + + if attributes.key?(:'option_members_price') self.option_members_price = attributes[:'option_members_price'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'option_members_price_including_tax') + self.option_members_price_including_tax = attributes[:'option_members_price_including_tax'] + end + + if attributes.key?(:'option_members_price_tax') + self.option_members_price_tax = attributes[:'option_members_price_tax'] + end + + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end end @@ -146,6 +208,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -153,6 +216,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' true end @@ -170,7 +234,11 @@ def ==(o) few_num == o.few_num && model_number == o.model_number && option_price == o.option_price && + option_price_including_tax == o.option_price_including_tax && + option_price_tax == o.option_price_tax && option_members_price == o.option_members_price && + option_members_price_including_tax == o.option_members_price_including_tax && + option_members_price_tax == o.option_members_price_tax && make_date == o.make_date && update_date == o.update_date end @@ -182,39 +250,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [product_id, account_id, option1_value, option2_value, title, stocks, few_num, model_number, option_price, option_members_price, make_date, update_date].hash + [product_id, account_id, option1_value, option2_value, title, stocks, few_num, model_number, option_price, option_price_including_tax, option_price_tax, option_members_price, option_members_price_including_tax, option_members_price_tax, make_date, update_date].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -223,7 +294,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -244,8 +315,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -267,7 +339,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -290,5 +366,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/put_product_pickup200_response.rb b/lib/color_me_shop/models/put_product_pickup200_response.rb new file mode 100644 index 0000000..0f0093a --- /dev/null +++ b/lib/color_me_shop/models/put_product_pickup200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PutProductPickup200Response + attr_accessor :pickup + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pickup' => :'pickup' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'pickup' => :'PutProductPickup200ResponsePickup' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PutProductPickup200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PutProductPickup200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pickup') + self.pickup = attributes[:'pickup'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pickup == o.pickup + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pickup].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/put_product_pickup200_response_pickup.rb b/lib/color_me_shop/models/put_product_pickup200_response_pickup.rb new file mode 100644 index 0000000..6db2d79 --- /dev/null +++ b/lib/color_me_shop/models/put_product_pickup200_response_pickup.rb @@ -0,0 +1,266 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PutProductPickup200ResponsePickup + # おすすめ商品情報種別 + attr_accessor :pickup_type + + # 商品ID + attr_accessor :product_id + + # ショップアカウントID + attr_accessor :account_id + + # 商品の表示順 + attr_accessor :order_num + + # 作成日時 + attr_accessor :make_date + + # 更新日時 + attr_accessor :update_date + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pickup_type' => :'pickup_type', + :'product_id' => :'product_id', + :'account_id' => :'account_id', + :'order_num' => :'order_num', + :'make_date' => :'make_date', + :'update_date' => :'update_date' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'pickup_type' => :'Integer', + :'product_id' => :'Integer', + :'account_id' => :'String', + :'order_num' => :'Integer', + :'make_date' => :'Integer', + :'update_date' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'order_num', + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PutProductPickup200ResponsePickup` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PutProductPickup200ResponsePickup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pickup_type') + self.pickup_type = attributes[:'pickup_type'] + end + + if attributes.key?(:'product_id') + self.product_id = attributes[:'product_id'] + end + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'order_num') + self.order_num = attributes[:'order_num'] + end + + if attributes.key?(:'make_date') + self.make_date = attributes[:'make_date'] + end + + if attributes.key?(:'update_date') + self.update_date = attributes[:'update_date'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pickup_type == o.pickup_type && + product_id == o.product_id && + account_id == o.account_id && + order_num == o.order_num && + make_date == o.make_date && + update_date == o.update_date + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pickup_type, product_id, account_id, order_num, make_date, update_date].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/put_product_pickup_request.rb b/lib/color_me_shop/models/put_product_pickup_request.rb new file mode 100644 index 0000000..dc78e95 --- /dev/null +++ b/lib/color_me_shop/models/put_product_pickup_request.rb @@ -0,0 +1,278 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class PutProductPickupRequest + # おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) + attr_accessor :pickup_type + + # 商品の表示順 + attr_accessor :order_num + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'pickup_type' => :'pickup_type', + :'order_num' => :'order_num' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'pickup_type' => :'Integer', + :'order_num' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::PutProductPickupRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::PutProductPickupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'pickup_type') + self.pickup_type = attributes[:'pickup_type'] + end + + if attributes.key?(:'order_num') + self.order_num = attributes[:'order_num'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@order_num.nil? && @order_num < 0 + invalid_properties.push('invalid value for "order_num", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + pickup_type_validator = EnumAttributeValidator.new('Integer', [0, 1, 3, 4]) + return false unless pickup_type_validator.valid?(@pickup_type) + return false if !@order_num.nil? && @order_num < 0 + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] pickup_type Object to be assigned + def pickup_type=(pickup_type) + validator = EnumAttributeValidator.new('Integer', [0, 1, 3, 4]) + unless validator.valid?(pickup_type) + fail ArgumentError, "invalid value for \"pickup_type\", must be one of #{validator.allowable_values}." + end + @pickup_type = pickup_type + end + + # Custom attribute writer method with validation + # @param [Object] order_num Value to be assigned + def order_num=(order_num) + if order_num.nil? + fail ArgumentError, 'order_num cannot be nil' + end + + if order_num < 0 + fail ArgumentError, 'invalid value for "order_num", must be greater than or equal to 0.' + end + + @order_num = order_num + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pickup_type == o.pickup_type && + order_num == o.order_num + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [pickup_type, order_num].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/recurring_application_charge.rb b/lib/color_me_shop/models/recurring_application_charge.rb deleted file mode 100644 index 4fc1822..0000000 --- a/lib/color_me_shop/models/recurring_application_charge.rb +++ /dev/null @@ -1,298 +0,0 @@ -=begin -#カラーミーショップ API - -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` - -OpenAPI spec version: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT - -=end - -require 'date' - -module ColorMeShop - class RecurringApplicationCharge - # 課金ID - attr_accessor :id - - # アカウントID - attr_accessor :account_id - - # アプリケーションID - attr_accessor :oauth_application_id - - # 課金プランID - attr_accessor :recurring_application_charge_plan_id - - # ショップオーナー様が課金の許可/拒否を行った後に遷移するURL - attr_accessor :return_url - - # ステータス - attr_accessor :status - - # 次回請求日 - attr_accessor :billing_on - - # 作成日時 - attr_accessor :make_date - - # 更新日時 - attr_accessor :update_date - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'account_id' => :'account_id', - :'oauth_application_id' => :'oauth_application_id', - :'recurring_application_charge_plan_id' => :'recurring_application_charge_plan_id', - :'return_url' => :'return_url', - :'status' => :'status', - :'billing_on' => :'billing_on', - :'make_date' => :'make_date', - :'update_date' => :'update_date' - } - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'Integer', - :'account_id' => :'String', - :'oauth_application_id' => :'Integer', - :'recurring_application_charge_plan_id' => :'Integer', - :'return_url' => :'String', - :'status' => :'String', - :'billing_on' => :'Date', - :'make_date' => :'Integer', - :'update_date' => :'Integer' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } - - if attributes.has_key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.has_key?(:'account_id') - self.account_id = attributes[:'account_id'] - end - - if attributes.has_key?(:'oauth_application_id') - self.oauth_application_id = attributes[:'oauth_application_id'] - end - - if attributes.has_key?(:'recurring_application_charge_plan_id') - self.recurring_application_charge_plan_id = attributes[:'recurring_application_charge_plan_id'] - end - - if attributes.has_key?(:'return_url') - self.return_url = attributes[:'return_url'] - end - - if attributes.has_key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.has_key?(:'billing_on') - self.billing_on = attributes[:'billing_on'] - end - - if attributes.has_key?(:'make_date') - self.make_date = attributes[:'make_date'] - end - - if attributes.has_key?(:'update_date') - self.update_date = attributes[:'update_date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - status_validator = EnumAttributeValidator.new('String', ['pending', 'accepted', 'declined', 'active', 'canceled', 'expired']) - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ['pending', 'accepted', 'declined', 'active', 'canceled', 'expired']) - unless validator.valid?(status) - fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.' - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - account_id == o.account_id && - oauth_application_id == o.oauth_application_id && - recurring_application_charge_plan_id == o.recurring_application_charge_plan_id && - return_url == o.return_url && - status == o.status && - billing_on == o.billing_on && - make_date == o.make_date && - update_date == o.update_date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [id, account_id, oauth_application_id, recurring_application_charge_plan_id, return_url, status, billing_on, make_date, update_date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end -end diff --git a/lib/color_me_shop/models/recurring_application_charge_create_response.rb b/lib/color_me_shop/models/recurring_application_charge_create_response.rb deleted file mode 100644 index f1f84c7..0000000 --- a/lib/color_me_shop/models/recurring_application_charge_create_response.rb +++ /dev/null @@ -1,308 +0,0 @@ -=begin -#カラーミーショップ API - -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` - -OpenAPI spec version: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT - -=end - -require 'date' - -module ColorMeShop - class RecurringApplicationChargeCreateResponse - # 課金ID - attr_accessor :id - - # アカウントID - attr_accessor :account_id - - # アプリケーションID - attr_accessor :oauth_application_id - - # 課金プランID - attr_accessor :recurring_application_charge_plan_id - - # ショップオーナー様が課金の許可/拒否を行った後に遷移するURL - attr_accessor :return_url - - # ショップオーナー様が課金のOK/NGを行う確認画面ページのURLです。 URLには課金IDとsignatureを含んでいます。 - attr_accessor :confirmation_url - - # ステータス - attr_accessor :status - - # 次回請求日 - attr_accessor :billing_on - - # 作成日時 - attr_accessor :make_date - - # 更新日時 - attr_accessor :update_date - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'account_id' => :'account_id', - :'oauth_application_id' => :'oauth_application_id', - :'recurring_application_charge_plan_id' => :'recurring_application_charge_plan_id', - :'return_url' => :'return_url', - :'confirmation_url' => :'confirmation_url', - :'status' => :'status', - :'billing_on' => :'billing_on', - :'make_date' => :'make_date', - :'update_date' => :'update_date' - } - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'Integer', - :'account_id' => :'String', - :'oauth_application_id' => :'Integer', - :'recurring_application_charge_plan_id' => :'Integer', - :'return_url' => :'String', - :'confirmation_url' => :'String', - :'status' => :'String', - :'billing_on' => :'Date', - :'make_date' => :'Integer', - :'update_date' => :'Integer' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } - - if attributes.has_key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.has_key?(:'account_id') - self.account_id = attributes[:'account_id'] - end - - if attributes.has_key?(:'oauth_application_id') - self.oauth_application_id = attributes[:'oauth_application_id'] - end - - if attributes.has_key?(:'recurring_application_charge_plan_id') - self.recurring_application_charge_plan_id = attributes[:'recurring_application_charge_plan_id'] - end - - if attributes.has_key?(:'return_url') - self.return_url = attributes[:'return_url'] - end - - if attributes.has_key?(:'confirmation_url') - self.confirmation_url = attributes[:'confirmation_url'] - end - - if attributes.has_key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.has_key?(:'billing_on') - self.billing_on = attributes[:'billing_on'] - end - - if attributes.has_key?(:'make_date') - self.make_date = attributes[:'make_date'] - end - - if attributes.has_key?(:'update_date') - self.update_date = attributes[:'update_date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - status_validator = EnumAttributeValidator.new('String', ['pending', 'accepted', 'declined', 'active', 'canceled', 'expired']) - return false unless status_validator.valid?(@status) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ['pending', 'accepted', 'declined', 'active', 'canceled', 'expired']) - unless validator.valid?(status) - fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.' - end - @status = status - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - account_id == o.account_id && - oauth_application_id == o.oauth_application_id && - recurring_application_charge_plan_id == o.recurring_application_charge_plan_id && - return_url == o.return_url && - confirmation_url == o.confirmation_url && - status == o.status && - billing_on == o.billing_on && - make_date == o.make_date && - update_date == o.update_date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [id, account_id, oauth_application_id, recurring_application_charge_plan_id, return_url, confirmation_url, status, billing_on, make_date, update_date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end -end diff --git a/lib/color_me_shop/models/sale.rb b/lib/color_me_shop/models/sale.rb index a711389..9d490be 100644 --- a/lib/color_me_shop/models/sale.rb +++ b/lib/color_me_shop/models/sale.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class Sale @@ -125,12 +126,19 @@ class Sale # 使用されたYahooポイント数 attr_accessor :use_yahoo_points + # 外部システムで発行された決済識別番号 該当受注の決済が、楽天ペイ(オンライン決済)、LINE Pay、PayPal Commerce Platform、Amazon Pay、Amazon Pay V2、Square対面決済のいずれかである場合、その決済の決済識別番号を返します。 それ以外の決済に関しては空文字列を返します。 + attr_accessor :external_order_id + attr_accessor :customer attr_accessor :details attr_accessor :sale_deliveries + attr_accessor :segment + + attr_accessor :totals + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -193,12 +201,20 @@ def self.attribute_map :'use_gmo_points' => :'use_gmo_points', :'granted_yahoo_points' => :'granted_yahoo_points', :'use_yahoo_points' => :'use_yahoo_points', + :'external_order_id' => :'external_order_id', :'customer' => :'customer', :'details' => :'details', - :'sale_deliveries' => :'sale_deliveries' + :'sale_deliveries' => :'sale_deliveries', + :'segment' => :'segment', + :'totals' => :'totals' } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -208,10 +224,10 @@ def self.openapi_types :'update_date' => :'Integer', :'memo' => :'String', :'payment_id' => :'Integer', - :'mobile' => :'BOOLEAN', - :'paid' => :'BOOLEAN', - :'delivered' => :'BOOLEAN', - :'canceled' => :'BOOLEAN', + :'mobile' => :'Boolean', + :'paid' => :'Boolean', + :'delivered' => :'Boolean', + :'canceled' => :'Boolean', :'accepted_mail_state' => :'String', :'paid_mail_state' => :'String', :'delivered_mail_state' => :'String', @@ -239,188 +255,225 @@ def self.openapi_types :'use_gmo_points' => :'Integer', :'granted_yahoo_points' => :'Integer', :'use_yahoo_points' => :'Integer', - :'customer' => :'Customer', - :'details' => :'Array', - :'sale_deliveries' => :'Array' + :'external_order_id' => :'String', + :'customer' => :'GetSales200ResponseSalesInnerCustomer', + :'details' => :'Array', + :'sale_deliveries' => :'Array', + :'segment' => :'GetSales200ResponseSalesInnerSegment', + :'totals' => :'GetSales200ResponseSalesInnerTotals' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'memo', + :'accepted_mail_sent_date', + :'paid_mail_sent_date', + :'delivered_mail_sent_date', + :'gmo_point_state', + :'yahoo_point_state', + :'segment', + :'totals' + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::Sale` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::Sale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end - if attributes.has_key?(:'memo') + if attributes.key?(:'memo') self.memo = attributes[:'memo'] end - if attributes.has_key?(:'payment_id') + if attributes.key?(:'payment_id') self.payment_id = attributes[:'payment_id'] end - if attributes.has_key?(:'mobile') + if attributes.key?(:'mobile') self.mobile = attributes[:'mobile'] end - if attributes.has_key?(:'paid') + if attributes.key?(:'paid') self.paid = attributes[:'paid'] end - if attributes.has_key?(:'delivered') + if attributes.key?(:'delivered') self.delivered = attributes[:'delivered'] end - if attributes.has_key?(:'canceled') + if attributes.key?(:'canceled') self.canceled = attributes[:'canceled'] end - if attributes.has_key?(:'accepted_mail_state') + if attributes.key?(:'accepted_mail_state') self.accepted_mail_state = attributes[:'accepted_mail_state'] end - if attributes.has_key?(:'paid_mail_state') + if attributes.key?(:'paid_mail_state') self.paid_mail_state = attributes[:'paid_mail_state'] end - if attributes.has_key?(:'delivered_mail_state') + if attributes.key?(:'delivered_mail_state') self.delivered_mail_state = attributes[:'delivered_mail_state'] end - if attributes.has_key?(:'accepted_mail_sent_date') + if attributes.key?(:'accepted_mail_sent_date') self.accepted_mail_sent_date = attributes[:'accepted_mail_sent_date'] end - if attributes.has_key?(:'paid_mail_sent_date') + if attributes.key?(:'paid_mail_sent_date') self.paid_mail_sent_date = attributes[:'paid_mail_sent_date'] end - if attributes.has_key?(:'delivered_mail_sent_date') + if attributes.key?(:'delivered_mail_sent_date') self.delivered_mail_sent_date = attributes[:'delivered_mail_sent_date'] end - if attributes.has_key?(:'point_state') + if attributes.key?(:'point_state') self.point_state = attributes[:'point_state'] end - if attributes.has_key?(:'gmo_point_state') + if attributes.key?(:'gmo_point_state') self.gmo_point_state = attributes[:'gmo_point_state'] end - if attributes.has_key?(:'yahoo_point_state') + if attributes.key?(:'yahoo_point_state') self.yahoo_point_state = attributes[:'yahoo_point_state'] end - if attributes.has_key?(:'product_total_price') + if attributes.key?(:'product_total_price') self.product_total_price = attributes[:'product_total_price'] end - if attributes.has_key?(:'delivery_total_charge') + if attributes.key?(:'delivery_total_charge') self.delivery_total_charge = attributes[:'delivery_total_charge'] end - if attributes.has_key?(:'fee') + if attributes.key?(:'fee') self.fee = attributes[:'fee'] end - if attributes.has_key?(:'tax') + if attributes.key?(:'tax') self.tax = attributes[:'tax'] end - if attributes.has_key?(:'noshi_total_charge') + if attributes.key?(:'noshi_total_charge') self.noshi_total_charge = attributes[:'noshi_total_charge'] end - if attributes.has_key?(:'card_total_charge') + if attributes.key?(:'card_total_charge') self.card_total_charge = attributes[:'card_total_charge'] end - if attributes.has_key?(:'wrapping_total_charge') + if attributes.key?(:'wrapping_total_charge') self.wrapping_total_charge = attributes[:'wrapping_total_charge'] end - if attributes.has_key?(:'point_discount') + if attributes.key?(:'point_discount') self.point_discount = attributes[:'point_discount'] end - if attributes.has_key?(:'gmo_point_discount') + if attributes.key?(:'gmo_point_discount') self.gmo_point_discount = attributes[:'gmo_point_discount'] end - if attributes.has_key?(:'other_discount') + if attributes.key?(:'other_discount') self.other_discount = attributes[:'other_discount'] end - if attributes.has_key?(:'other_discount_name') + if attributes.key?(:'other_discount_name') self.other_discount_name = attributes[:'other_discount_name'] end - if attributes.has_key?(:'total_price') + if attributes.key?(:'total_price') self.total_price = attributes[:'total_price'] end - if attributes.has_key?(:'granted_points') + if attributes.key?(:'granted_points') self.granted_points = attributes[:'granted_points'] end - if attributes.has_key?(:'use_points') + if attributes.key?(:'use_points') self.use_points = attributes[:'use_points'] end - if attributes.has_key?(:'granted_gmo_points') + if attributes.key?(:'granted_gmo_points') self.granted_gmo_points = attributes[:'granted_gmo_points'] end - if attributes.has_key?(:'use_gmo_points') + if attributes.key?(:'use_gmo_points') self.use_gmo_points = attributes[:'use_gmo_points'] end - if attributes.has_key?(:'granted_yahoo_points') + if attributes.key?(:'granted_yahoo_points') self.granted_yahoo_points = attributes[:'granted_yahoo_points'] end - if attributes.has_key?(:'use_yahoo_points') + if attributes.key?(:'use_yahoo_points') self.use_yahoo_points = attributes[:'use_yahoo_points'] end - if attributes.has_key?(:'customer') + if attributes.key?(:'external_order_id') + self.external_order_id = attributes[:'external_order_id'] + end + + if attributes.key?(:'customer') self.customer = attributes[:'customer'] end - if attributes.has_key?(:'details') + if attributes.key?(:'details') if (value = attributes[:'details']).is_a?(Array) self.details = value end end - if attributes.has_key?(:'sale_deliveries') + if attributes.key?(:'sale_deliveries') if (value = attributes[:'sale_deliveries']).is_a?(Array) self.sale_deliveries = value end end + + if attributes.key?(:'segment') + self.segment = attributes[:'segment'] + end + + if attributes.key?(:'totals') + self.totals = attributes[:'totals'] + end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -428,17 +481,18 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - accepted_mail_state_validator = EnumAttributeValidator.new('String', ['not_yet', 'sent', 'pass']) + warn '[DEPRECATED] the `valid?` method is obsolete' + accepted_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) return false unless accepted_mail_state_validator.valid?(@accepted_mail_state) - paid_mail_state_validator = EnumAttributeValidator.new('String', ['not_yet', 'sent', 'pass']) + paid_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) return false unless paid_mail_state_validator.valid?(@paid_mail_state) - delivered_mail_state_validator = EnumAttributeValidator.new('String', ['not_yet', 'sent', 'pass']) + delivered_mail_state_validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) return false unless delivered_mail_state_validator.valid?(@delivered_mail_state) - point_state_validator = EnumAttributeValidator.new('String', ['assumed', 'fixed', 'canceled']) + point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) return false unless point_state_validator.valid?(@point_state) - gmo_point_state_validator = EnumAttributeValidator.new('String', ['assumed', 'fixed', 'canceled']) + gmo_point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) return false unless gmo_point_state_validator.valid?(@gmo_point_state) - yahoo_point_state_validator = EnumAttributeValidator.new('String', ['assumed', 'fixed', 'canceled']) + yahoo_point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) return false unless yahoo_point_state_validator.valid?(@yahoo_point_state) true end @@ -446,9 +500,9 @@ def valid? # Custom attribute writer method checking allowed values (enum). # @param [Object] accepted_mail_state Object to be assigned def accepted_mail_state=(accepted_mail_state) - validator = EnumAttributeValidator.new('String', ['not_yet', 'sent', 'pass']) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) unless validator.valid?(accepted_mail_state) - fail ArgumentError, 'invalid value for "accepted_mail_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"accepted_mail_state\", must be one of #{validator.allowable_values}." end @accepted_mail_state = accepted_mail_state end @@ -456,9 +510,9 @@ def accepted_mail_state=(accepted_mail_state) # Custom attribute writer method checking allowed values (enum). # @param [Object] paid_mail_state Object to be assigned def paid_mail_state=(paid_mail_state) - validator = EnumAttributeValidator.new('String', ['not_yet', 'sent', 'pass']) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) unless validator.valid?(paid_mail_state) - fail ArgumentError, 'invalid value for "paid_mail_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"paid_mail_state\", must be one of #{validator.allowable_values}." end @paid_mail_state = paid_mail_state end @@ -466,9 +520,9 @@ def paid_mail_state=(paid_mail_state) # Custom attribute writer method checking allowed values (enum). # @param [Object] delivered_mail_state Object to be assigned def delivered_mail_state=(delivered_mail_state) - validator = EnumAttributeValidator.new('String', ['not_yet', 'sent', 'pass']) + validator = EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) unless validator.valid?(delivered_mail_state) - fail ArgumentError, 'invalid value for "delivered_mail_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"delivered_mail_state\", must be one of #{validator.allowable_values}." end @delivered_mail_state = delivered_mail_state end @@ -476,9 +530,9 @@ def delivered_mail_state=(delivered_mail_state) # Custom attribute writer method checking allowed values (enum). # @param [Object] point_state Object to be assigned def point_state=(point_state) - validator = EnumAttributeValidator.new('String', ['assumed', 'fixed', 'canceled']) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) unless validator.valid?(point_state) - fail ArgumentError, 'invalid value for "point_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"point_state\", must be one of #{validator.allowable_values}." end @point_state = point_state end @@ -486,9 +540,9 @@ def point_state=(point_state) # Custom attribute writer method checking allowed values (enum). # @param [Object] gmo_point_state Object to be assigned def gmo_point_state=(gmo_point_state) - validator = EnumAttributeValidator.new('String', ['assumed', 'fixed', 'canceled']) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) unless validator.valid?(gmo_point_state) - fail ArgumentError, 'invalid value for "gmo_point_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"gmo_point_state\", must be one of #{validator.allowable_values}." end @gmo_point_state = gmo_point_state end @@ -496,9 +550,9 @@ def gmo_point_state=(gmo_point_state) # Custom attribute writer method checking allowed values (enum). # @param [Object] yahoo_point_state Object to be assigned def yahoo_point_state=(yahoo_point_state) - validator = EnumAttributeValidator.new('String', ['assumed', 'fixed', 'canceled']) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) unless validator.valid?(yahoo_point_state) - fail ArgumentError, 'invalid value for "yahoo_point_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"yahoo_point_state\", must be one of #{validator.allowable_values}." end @yahoo_point_state = yahoo_point_state end @@ -545,9 +599,12 @@ def ==(o) use_gmo_points == o.use_gmo_points && granted_yahoo_points == o.granted_yahoo_points && use_yahoo_points == o.use_yahoo_points && + external_order_id == o.external_order_id && customer == o.customer && details == o.details && - sale_deliveries == o.sale_deliveries + sale_deliveries == o.sale_deliveries && + segment == o.segment && + totals == o.totals end # @see the `==` method @@ -557,39 +614,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [id, account_id, make_date, update_date, memo, payment_id, mobile, paid, delivered, canceled, accepted_mail_state, paid_mail_state, delivered_mail_state, accepted_mail_sent_date, paid_mail_sent_date, delivered_mail_sent_date, point_state, gmo_point_state, yahoo_point_state, product_total_price, delivery_total_charge, fee, tax, noshi_total_charge, card_total_charge, wrapping_total_charge, point_discount, gmo_point_discount, other_discount, other_discount_name, total_price, granted_points, use_points, granted_gmo_points, use_gmo_points, granted_yahoo_points, use_yahoo_points, customer, details, sale_deliveries].hash + [id, account_id, make_date, update_date, memo, payment_id, mobile, paid, delivered, canceled, accepted_mail_state, paid_mail_state, delivered_mail_state, accepted_mail_sent_date, paid_mail_sent_date, delivered_mail_sent_date, point_state, gmo_point_state, yahoo_point_state, product_total_price, delivery_total_charge, fee, tax, noshi_total_charge, card_total_charge, wrapping_total_charge, point_discount, gmo_point_discount, other_discount, other_discount_name, total_price, granted_points, use_points, granted_gmo_points, use_gmo_points, granted_yahoo_points, use_yahoo_points, external_order_id, customer, details, sale_deliveries, segment, totals].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -598,7 +658,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -619,8 +679,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -642,7 +703,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -665,5 +730,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/sale_delivery.rb b/lib/color_me_shop/models/sale_delivery.rb index aee70ab..490f4ea 100644 --- a/lib/color_me_shop/models/sale_delivery.rb +++ b/lib/color_me_shop/models/sale_delivery.rb @@ -1,20 +1,21 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class SaleDelivery - # 配送ID + # お届け先ID attr_accessor :id # ショップアカウントID @@ -89,6 +90,9 @@ class SaleDelivery # 配送料・手数料の小計 attr_accessor :total_charge + # 配送状況確認URL + attr_accessor :tracking_url + # 備考 attr_accessor :memo @@ -123,11 +127,17 @@ def self.attribute_map :'wrapping_charge' => :'wrapping_charge', :'delivery_charge' => :'delivery_charge', :'total_charge' => :'total_charge', + :'tracking_url' => :'tracking_url', :'memo' => :'memo', :'delivered' => :'delivered' } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -156,126 +166,160 @@ def self.openapi_types :'wrapping_charge' => :'Integer', :'delivery_charge' => :'Integer', :'total_charge' => :'Integer', + :'tracking_url' => :'String', :'memo' => :'String', - :'delivered' => :'BOOLEAN' + :'delivered' => :'Boolean' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'postal', + :'address1', + :'address2', + :'tel', + :'preferred_date', + :'preferred_period', + :'slip_number', + :'noshi_text', + :'noshi_charge', + :'card_name', + :'card_text', + :'card_charge', + :'wrapping_name', + :'wrapping_charge', + :'tracking_url', + :'memo', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::SaleDelivery` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::SaleDelivery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'sale_id') + if attributes.key?(:'sale_id') self.sale_id = attributes[:'sale_id'] end - if attributes.has_key?(:'delivery_id') + if attributes.key?(:'delivery_id') self.delivery_id = attributes[:'delivery_id'] end - if attributes.has_key?(:'detail_ids') + if attributes.key?(:'detail_ids') if (value = attributes[:'detail_ids']).is_a?(Array) self.detail_ids = value end end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'furigana') + if attributes.key?(:'furigana') self.furigana = attributes[:'furigana'] end - if attributes.has_key?(:'postal') + if attributes.key?(:'postal') self.postal = attributes[:'postal'] end - if attributes.has_key?(:'pref_id') + if attributes.key?(:'pref_id') self.pref_id = attributes[:'pref_id'] end - if attributes.has_key?(:'pref_name') + if attributes.key?(:'pref_name') self.pref_name = attributes[:'pref_name'] end - if attributes.has_key?(:'address1') + if attributes.key?(:'address1') self.address1 = attributes[:'address1'] end - if attributes.has_key?(:'address2') + if attributes.key?(:'address2') self.address2 = attributes[:'address2'] end - if attributes.has_key?(:'tel') + if attributes.key?(:'tel') self.tel = attributes[:'tel'] end - if attributes.has_key?(:'preferred_date') + if attributes.key?(:'preferred_date') self.preferred_date = attributes[:'preferred_date'] end - if attributes.has_key?(:'preferred_period') + if attributes.key?(:'preferred_period') self.preferred_period = attributes[:'preferred_period'] end - if attributes.has_key?(:'slip_number') + if attributes.key?(:'slip_number') self.slip_number = attributes[:'slip_number'] end - if attributes.has_key?(:'noshi_text') + if attributes.key?(:'noshi_text') self.noshi_text = attributes[:'noshi_text'] end - if attributes.has_key?(:'noshi_charge') + if attributes.key?(:'noshi_charge') self.noshi_charge = attributes[:'noshi_charge'] end - if attributes.has_key?(:'card_name') + if attributes.key?(:'card_name') self.card_name = attributes[:'card_name'] end - if attributes.has_key?(:'card_text') + if attributes.key?(:'card_text') self.card_text = attributes[:'card_text'] end - if attributes.has_key?(:'card_charge') + if attributes.key?(:'card_charge') self.card_charge = attributes[:'card_charge'] end - if attributes.has_key?(:'wrapping_name') + if attributes.key?(:'wrapping_name') self.wrapping_name = attributes[:'wrapping_name'] end - if attributes.has_key?(:'wrapping_charge') + if attributes.key?(:'wrapping_charge') self.wrapping_charge = attributes[:'wrapping_charge'] end - if attributes.has_key?(:'delivery_charge') + if attributes.key?(:'delivery_charge') self.delivery_charge = attributes[:'delivery_charge'] end - if attributes.has_key?(:'total_charge') + if attributes.key?(:'total_charge') self.total_charge = attributes[:'total_charge'] end - if attributes.has_key?(:'memo') + if attributes.key?(:'tracking_url') + self.tracking_url = attributes[:'tracking_url'] + end + + if attributes.key?(:'memo') self.memo = attributes[:'memo'] end - if attributes.has_key?(:'delivered') + if attributes.key?(:'delivered') self.delivered = attributes[:'delivered'] end end @@ -283,6 +327,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -290,6 +335,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' true end @@ -323,6 +369,7 @@ def ==(o) wrapping_charge == o.wrapping_charge && delivery_charge == o.delivery_charge && total_charge == o.total_charge && + tracking_url == o.tracking_url && memo == o.memo && delivered == o.delivered end @@ -334,39 +381,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [id, account_id, sale_id, delivery_id, detail_ids, name, furigana, postal, pref_id, pref_name, address1, address2, tel, preferred_date, preferred_period, slip_number, noshi_text, noshi_charge, card_name, card_text, card_charge, wrapping_name, wrapping_charge, delivery_charge, total_charge, memo, delivered].hash + [id, account_id, sale_id, delivery_id, detail_ids, name, furigana, postal, pref_id, pref_name, address1, address2, tel, preferred_date, preferred_period, slip_number, noshi_text, noshi_charge, card_name, card_text, card_charge, wrapping_name, wrapping_charge, delivery_charge, total_charge, tracking_url, memo, delivered].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -375,7 +425,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -396,8 +446,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -419,7 +470,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -442,5 +497,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/sale_detail.rb b/lib/color_me_shop/models/sale_detail.rb index 273cae7..e250b58 100644 --- a/lib/color_me_shop/models/sale_detail.rb +++ b/lib/color_me_shop/models/sale_detail.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class SaleDetail @@ -26,13 +27,13 @@ class SaleDetail # 商品ID attr_accessor :product_id - # 配送ID + # お届け先ID attr_accessor :sale_delivery_id - # オプション1の値 + # オプション1の値(最新の商品情報) attr_accessor :option1_value - # オプション2の値 + # オプション2の値(最新の商品情報) attr_accessor :option2_value # オプション1の値の選択肢中の位置 @@ -44,9 +45,12 @@ class SaleDetail # 型番 attr_accessor :product_model_number - # 商品名 + # 商品名(最新の商品情報) attr_accessor :product_name + # 商品名とオプション名(注文時の商品情報) + attr_accessor :pristine_product_full_name + # 商品原価 attr_accessor :product_cost @@ -88,6 +92,7 @@ def self.attribute_map :'option2_index' => :'option2_index', :'product_model_number' => :'product_model_number', :'product_name' => :'product_name', + :'pristine_product_full_name' => :'pristine_product_full_name', :'product_cost' => :'product_cost', :'product_image_url' => :'product_image_url', :'product_thumbnail_image_url' => :'product_thumbnail_image_url', @@ -100,6 +105,11 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -111,9 +121,10 @@ def self.openapi_types :'option1_value' => :'String', :'option2_value' => :'String', :'option1_index' => :'Integer', - :'option2_index' => :'String', + :'option2_index' => :'Integer', :'product_model_number' => :'String', :'product_name' => :'String', + :'pristine_product_full_name' => :'String', :'product_cost' => :'Integer', :'product_image_url' => :'String', :'product_thumbnail_image_url' => :'String', @@ -126,91 +137,118 @@ def self.openapi_types } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'sale_delivery_id', + :'option1_value', + :'option2_value', + :'option1_index', + :'option2_index', + :'product_cost', + :'product_image_url', + :'product_thumbnail_image_url', + :'product_mobile_image_url', + :'unit', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::SaleDetail` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::SaleDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'sale_id') + if attributes.key?(:'sale_id') self.sale_id = attributes[:'sale_id'] end - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'product_id') + if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] end - if attributes.has_key?(:'sale_delivery_id') + if attributes.key?(:'sale_delivery_id') self.sale_delivery_id = attributes[:'sale_delivery_id'] end - if attributes.has_key?(:'option1_value') + if attributes.key?(:'option1_value') self.option1_value = attributes[:'option1_value'] end - if attributes.has_key?(:'option2_value') + if attributes.key?(:'option2_value') self.option2_value = attributes[:'option2_value'] end - if attributes.has_key?(:'option1_index') + if attributes.key?(:'option1_index') self.option1_index = attributes[:'option1_index'] end - if attributes.has_key?(:'option2_index') + if attributes.key?(:'option2_index') self.option2_index = attributes[:'option2_index'] end - if attributes.has_key?(:'product_model_number') + if attributes.key?(:'product_model_number') self.product_model_number = attributes[:'product_model_number'] end - if attributes.has_key?(:'product_name') + if attributes.key?(:'product_name') self.product_name = attributes[:'product_name'] end - if attributes.has_key?(:'product_cost') + if attributes.key?(:'pristine_product_full_name') + self.pristine_product_full_name = attributes[:'pristine_product_full_name'] + end + + if attributes.key?(:'product_cost') self.product_cost = attributes[:'product_cost'] end - if attributes.has_key?(:'product_image_url') + if attributes.key?(:'product_image_url') self.product_image_url = attributes[:'product_image_url'] end - if attributes.has_key?(:'product_thumbnail_image_url') + if attributes.key?(:'product_thumbnail_image_url') self.product_thumbnail_image_url = attributes[:'product_thumbnail_image_url'] end - if attributes.has_key?(:'product_mobile_image_url') + if attributes.key?(:'product_mobile_image_url') self.product_mobile_image_url = attributes[:'product_mobile_image_url'] end - if attributes.has_key?(:'price') + if attributes.key?(:'price') self.price = attributes[:'price'] end - if attributes.has_key?(:'price_with_tax') + if attributes.key?(:'price_with_tax') self.price_with_tax = attributes[:'price_with_tax'] end - if attributes.has_key?(:'product_num') + if attributes.key?(:'product_num') self.product_num = attributes[:'product_num'] end - if attributes.has_key?(:'unit') + if attributes.key?(:'unit') self.unit = attributes[:'unit'] end - if attributes.has_key?(:'subtotal_price') + if attributes.key?(:'subtotal_price') self.subtotal_price = attributes[:'subtotal_price'] end end @@ -218,6 +256,7 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -225,6 +264,7 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' true end @@ -244,6 +284,7 @@ def ==(o) option2_index == o.option2_index && product_model_number == o.product_model_number && product_name == o.product_name && + pristine_product_full_name == o.pristine_product_full_name && product_cost == o.product_cost && product_image_url == o.product_image_url && product_thumbnail_image_url == o.product_thumbnail_image_url && @@ -262,39 +303,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [id, sale_id, account_id, product_id, sale_delivery_id, option1_value, option2_value, option1_index, option2_index, product_model_number, product_name, product_cost, product_image_url, product_thumbnail_image_url, product_mobile_image_url, price, price_with_tax, product_num, unit, subtotal_price].hash + [id, sale_id, account_id, product_id, sale_delivery_id, option1_value, option2_value, option1_index, option2_index, product_model_number, product_name, pristine_product_full_name, product_cost, product_image_url, product_thumbnail_image_url, product_mobile_image_url, price, price_with_tax, product_num, unit, subtotal_price].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -303,7 +347,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -324,8 +368,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -347,7 +392,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -370,5 +419,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/script_tag.rb b/lib/color_me_shop/models/script_tag.rb deleted file mode 100644 index ced1024..0000000 --- a/lib/color_me_shop/models/script_tag.rb +++ /dev/null @@ -1,258 +0,0 @@ -=begin -#カラーミーショップ API - -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` - -OpenAPI spec version: 1.0.0 - -Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT - -=end - -require 'date' - -module ColorMeShop - class ScriptTag - # スクリプトタグID - attr_accessor :id - - # スクリプトURL - attr_accessor :src - - # スクリプトを出力するページ。 - `all`: ショップページと注文完了ページの両方 - `shop`: ショップページ - `thanks_page`: 注文完了ページ - attr_accessor :display_scope - - # 作成日時 - attr_accessor :make_date - - # 更新日時 - attr_accessor :update_date - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - - # Attribute mapping from ruby-style variable name to JSON key. - def self.attribute_map - { - :'id' => :'id', - :'src' => :'src', - :'display_scope' => :'display_scope', - :'make_date' => :'make_date', - :'update_date' => :'update_date' - } - end - - # Attribute type mapping. - def self.openapi_types - { - :'id' => :'Integer', - :'src' => :'String', - :'display_scope' => :'String', - :'make_date' => :'Integer', - :'update_date' => :'Integer' - } - end - - # Initializes the object - # @param [Hash] attributes Model attributes in the form of hash - def initialize(attributes = {}) - return unless attributes.is_a?(Hash) - - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } - - if attributes.has_key?(:'id') - self.id = attributes[:'id'] - end - - if attributes.has_key?(:'src') - self.src = attributes[:'src'] - end - - if attributes.has_key?(:'display_scope') - self.display_scope = attributes[:'display_scope'] - end - - if attributes.has_key?(:'make_date') - self.make_date = attributes[:'make_date'] - end - - if attributes.has_key?(:'update_date') - self.update_date = attributes[:'update_date'] - end - end - - # Show invalid properties with the reasons. Usually used together with valid? - # @return Array for valid properties with the reasons - def list_invalid_properties - invalid_properties = Array.new - invalid_properties - end - - # Check to see if the all the properties in the model are valid - # @return true if the model is valid - def valid? - display_scope_validator = EnumAttributeValidator.new('String', ['all', 'shop', 'thanks_page']) - return false unless display_scope_validator.valid?(@display_scope) - true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] display_scope Object to be assigned - def display_scope=(display_scope) - validator = EnumAttributeValidator.new('String', ['all', 'shop', 'thanks_page']) - unless validator.valid?(display_scope) - fail ArgumentError, 'invalid value for "display_scope", must be one of #{validator.allowable_values}.' - end - @display_scope = display_scope - end - - # Checks equality by comparing each attribute. - # @param [Object] Object to be compared - def ==(o) - return true if self.equal?(o) - self.class == o.class && - id == o.id && - src == o.src && - display_scope == o.display_scope && - make_date == o.make_date && - update_date == o.update_date - end - - # @see the `==` method - # @param [Object] Object to be compared - def eql?(o) - self == o - end - - # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code - def hash - [id, src, display_scope, make_date, update_date].hash - end - - # Builds the object from hash - # @param [Hash] attributes Model attributes in the form of hash - # @return [Object] Returns the model itself - def build_from_hash(attributes) - return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute - # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) - end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional - end - - self - end - - # Deserializes the data based on type - # @param string type Data type - # @param string value Value to be deserialized - # @return [Object] Deserialized data - def _deserialize(type, value) - case type.to_sym - when :DateTime - DateTime.parse(value) - when :Date - Date.parse(value) - when :String - value.to_s - when :Integer - value.to_i - when :Float - value.to_f - when :BOOLEAN - if value.to_s =~ /\A(true|t|yes|y|1)\z/i - true - else - false - end - when :Object - # generic object (usually a Hash), return directly - value - when /\AArray<(?.+)>\z/ - inner_type = Regexp.last_match[:inner_type] - value.map { |v| _deserialize(inner_type, v) } - when /\AHash<(?.+?), (?.+)>\z/ - k_type = Regexp.last_match[:k_type] - v_type = Regexp.last_match[:v_type] - {}.tap do |hash| - value.each do |k, v| - hash[_deserialize(k_type, k)] = _deserialize(v_type, v) - end - end - else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) - end - end - - # Returns the string representation of the object - # @return [String] String presentation of the object - def to_s - to_hash.to_s - end - - # to_body is an alias to to_hash (backward compatibility) - # @return [Hash] Returns the object in the form of hash - def to_body - to_hash - end - - # Returns the object in the form of hash - # @return [Hash] Returns the object in the form of hash - def to_hash - hash = {} - self.class.attribute_map.each_pair do |attr, param| - value = self.send(attr) - next if value.nil? - hash[param] = _to_hash(value) - end - hash - end - - # Outputs non-array value in the form of hash - # For object, use to_hash. Otherwise, just return the value - # @param [Object] value Any valid value - # @return [Hash] Returns the value in the form of hash - def _to_hash(value) - if value.is_a?(Array) - value.compact.map { |v| _to_hash(v) } - elsif value.is_a?(Hash) - {}.tap do |hash| - value.each { |k, v| hash[k] = _to_hash(v) } - end - elsif value.respond_to? :to_hash - value.to_hash - else - value - end - end - end -end diff --git a/lib/color_me_shop/models/send_sales_mail_request.rb b/lib/color_me_shop/models/send_sales_mail_request.rb new file mode 100644 index 0000000..7de1d10 --- /dev/null +++ b/lib/color_me_shop/models/send_sales_mail_request.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class SendSalesMailRequest + attr_accessor :mail + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'mail' => :'mail' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'mail' => :'SendSalesMailRequestMail' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::SendSalesMailRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::SendSalesMailRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'mail') + self.mail = attributes[:'mail'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + mail == o.mail + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [mail].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/send_sales_mail_request_mail.rb b/lib/color_me_shop/models/send_sales_mail_request_mail.rb new file mode 100644 index 0000000..1d168b1 --- /dev/null +++ b/lib/color_me_shop/models/send_sales_mail_request_mail.rb @@ -0,0 +1,249 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class SendSalesMailRequestMail + # 送信するメールの種類 - `accepted`: 受注メールを送信する - `paid`: 入金確認メールを送信する - `delivered`: 商品発送メールを送信する + attr_accessor :type + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'type' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::SendSalesMailRequestMail` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::SendSalesMailRequestMail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + type_validator = EnumAttributeValidator.new('String', ["accepted", "paid", "delivered"]) + return false unless type_validator.valid?(@type) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] type Object to be assigned + def type=(type) + validator = EnumAttributeValidator.new('String', ["accepted", "paid", "delivered"]) + unless validator.valid?(type) + fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." + end + @type = type + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + type == o.type + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [type].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/shop.rb b/lib/color_me_shop/models/shop.rb index 2a69f1a..b4215e3 100644 --- a/lib/color_me_shop/models/shop.rb +++ b/lib/color_me_shop/models/shop.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class Shop @@ -110,6 +111,21 @@ class Shop # 管理者携帯メールアドレス attr_accessor :shop_mail_2 + # 消費税の内税・外税設定 + attr_accessor :tax_type + + # 消費税率 + attr_accessor :tax + + # 消費税の切り捨て、切り上げ設定 + attr_accessor :tax_rounding_method + + # 軽減税率 + attr_accessor :reduce_tax_rate + + # ショップロゴ画像のURL + attr_accessor :shop_logo_url + class EnumAttributeValidator attr_reader :datatype attr_reader :allowable_values @@ -166,10 +182,20 @@ def self.attribute_map :'title' => :'title', :'title_short' => :'title_short', :'shop_mail_1' => :'shop_mail_1', - :'shop_mail_2' => :'shop_mail_2' + :'shop_mail_2' => :'shop_mail_2', + :'tax_type' => :'tax_type', + :'tax' => :'tax', + :'tax_rounding_method' => :'tax_rounding_method', + :'reduce_tax_rate' => :'reduce_tax_rate', + :'shop_logo_url' => :'shop_logo_url' } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -204,150 +230,196 @@ def self.openapi_types :'title' => :'String', :'title_short' => :'String', :'shop_mail_1' => :'String', - :'shop_mail_2' => :'String' + :'shop_mail_2' => :'String', + :'tax_type' => :'String', + :'tax' => :'Integer', + :'tax_rounding_method' => :'String', + :'reduce_tax_rate' => :'Integer', + :'shop_logo_url' => :'String' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'contract_term', + :'hojin', + :'hojin_kana', + :'fax', + :'title_short', + :'shop_mail_2', + :'shop_logo_url' + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::Shop` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::Shop`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'id') + if attributes.key?(:'id') self.id = attributes[:'id'] end - if attributes.has_key?(:'state') + if attributes.key?(:'state') self.state = attributes[:'state'] end - if attributes.has_key?(:'domain_plan') + if attributes.key?(:'domain_plan') self.domain_plan = attributes[:'domain_plan'] end - if attributes.has_key?(:'contract_plan') + if attributes.key?(:'contract_plan') self.contract_plan = attributes[:'contract_plan'] end - if attributes.has_key?(:'contract_start_date') + if attributes.key?(:'contract_start_date') self.contract_start_date = attributes[:'contract_start_date'] end - if attributes.has_key?(:'contract_end_date') + if attributes.key?(:'contract_end_date') self.contract_end_date = attributes[:'contract_end_date'] end - if attributes.has_key?(:'contract_term') + if attributes.key?(:'contract_term') self.contract_term = attributes[:'contract_term'] end - if attributes.has_key?(:'last_login_date') + if attributes.key?(:'last_login_date') self.last_login_date = attributes[:'last_login_date'] end - if attributes.has_key?(:'setup_date') + if attributes.key?(:'setup_date') self.setup_date = attributes[:'setup_date'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'url') + if attributes.key?(:'url') self.url = attributes[:'url'] end - if attributes.has_key?(:'open_state') + if attributes.key?(:'open_state') self.open_state = attributes[:'open_state'] end - if attributes.has_key?(:'mobile_open_state') + if attributes.key?(:'mobile_open_state') self.mobile_open_state = attributes[:'mobile_open_state'] end - if attributes.has_key?(:'login_id') + if attributes.key?(:'login_id') self.login_id = attributes[:'login_id'] end - if attributes.has_key?(:'name1') + if attributes.key?(:'name1') self.name1 = attributes[:'name1'] end - if attributes.has_key?(:'name2') + if attributes.key?(:'name2') self.name2 = attributes[:'name2'] end - if attributes.has_key?(:'name1_kana') + if attributes.key?(:'name1_kana') self.name1_kana = attributes[:'name1_kana'] end - if attributes.has_key?(:'name2_kana') + if attributes.key?(:'name2_kana') self.name2_kana = attributes[:'name2_kana'] end - if attributes.has_key?(:'hojin') + if attributes.key?(:'hojin') self.hojin = attributes[:'hojin'] end - if attributes.has_key?(:'hojin_kana') + if attributes.key?(:'hojin_kana') self.hojin_kana = attributes[:'hojin_kana'] end - if attributes.has_key?(:'user_mail') + if attributes.key?(:'user_mail') self.user_mail = attributes[:'user_mail'] end - if attributes.has_key?(:'tel') + if attributes.key?(:'tel') self.tel = attributes[:'tel'] end - if attributes.has_key?(:'fax') + if attributes.key?(:'fax') self.fax = attributes[:'fax'] end - if attributes.has_key?(:'postal') + if attributes.key?(:'postal') self.postal = attributes[:'postal'] end - if attributes.has_key?(:'pref_id') + if attributes.key?(:'pref_id') self.pref_id = attributes[:'pref_id'] end - if attributes.has_key?(:'pref_name') + if attributes.key?(:'pref_name') self.pref_name = attributes[:'pref_name'] end - if attributes.has_key?(:'address1') + if attributes.key?(:'address1') self.address1 = attributes[:'address1'] end - if attributes.has_key?(:'address2') + if attributes.key?(:'address2') self.address2 = attributes[:'address2'] end - if attributes.has_key?(:'title') + if attributes.key?(:'title') self.title = attributes[:'title'] end - if attributes.has_key?(:'title_short') + if attributes.key?(:'title_short') self.title_short = attributes[:'title_short'] end - if attributes.has_key?(:'shop_mail_1') + if attributes.key?(:'shop_mail_1') self.shop_mail_1 = attributes[:'shop_mail_1'] end - if attributes.has_key?(:'shop_mail_2') + if attributes.key?(:'shop_mail_2') self.shop_mail_2 = attributes[:'shop_mail_2'] end + + if attributes.key?(:'tax_type') + self.tax_type = attributes[:'tax_type'] + end + + if attributes.key?(:'tax') + self.tax = attributes[:'tax'] + end + + if attributes.key?(:'tax_rounding_method') + self.tax_rounding_method = attributes[:'tax_rounding_method'] + end + + if attributes.key?(:'reduce_tax_rate') + self.reduce_tax_rate = attributes[:'reduce_tax_rate'] + end + + if attributes.key?(:'shop_logo_url') + self.shop_logo_url = attributes[:'shop_logo_url'] + end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end @@ -355,25 +427,30 @@ def list_invalid_properties # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - state_validator = EnumAttributeValidator.new('String', ['enabled', 'suspended', 'unsigned']) + warn '[DEPRECATED] the `valid?` method is obsolete' + state_validator = EnumAttributeValidator.new('String', ["enabled", "suspended", "unsigned"]) return false unless state_validator.valid?(@state) - domain_plan_validator = EnumAttributeValidator.new('String', ['cmsp_sub_domain', 'own_domain', 'own_sub_domain']) + domain_plan_validator = EnumAttributeValidator.new('String', ["cmsp_sub_domain", "own_domain", "own_sub_domain"]) return false unless domain_plan_validator.valid?(@domain_plan) - contract_plan_validator = EnumAttributeValidator.new('String', ['unknown', 'economy', 'small', 'regular', 'lolipop', 'heteml', 'platinum', 'goope', 'large']) + contract_plan_validator = EnumAttributeValidator.new('String', ["unknown", "economy", "small", "regular", "lolipop", "heteml", "platinum", "goope", "large", "dormant", "free", "premium"]) return false unless contract_plan_validator.valid?(@contract_plan) - open_state_validator = EnumAttributeValidator.new('String', ['opened', 'closed', 'prepare', 'paused']) + open_state_validator = EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) return false unless open_state_validator.valid?(@open_state) - mobile_open_state_validator = EnumAttributeValidator.new('String', ['opened', 'closed', 'prepare', 'paused']) + mobile_open_state_validator = EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) return false unless mobile_open_state_validator.valid?(@mobile_open_state) + tax_type_validator = EnumAttributeValidator.new('String', ["excluded", "included"]) + return false unless tax_type_validator.valid?(@tax_type) + tax_rounding_method_validator = EnumAttributeValidator.new('String', ["round_off", "round_down", "round_up"]) + return false unless tax_rounding_method_validator.valid?(@tax_rounding_method) true end # Custom attribute writer method checking allowed values (enum). # @param [Object] state Object to be assigned def state=(state) - validator = EnumAttributeValidator.new('String', ['enabled', 'suspended', 'unsigned']) + validator = EnumAttributeValidator.new('String', ["enabled", "suspended", "unsigned"]) unless validator.valid?(state) - fail ArgumentError, 'invalid value for "state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"state\", must be one of #{validator.allowable_values}." end @state = state end @@ -381,9 +458,9 @@ def state=(state) # Custom attribute writer method checking allowed values (enum). # @param [Object] domain_plan Object to be assigned def domain_plan=(domain_plan) - validator = EnumAttributeValidator.new('String', ['cmsp_sub_domain', 'own_domain', 'own_sub_domain']) + validator = EnumAttributeValidator.new('String', ["cmsp_sub_domain", "own_domain", "own_sub_domain"]) unless validator.valid?(domain_plan) - fail ArgumentError, 'invalid value for "domain_plan", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"domain_plan\", must be one of #{validator.allowable_values}." end @domain_plan = domain_plan end @@ -391,9 +468,9 @@ def domain_plan=(domain_plan) # Custom attribute writer method checking allowed values (enum). # @param [Object] contract_plan Object to be assigned def contract_plan=(contract_plan) - validator = EnumAttributeValidator.new('String', ['unknown', 'economy', 'small', 'regular', 'lolipop', 'heteml', 'platinum', 'goope', 'large']) + validator = EnumAttributeValidator.new('String', ["unknown", "economy", "small", "regular", "lolipop", "heteml", "platinum", "goope", "large", "dormant", "free", "premium"]) unless validator.valid?(contract_plan) - fail ArgumentError, 'invalid value for "contract_plan", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"contract_plan\", must be one of #{validator.allowable_values}." end @contract_plan = contract_plan end @@ -401,9 +478,9 @@ def contract_plan=(contract_plan) # Custom attribute writer method checking allowed values (enum). # @param [Object] open_state Object to be assigned def open_state=(open_state) - validator = EnumAttributeValidator.new('String', ['opened', 'closed', 'prepare', 'paused']) + validator = EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) unless validator.valid?(open_state) - fail ArgumentError, 'invalid value for "open_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"open_state\", must be one of #{validator.allowable_values}." end @open_state = open_state end @@ -411,13 +488,33 @@ def open_state=(open_state) # Custom attribute writer method checking allowed values (enum). # @param [Object] mobile_open_state Object to be assigned def mobile_open_state=(mobile_open_state) - validator = EnumAttributeValidator.new('String', ['opened', 'closed', 'prepare', 'paused']) + validator = EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) unless validator.valid?(mobile_open_state) - fail ArgumentError, 'invalid value for "mobile_open_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"mobile_open_state\", must be one of #{validator.allowable_values}." end @mobile_open_state = mobile_open_state end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] tax_type Object to be assigned + def tax_type=(tax_type) + validator = EnumAttributeValidator.new('String', ["excluded", "included"]) + unless validator.valid?(tax_type) + fail ArgumentError, "invalid value for \"tax_type\", must be one of #{validator.allowable_values}." + end + @tax_type = tax_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] tax_rounding_method Object to be assigned + def tax_rounding_method=(tax_rounding_method) + validator = EnumAttributeValidator.new('String', ["round_off", "round_down", "round_up"]) + unless validator.valid?(tax_rounding_method) + fail ArgumentError, "invalid value for \"tax_rounding_method\", must be one of #{validator.allowable_values}." + end + @tax_rounding_method = tax_rounding_method + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -454,7 +551,12 @@ def ==(o) title == o.title && title_short == o.title_short && shop_mail_1 == o.shop_mail_1 && - shop_mail_2 == o.shop_mail_2 + shop_mail_2 == o.shop_mail_2 && + tax_type == o.tax_type && + tax == o.tax && + tax_rounding_method == o.tax_rounding_method && + reduce_tax_rate == o.reduce_tax_rate && + shop_logo_url == o.shop_logo_url end # @see the `==` method @@ -464,39 +566,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [id, state, domain_plan, contract_plan, contract_start_date, contract_end_date, contract_term, last_login_date, setup_date, make_date, url, open_state, mobile_open_state, login_id, name1, name2, name1_kana, name2_kana, hojin, hojin_kana, user_mail, tel, fax, postal, pref_id, pref_name, address1, address2, title, title_short, shop_mail_1, shop_mail_2].hash + [id, state, domain_plan, contract_plan, contract_start_date, contract_end_date, contract_term, last_login_date, setup_date, make_date, url, open_state, mobile_open_state, login_id, name1, name2, name1_kana, name2_kana, hojin, hojin_kana, user_mail, tel, fax, postal, pref_id, pref_name, address1, address2, title, title_short, shop_mail_1, shop_mail_2, tax_type, tax, tax_rounding_method, reduce_tax_rate, shop_logo_url].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -505,7 +610,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -526,8 +631,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -549,7 +655,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -572,5 +682,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/shop_coupon.rb b/lib/color_me_shop/models/shop_coupon.rb new file mode 100644 index 0000000..7793b1a --- /dev/null +++ b/lib/color_me_shop/models/shop_coupon.rb @@ -0,0 +1,415 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class ShopCoupon + # Coupon ID + attr_accessor :id + + # クーポン名 + attr_accessor :name + + # クーポンコード + attr_accessor :code + + # クーポン種別 - `amount`: 定額 - `rate`: 定率 - `delivery_charge`: 送料無料 + attr_accessor :coupon_type + + # 割引金額または割引率 + attr_accessor :discount_amount + + # 利用最低額 + attr_accessor :minimum_amount + + # 利用開始日 + attr_accessor :starts_at + + # 利用終了日 + attr_accessor :ends_at + + # 総利用可能数 + attr_accessor :total_usage_limit + + # ユーザ毎の利用可能数 - `indisposable`: 無制限 - `disposable`: 一度のみ + attr_accessor :usage_limit + + # 商品グループによる制限 - `none`: 無制限 - `including`: 含む - `excluding`: 除外 + attr_accessor :group_limit_type + + # クーポンの利用可否 - `unavailable`: 利用不可 - `available`: 利用可能 + attr_accessor :status + + # 作成日時 + attr_accessor :created_at + + # 更新日時 + attr_accessor :updated_at + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'code' => :'code', + :'coupon_type' => :'coupon_type', + :'discount_amount' => :'discount_amount', + :'minimum_amount' => :'minimum_amount', + :'starts_at' => :'starts_at', + :'ends_at' => :'ends_at', + :'total_usage_limit' => :'total_usage_limit', + :'usage_limit' => :'usage_limit', + :'group_limit_type' => :'group_limit_type', + :'status' => :'status', + :'created_at' => :'created_at', + :'updated_at' => :'updated_at' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'Integer', + :'name' => :'String', + :'code' => :'String', + :'coupon_type' => :'String', + :'discount_amount' => :'Integer', + :'minimum_amount' => :'Integer', + :'starts_at' => :'Integer', + :'ends_at' => :'Integer', + :'total_usage_limit' => :'Integer', + :'usage_limit' => :'String', + :'group_limit_type' => :'String', + :'status' => :'String', + :'created_at' => :'Integer', + :'updated_at' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::ShopCoupon` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::ShopCoupon`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'code') + self.code = attributes[:'code'] + end + + if attributes.key?(:'coupon_type') + self.coupon_type = attributes[:'coupon_type'] + end + + if attributes.key?(:'discount_amount') + self.discount_amount = attributes[:'discount_amount'] + end + + if attributes.key?(:'minimum_amount') + self.minimum_amount = attributes[:'minimum_amount'] + end + + if attributes.key?(:'starts_at') + self.starts_at = attributes[:'starts_at'] + end + + if attributes.key?(:'ends_at') + self.ends_at = attributes[:'ends_at'] + end + + if attributes.key?(:'total_usage_limit') + self.total_usage_limit = attributes[:'total_usage_limit'] + end + + if attributes.key?(:'usage_limit') + self.usage_limit = attributes[:'usage_limit'] + end + + if attributes.key?(:'group_limit_type') + self.group_limit_type = attributes[:'group_limit_type'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + coupon_type_validator = EnumAttributeValidator.new('String', ["amount", "rate", "delivery_charge"]) + return false unless coupon_type_validator.valid?(@coupon_type) + usage_limit_validator = EnumAttributeValidator.new('String', ["indisposable", "disposable"]) + return false unless usage_limit_validator.valid?(@usage_limit) + group_limit_type_validator = EnumAttributeValidator.new('String', ["none", "including", "excluding"]) + return false unless group_limit_type_validator.valid?(@group_limit_type) + status_validator = EnumAttributeValidator.new('String', ["unavailable", "available"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] coupon_type Object to be assigned + def coupon_type=(coupon_type) + validator = EnumAttributeValidator.new('String', ["amount", "rate", "delivery_charge"]) + unless validator.valid?(coupon_type) + fail ArgumentError, "invalid value for \"coupon_type\", must be one of #{validator.allowable_values}." + end + @coupon_type = coupon_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] usage_limit Object to be assigned + def usage_limit=(usage_limit) + validator = EnumAttributeValidator.new('String', ["indisposable", "disposable"]) + unless validator.valid?(usage_limit) + fail ArgumentError, "invalid value for \"usage_limit\", must be one of #{validator.allowable_values}." + end + @usage_limit = usage_limit + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] group_limit_type Object to be assigned + def group_limit_type=(group_limit_type) + validator = EnumAttributeValidator.new('String', ["none", "including", "excluding"]) + unless validator.valid?(group_limit_type) + fail ArgumentError, "invalid value for \"group_limit_type\", must be one of #{validator.allowable_values}." + end + @group_limit_type = group_limit_type + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["unavailable", "available"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + name == o.name && + code == o.code && + coupon_type == o.coupon_type && + discount_amount == o.discount_amount && + minimum_amount == o.minimum_amount && + starts_at == o.starts_at && + ends_at == o.ends_at && + total_usage_limit == o.total_usage_limit && + usage_limit == o.usage_limit && + group_limit_type == o.group_limit_type && + status == o.status && + created_at == o.created_at && + updated_at == o.updated_at + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [id, name, code, coupon_type, discount_amount, minimum_amount, starts_at, ends_at, total_usage_limit, usage_limit, group_limit_type, status, created_at, updated_at].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/stat_sale200_response.rb b/lib/color_me_shop/models/stat_sale200_response.rb new file mode 100644 index 0000000..50c5e34 --- /dev/null +++ b/lib/color_me_shop/models/stat_sale200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class StatSale200Response + attr_accessor :sales_stat + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sales_stat' => :'sales_stat' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sales_stat' => :'StatSale200ResponseSalesStat' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::StatSale200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::StatSale200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sales_stat') + self.sales_stat = attributes[:'sales_stat'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sales_stat == o.sales_stat + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sales_stat].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/stat_sale200_response_sales_stat.rb b/lib/color_me_shop/models/stat_sale200_response_sales_stat.rb new file mode 100644 index 0000000..da52ed2 --- /dev/null +++ b/lib/color_me_shop/models/stat_sale200_response_sales_stat.rb @@ -0,0 +1,285 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class StatSale200ResponseSalesStat + # ショップアカウントID + attr_accessor :account_id + + # 集計対象とする売上の作成日 + attr_accessor :date + + # 合計売上金額 + attr_accessor :amount_today + + # 合計件数 + attr_accessor :count_today + + # `date`を含む過去7日間の合計売上金額 + attr_accessor :amount_last_7days + + # `date`を含む過去7日間の合計件数 + attr_accessor :count_last_7days + + # `date`が含まれる月の合計売上金額 + attr_accessor :amount_this_month + + # `date`が含まれる月の合計件数 + attr_accessor :count_this_month + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'account_id' => :'account_id', + :'date' => :'date', + :'amount_today' => :'amount_today', + :'count_today' => :'count_today', + :'amount_last_7days' => :'amount_last_7days', + :'count_last_7days' => :'count_last_7days', + :'amount_this_month' => :'amount_this_month', + :'count_this_month' => :'count_this_month' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'account_id' => :'String', + :'date' => :'Integer', + :'amount_today' => :'Integer', + :'count_today' => :'Integer', + :'amount_last_7days' => :'Integer', + :'count_last_7days' => :'Integer', + :'amount_this_month' => :'Integer', + :'count_this_month' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::StatSale200ResponseSalesStat` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::StatSale200ResponseSalesStat`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'account_id') + self.account_id = attributes[:'account_id'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'amount_today') + self.amount_today = attributes[:'amount_today'] + end + + if attributes.key?(:'count_today') + self.count_today = attributes[:'count_today'] + end + + if attributes.key?(:'amount_last_7days') + self.amount_last_7days = attributes[:'amount_last_7days'] + end + + if attributes.key?(:'count_last_7days') + self.count_last_7days = attributes[:'count_last_7days'] + end + + if attributes.key?(:'amount_this_month') + self.amount_this_month = attributes[:'amount_this_month'] + end + + if attributes.key?(:'count_this_month') + self.count_this_month = attributes[:'count_this_month'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + account_id == o.account_id && + date == o.date && + amount_today == o.amount_today && + count_today == o.count_today && + amount_last_7days == o.amount_last_7days && + count_last_7days == o.count_last_7days && + amount_this_month == o.amount_this_month && + count_this_month == o.count_this_month + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [account_id, date, amount_today, count_today, amount_last_7days, count_last_7days, amount_this_month, count_this_month].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/stock.rb b/lib/color_me_shop/models/stock.rb index 431885f..e0ad470 100644 --- a/lib/color_me_shop/models/stock.rb +++ b/lib/color_me_shop/models/stock.rb @@ -1,16 +1,17 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.2.0-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end require 'date' +require 'time' module ColorMeShop class Stock @@ -38,9 +39,12 @@ class Stock # 型番 attr_accessor :model_number + # オプションの型番 + attr_accessor :variant_model_number + attr_accessor :category - # 掲載設定 + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 attr_accessor :display_state # 販売価格 @@ -58,6 +62,9 @@ class Stock # 個別送料 attr_accessor :delivery_charge + # クール便の追加料金 + attr_accessor :cool_charge + # 最小購入数量 attr_accessor :min_num @@ -148,6 +155,7 @@ def self.attribute_map :'stocks' => :'stocks', :'few_num' => :'few_num', :'model_number' => :'model_number', + :'variant_model_number' => :'variant_model_number', :'category' => :'category', :'display_state' => :'display_state', :'sales_price' => :'sales_price', @@ -155,6 +163,7 @@ def self.attribute_map :'members_price' => :'members_price', :'cost' => :'cost', :'delivery_charge' => :'delivery_charge', + :'cool_charge' => :'cool_charge', :'min_num' => :'min_num', :'max_num' => :'max_num', :'sale_start_date' => :'sale_start_date', @@ -177,6 +186,11 @@ def self.attribute_map } end + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + # Attribute type mapping. def self.openapi_types { @@ -188,20 +202,22 @@ def self.openapi_types :'stocks' => :'Integer', :'few_num' => :'Integer', :'model_number' => :'String', - :'category' => :'Object', + :'variant_model_number' => :'String', + :'category' => :'GetProducts200ResponseProductsInnerCategory', :'display_state' => :'String', :'sales_price' => :'Integer', :'price' => :'Integer', :'members_price' => :'Integer', :'cost' => :'Integer', :'delivery_charge' => :'Integer', + :'cool_charge' => :'Integer', :'min_num' => :'Integer', :'max_num' => :'Integer', :'sale_start_date' => :'Integer', :'sale_end_date' => :'Integer', :'unit' => :'String', :'weight' => :'Integer', - :'soldout_display' => :'BOOLEAN', + :'soldout_display' => :'Boolean', :'sort' => :'Integer', :'simple_expl' => :'String', :'expl' => :'String', @@ -213,151 +229,200 @@ def self.openapi_types :'image_url' => :'String', :'mobile_image_url' => :'String', :'thumbnail_image_url' => :'String', - :'images' => :'Array' + :'images' => :'Array' } end + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'option1_value', + :'option2_value', + :'stocks', + :'few_num', + :'model_number', + :'variant_model_number', + :'category', + :'sales_price', + :'price', + :'members_price', + :'cost', + :'delivery_charge', + :'cool_charge', + :'min_num', + :'max_num', + :'sale_start_date', + :'sale_end_date', + :'unit', + :'weight', + :'sort', + :'simple_expl', + :'expl', + :'mobile_expl', + :'smartphone_expl', + :'memo', + :'image_url', + :'mobile_image_url', + :'thumbnail_image_url', + ]) + end + # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - return unless attributes.is_a?(Hash) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::Stock` initialize method" + end - # convert string to symbol for hash key - attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::Stock`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } - if attributes.has_key?(:'account_id') + if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end - if attributes.has_key?(:'product_id') + if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] end - if attributes.has_key?(:'name') + if attributes.key?(:'name') self.name = attributes[:'name'] end - if attributes.has_key?(:'option1_value') + if attributes.key?(:'option1_value') self.option1_value = attributes[:'option1_value'] end - if attributes.has_key?(:'option2_value') + if attributes.key?(:'option2_value') self.option2_value = attributes[:'option2_value'] end - if attributes.has_key?(:'stocks') + if attributes.key?(:'stocks') self.stocks = attributes[:'stocks'] end - if attributes.has_key?(:'few_num') + if attributes.key?(:'few_num') self.few_num = attributes[:'few_num'] end - if attributes.has_key?(:'model_number') + if attributes.key?(:'model_number') self.model_number = attributes[:'model_number'] end - if attributes.has_key?(:'category') + if attributes.key?(:'variant_model_number') + self.variant_model_number = attributes[:'variant_model_number'] + end + + if attributes.key?(:'category') self.category = attributes[:'category'] end - if attributes.has_key?(:'display_state') + if attributes.key?(:'display_state') self.display_state = attributes[:'display_state'] end - if attributes.has_key?(:'sales_price') + if attributes.key?(:'sales_price') self.sales_price = attributes[:'sales_price'] end - if attributes.has_key?(:'price') + if attributes.key?(:'price') self.price = attributes[:'price'] end - if attributes.has_key?(:'members_price') + if attributes.key?(:'members_price') self.members_price = attributes[:'members_price'] end - if attributes.has_key?(:'cost') + if attributes.key?(:'cost') self.cost = attributes[:'cost'] end - if attributes.has_key?(:'delivery_charge') + if attributes.key?(:'delivery_charge') self.delivery_charge = attributes[:'delivery_charge'] end - if attributes.has_key?(:'min_num') + if attributes.key?(:'cool_charge') + self.cool_charge = attributes[:'cool_charge'] + end + + if attributes.key?(:'min_num') self.min_num = attributes[:'min_num'] end - if attributes.has_key?(:'max_num') + if attributes.key?(:'max_num') self.max_num = attributes[:'max_num'] end - if attributes.has_key?(:'sale_start_date') + if attributes.key?(:'sale_start_date') self.sale_start_date = attributes[:'sale_start_date'] end - if attributes.has_key?(:'sale_end_date') + if attributes.key?(:'sale_end_date') self.sale_end_date = attributes[:'sale_end_date'] end - if attributes.has_key?(:'unit') + if attributes.key?(:'unit') self.unit = attributes[:'unit'] end - if attributes.has_key?(:'weight') + if attributes.key?(:'weight') self.weight = attributes[:'weight'] end - if attributes.has_key?(:'soldout_display') + if attributes.key?(:'soldout_display') self.soldout_display = attributes[:'soldout_display'] end - if attributes.has_key?(:'sort') + if attributes.key?(:'sort') self.sort = attributes[:'sort'] end - if attributes.has_key?(:'simple_expl') + if attributes.key?(:'simple_expl') self.simple_expl = attributes[:'simple_expl'] end - if attributes.has_key?(:'expl') + if attributes.key?(:'expl') self.expl = attributes[:'expl'] end - if attributes.has_key?(:'mobile_expl') + if attributes.key?(:'mobile_expl') self.mobile_expl = attributes[:'mobile_expl'] end - if attributes.has_key?(:'smartphone_expl') + if attributes.key?(:'smartphone_expl') self.smartphone_expl = attributes[:'smartphone_expl'] end - if attributes.has_key?(:'make_date') + if attributes.key?(:'make_date') self.make_date = attributes[:'make_date'] end - if attributes.has_key?(:'update_date') + if attributes.key?(:'update_date') self.update_date = attributes[:'update_date'] end - if attributes.has_key?(:'memo') + if attributes.key?(:'memo') self.memo = attributes[:'memo'] end - if attributes.has_key?(:'image_url') + if attributes.key?(:'image_url') self.image_url = attributes[:'image_url'] end - if attributes.has_key?(:'mobile_image_url') + if attributes.key?(:'mobile_image_url') self.mobile_image_url = attributes[:'mobile_image_url'] end - if attributes.has_key?(:'thumbnail_image_url') + if attributes.key?(:'thumbnail_image_url') self.thumbnail_image_url = attributes[:'thumbnail_image_url'] end - if attributes.has_key?(:'images') + if attributes.key?(:'images') if (value = attributes[:'images']).is_a?(Array) self.images = value end @@ -367,28 +432,49 @@ def initialize(attributes = {}) # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new + if !@images.nil? && @images.length > 6 + invalid_properties.push('invalid value for "images", number of items must be less than or equal to 6.') + end + invalid_properties end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - display_state_validator = EnumAttributeValidator.new('String', ['showing', 'hidden', 'showing_for_members', 'sale_for_members']) + warn '[DEPRECATED] the `valid?` method is obsolete' + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) return false unless display_state_validator.valid?(@display_state) + return false if !@images.nil? && @images.length > 6 true end # Custom attribute writer method checking allowed values (enum). # @param [Object] display_state Object to be assigned def display_state=(display_state) - validator = EnumAttributeValidator.new('String', ['showing', 'hidden', 'showing_for_members', 'sale_for_members']) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) unless validator.valid?(display_state) - fail ArgumentError, 'invalid value for "display_state", must be one of #{validator.allowable_values}.' + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." end @display_state = display_state end + # Custom attribute writer method with validation + # @param [Object] images Value to be assigned + def images=(images) + if images.nil? + fail ArgumentError, 'images cannot be nil' + end + + if images.length > 6 + fail ArgumentError, 'invalid value for "images", number of items must be less than or equal to 6.' + end + + @images = images + end + # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) @@ -402,6 +488,7 @@ def ==(o) stocks == o.stocks && few_num == o.few_num && model_number == o.model_number && + variant_model_number == o.variant_model_number && category == o.category && display_state == o.display_state && sales_price == o.sales_price && @@ -409,6 +496,7 @@ def ==(o) members_price == o.members_price && cost == o.cost && delivery_charge == o.delivery_charge && + cool_charge == o.cool_charge && min_num == o.min_num && max_num == o.max_num && sale_start_date == o.sale_start_date && @@ -437,39 +525,42 @@ def eql?(o) end # Calculates hash code according to all attributes. - # @return [Fixnum] Hash code + # @return [Integer] Hash code def hash - [account_id, product_id, name, option1_value, option2_value, stocks, few_num, model_number, category, display_state, sales_price, price, members_price, cost, delivery_charge, min_num, max_num, sale_start_date, sale_end_date, unit, weight, soldout_display, sort, simple_expl, expl, mobile_expl, smartphone_expl, make_date, update_date, memo, image_url, mobile_image_url, thumbnail_image_url, images].hash + [account_id, product_id, name, option1_value, option2_value, stocks, few_num, model_number, variant_model_number, category, display_state, sales_price, price, members_price, cost, delivery_charge, cool_charge, min_num, max_num, sale_start_date, sale_end_date, unit, weight, soldout_display, sort, simple_expl, expl, mobile_expl, smartphone_expl, make_date, update_date, memo, image_url, mobile_image_url, thumbnail_image_url, images].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself - def build_from_hash(attributes) + def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) - self.class.openapi_types.each_pair do |key, type| - if type =~ /\AArray<(.*)>/i - # check to ensure the input is an array given that the the attribute + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute # is documented as an array but the input is not - if attributes[self.class.attribute_map[key]].is_a?(Array) - self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end - elsif !attributes[self.class.attribute_map[key]].nil? - self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) - end # or else data not found in attributes(hash), not an issue as the data can be optional + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end end - - self + new(transformed_hash) end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data - def _deserialize(type, value) + def self._deserialize(type, value) case type.to_sym - when :DateTime - DateTime.parse(value) + when :Time + Time.parse(value) when :Date Date.parse(value) when :String @@ -478,7 +569,7 @@ def _deserialize(type, value) value.to_i when :Float value.to_f - when :BOOLEAN + when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else @@ -499,8 +590,9 @@ def _deserialize(type, value) end end else # model - temp_model = ColorMeShop.const_get(type).new - temp_model.build_from_hash(value) + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end @@ -522,7 +614,11 @@ def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) - next if value.nil? + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + hash[param] = _to_hash(value) end hash @@ -545,5 +641,7 @@ def _to_hash(value) value end end + end + end diff --git a/lib/color_me_shop/models/update_product_request.rb b/lib/color_me_shop/models/update_product_request.rb new file mode 100644 index 0000000..0421367 --- /dev/null +++ b/lib/color_me_shop/models/update_product_request.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class UpdateProductRequest + attr_accessor :product + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'product' => :'product' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'product' => :'UpdateProductRequestProduct' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::UpdateProductRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::UpdateProductRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'product') + self.product = attributes[:'product'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + product == o.product + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [product].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/update_product_request_product.rb b/lib/color_me_shop/models/update_product_request_product.rb new file mode 100644 index 0000000..bea9943 --- /dev/null +++ b/lib/color_me_shop/models/update_product_request_product.rb @@ -0,0 +1,526 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class UpdateProductRequestProduct + # 商品名 + attr_accessor :name + + # 定価 + attr_accessor :price + + # 大カテゴリーID + attr_accessor :category_id_big + + # 小カテゴリーID + attr_accessor :category_id_small + + # 原価 + attr_accessor :cost + + # 販売価格 フリープランを利用しているショップの場合、最低価格は100円です。 + attr_accessor :sales_price + + # 会員価格 フリープランを利用しているショップの場合、最低価格は100円です。 + attr_accessor :members_price + + # 型番 + attr_accessor :model_number + + # 商品説明 + attr_accessor :expl + + # 簡易説明 + attr_accessor :simple_expl + + # スマホ向けショップの商品説明 + attr_accessor :smartphone_expl + + # 掲載設定 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + attr_accessor :display_state + + # 在庫管理する場合は `true` + attr_accessor :stock_managed + + attr_accessor :stocks + + # グループIDの配列 + attr_accessor :group_ids + + # 商品オプションによるバリエーションごとに更新 + attr_accessor :variants + + # `true` の場合は軽減税率対象 + attr_accessor :tax_reduced + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'price' => :'price', + :'category_id_big' => :'category_id_big', + :'category_id_small' => :'category_id_small', + :'cost' => :'cost', + :'sales_price' => :'sales_price', + :'members_price' => :'members_price', + :'model_number' => :'model_number', + :'expl' => :'expl', + :'simple_expl' => :'simple_expl', + :'smartphone_expl' => :'smartphone_expl', + :'display_state' => :'display_state', + :'stock_managed' => :'stock_managed', + :'stocks' => :'stocks', + :'group_ids' => :'group_ids', + :'variants' => :'variants', + :'tax_reduced' => :'tax_reduced' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'price' => :'Integer', + :'category_id_big' => :'Integer', + :'category_id_small' => :'Integer', + :'cost' => :'Integer', + :'sales_price' => :'Integer', + :'members_price' => :'Integer', + :'model_number' => :'String', + :'expl' => :'String', + :'simple_expl' => :'String', + :'smartphone_expl' => :'String', + :'display_state' => :'String', + :'stock_managed' => :'Boolean', + :'stocks' => :'UpdateProductRequestProductStocks', + :'group_ids' => :'Array', + :'variants' => :'Array', + :'tax_reduced' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::UpdateProductRequestProduct` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::UpdateProductRequestProduct`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'price') + self.price = attributes[:'price'] + end + + if attributes.key?(:'category_id_big') + self.category_id_big = attributes[:'category_id_big'] + end + + if attributes.key?(:'category_id_small') + self.category_id_small = attributes[:'category_id_small'] + end + + if attributes.key?(:'cost') + self.cost = attributes[:'cost'] + end + + if attributes.key?(:'sales_price') + self.sales_price = attributes[:'sales_price'] + end + + if attributes.key?(:'members_price') + self.members_price = attributes[:'members_price'] + end + + if attributes.key?(:'model_number') + self.model_number = attributes[:'model_number'] + end + + if attributes.key?(:'expl') + self.expl = attributes[:'expl'] + end + + if attributes.key?(:'simple_expl') + self.simple_expl = attributes[:'simple_expl'] + end + + if attributes.key?(:'smartphone_expl') + self.smartphone_expl = attributes[:'smartphone_expl'] + end + + if attributes.key?(:'display_state') + self.display_state = attributes[:'display_state'] + end + + if attributes.key?(:'stock_managed') + self.stock_managed = attributes[:'stock_managed'] + end + + if attributes.key?(:'stocks') + self.stocks = attributes[:'stocks'] + end + + if attributes.key?(:'group_ids') + if (value = attributes[:'group_ids']).is_a?(Array) + self.group_ids = value + end + end + + if attributes.key?(:'variants') + if (value = attributes[:'variants']).is_a?(Array) + self.variants = value + end + end + + if attributes.key?(:'tax_reduced') + self.tax_reduced = attributes[:'tax_reduced'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if !@name.nil? && @name.to_s.length > 100 + invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.') + end + + if !@cost.nil? && @cost < 0 + invalid_properties.push('invalid value for "cost", must be greater than or equal to 0.') + end + + if !@sales_price.nil? && @sales_price < 0 + invalid_properties.push('invalid value for "sales_price", must be greater than or equal to 0.') + end + + if !@members_price.nil? && @members_price < 0 + invalid_properties.push('invalid value for "members_price", must be greater than or equal to 0.') + end + + if !@model_number.nil? && @model_number.to_s.length > 50 + invalid_properties.push('invalid value for "model_number", the character length must be smaller than or equal to 50.') + end + + if !@simple_expl.nil? && @simple_expl.to_s.length > 255 + invalid_properties.push('invalid value for "simple_expl", the character length must be smaller than or equal to 255.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if !@name.nil? && @name.to_s.length > 100 + return false if !@cost.nil? && @cost < 0 + return false if !@sales_price.nil? && @sales_price < 0 + return false if !@members_price.nil? && @members_price < 0 + return false if !@model_number.nil? && @model_number.to_s.length > 50 + return false if !@simple_expl.nil? && @simple_expl.to_s.length > 255 + display_state_validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + return false unless display_state_validator.valid?(@display_state) + true + end + + # Custom attribute writer method with validation + # @param [Object] name Value to be assigned + def name=(name) + if name.nil? + fail ArgumentError, 'name cannot be nil' + end + + if name.to_s.length > 100 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.' + end + + @name = name + end + + # Custom attribute writer method with validation + # @param [Object] cost Value to be assigned + def cost=(cost) + if cost.nil? + fail ArgumentError, 'cost cannot be nil' + end + + if cost < 0 + fail ArgumentError, 'invalid value for "cost", must be greater than or equal to 0.' + end + + @cost = cost + end + + # Custom attribute writer method with validation + # @param [Object] sales_price Value to be assigned + def sales_price=(sales_price) + if sales_price.nil? + fail ArgumentError, 'sales_price cannot be nil' + end + + if sales_price < 0 + fail ArgumentError, 'invalid value for "sales_price", must be greater than or equal to 0.' + end + + @sales_price = sales_price + end + + # Custom attribute writer method with validation + # @param [Object] members_price Value to be assigned + def members_price=(members_price) + if members_price.nil? + fail ArgumentError, 'members_price cannot be nil' + end + + if members_price < 0 + fail ArgumentError, 'invalid value for "members_price", must be greater than or equal to 0.' + end + + @members_price = members_price + end + + # Custom attribute writer method with validation + # @param [Object] model_number Value to be assigned + def model_number=(model_number) + if model_number.nil? + fail ArgumentError, 'model_number cannot be nil' + end + + if model_number.to_s.length > 50 + fail ArgumentError, 'invalid value for "model_number", the character length must be smaller than or equal to 50.' + end + + @model_number = model_number + end + + # Custom attribute writer method with validation + # @param [Object] simple_expl Value to be assigned + def simple_expl=(simple_expl) + if simple_expl.nil? + fail ArgumentError, 'simple_expl cannot be nil' + end + + if simple_expl.to_s.length > 255 + fail ArgumentError, 'invalid value for "simple_expl", the character length must be smaller than or equal to 255.' + end + + @simple_expl = simple_expl + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] display_state Object to be assigned + def display_state=(display_state) + validator = EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + unless validator.valid?(display_state) + fail ArgumentError, "invalid value for \"display_state\", must be one of #{validator.allowable_values}." + end + @display_state = display_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + price == o.price && + category_id_big == o.category_id_big && + category_id_small == o.category_id_small && + cost == o.cost && + sales_price == o.sales_price && + members_price == o.members_price && + model_number == o.model_number && + expl == o.expl && + simple_expl == o.simple_expl && + smartphone_expl == o.smartphone_expl && + display_state == o.display_state && + stock_managed == o.stock_managed && + stocks == o.stocks && + group_ids == o.group_ids && + variants == o.variants && + tax_reduced == o.tax_reduced + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, price, category_id_big, category_id_small, cost, sales_price, members_price, model_number, expl, simple_expl, smartphone_expl, display_state, stock_managed, stocks, group_ids, variants, tax_reduced].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/update_product_request_product_stocks.rb b/lib/color_me_shop/models/update_product_request_product_stocks.rb new file mode 100644 index 0000000..89d7e6f --- /dev/null +++ b/lib/color_me_shop/models/update_product_request_product_stocks.rb @@ -0,0 +1,106 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + # 数値を指定した場合は、在庫数をその数値で更新します。(商品オプションごとに在庫管理している場合、このパラメータは無視されます) 以下のように`increment`を利用すると、その数値だけ在庫数を増減させることが可能です。(負の値も指定可) ```json \"stocks\": { \"increment\": 3 } ``` + module UpdateProductRequestProductStocks + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Integer', + :'UpdateProductRequestProductStocksOneOf' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = ColorMeShop.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/color_me_shop/models/update_product_request_product_stocks_one_of.rb b/lib/color_me_shop/models/update_product_request_product_stocks_one_of.rb new file mode 100644 index 0000000..e807674 --- /dev/null +++ b/lib/color_me_shop/models/update_product_request_product_stocks_one_of.rb @@ -0,0 +1,215 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class UpdateProductRequestProductStocksOneOf + # 在庫数の増減値 + attr_accessor :increment + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'increment' => :'increment' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'increment' => :'Integer' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::UpdateProductRequestProductStocksOneOf` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::UpdateProductRequestProductStocksOneOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'increment') + self.increment = attributes[:'increment'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + increment == o.increment + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [increment].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/update_product_request_product_variants_inner.rb b/lib/color_me_shop/models/update_product_request_product_variants_inner.rb new file mode 100644 index 0000000..cd6aa5f --- /dev/null +++ b/lib/color_me_shop/models/update_product_request_product_variants_inner.rb @@ -0,0 +1,234 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class UpdateProductRequestProductVariantsInner + # オプション1の値 + attr_accessor :option1_value + + # オプション2の値 + attr_accessor :option2_value + + attr_accessor :stocks + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'option1_value' => :'option1_value', + :'option2_value' => :'option2_value', + :'stocks' => :'stocks' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'option1_value' => :'String', + :'option2_value' => :'String', + :'stocks' => :'UpdateProductRequestProductVariantsInnerStocks' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::UpdateProductRequestProductVariantsInner` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::UpdateProductRequestProductVariantsInner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'option1_value') + self.option1_value = attributes[:'option1_value'] + end + + if attributes.key?(:'option2_value') + self.option2_value = attributes[:'option2_value'] + end + + if attributes.key?(:'stocks') + self.stocks = attributes[:'stocks'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + option1_value == o.option1_value && + option2_value == o.option2_value && + stocks == o.stocks + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [option1_value, option2_value, stocks].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/update_product_request_product_variants_inner_stocks.rb b/lib/color_me_shop/models/update_product_request_product_variants_inner_stocks.rb new file mode 100644 index 0000000..863fe1a --- /dev/null +++ b/lib/color_me_shop/models/update_product_request_product_variants_inner_stocks.rb @@ -0,0 +1,106 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + # 上記`stocks`と同様に、数値、または増減値を用いて在庫数を更新できます。 + module UpdateProductRequestProductVariantsInnerStocks + class << self + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'Integer', + :'UpdateProductRequestProductStocksOneOf' + ] + end + + # Builds the object + # @param [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + openapi_one_of.include?(:AnyType) ? data : nil + end + + private + + SchemaMismatchError = Class.new(StandardError) + + # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse. + def find_and_cast_into_type(klass, data) + return if data.nil? + + case klass.to_s + when 'Boolean' + return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass) + when 'Float' + return data if data.instance_of?(Float) + when 'Integer' + return data if data.instance_of?(Integer) + when 'Time' + return Time.parse(data) + when 'Date' + return Date.parse(data) + when 'String' + return data if data.instance_of?(String) + when 'Object' # "type: object" + return data if data.instance_of?(Hash) + when /\AArray<(?.+)>\z/ # "type: array" + if data.instance_of?(Array) + sub_type = Regexp.last_match[:sub_type] + return data.map { |item| find_and_cast_into_type(sub_type, item) } + end + when /\AHash.+)>\z/ # "type: object" with "additionalProperties: { ... }" + if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) } + sub_type = Regexp.last_match[:sub_type] + return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) } + end + else # model + const = ColorMeShop.const_get(klass) + if const + if const.respond_to?(:openapi_one_of) # nested oneOf model + model = const.build(data) + return model if model + else + # raise if data contains keys that are not known to the model + raise unless (data.keys - const.acceptable_attributes).empty? + model = const.build_from_hash(data) + return model if model + end + end + end + + raise # if no match by now, raise + rescue + raise SchemaMismatchError, "#{data} doesn't match the #{klass} type" + end + end + end + +end diff --git a/lib/color_me_shop/models/update_sale200_response.rb b/lib/color_me_shop/models/update_sale200_response.rb new file mode 100644 index 0000000..c106674 --- /dev/null +++ b/lib/color_me_shop/models/update_sale200_response.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class UpdateSale200Response + attr_accessor :sale + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sale' => :'sale' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sale' => :'GetSales200ResponseSalesInner' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::UpdateSale200Response` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::UpdateSale200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sale') + self.sale = attributes[:'sale'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sale == o.sale + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sale].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/update_sale_request.rb b/lib/color_me_shop/models/update_sale_request.rb new file mode 100644 index 0000000..7135015 --- /dev/null +++ b/lib/color_me_shop/models/update_sale_request.rb @@ -0,0 +1,214 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class UpdateSaleRequest + attr_accessor :sale + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'sale' => :'sale' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'sale' => :'UpdateSaleRequestSale' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::UpdateSaleRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::UpdateSaleRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'sale') + self.sale = attributes[:'sale'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + sale == o.sale + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [sale].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/models/update_sale_request_sale.rb b/lib/color_me_shop/models/update_sale_request_sale.rb new file mode 100644 index 0000000..fae2a66 --- /dev/null +++ b/lib/color_me_shop/models/update_sale_request_sale.rb @@ -0,0 +1,270 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module ColorMeShop + class UpdateSaleRequestSale + # 入金済みであるか否か + attr_accessor :paid + + # ショップポイントの付与状態。`fixed`へ変更すると、購入者にショップポイントが付与される。`fixed`から別のステータスには変更できない また、受注が分割されている場合、子受注のショップポイント付与状態は変更することができません。 - `assumed`: 仮付与 - `fixed`: 確定済み - `cenceled`: キャンセル済み + attr_accessor :point_state + + attr_accessor :sale_deliveries + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'paid' => :'paid', + :'point_state' => :'point_state', + :'sale_deliveries' => :'sale_deliveries' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'paid' => :'Boolean', + :'point_state' => :'String', + :'sale_deliveries' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `ColorMeShop::UpdateSaleRequestSale` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `ColorMeShop::UpdateSaleRequestSale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'paid') + self.paid = attributes[:'paid'] + end + + if attributes.key?(:'point_state') + self.point_state = attributes[:'point_state'] + end + + if attributes.key?(:'sale_deliveries') + if (value = attributes[:'sale_deliveries']).is_a?(Array) + self.sale_deliveries = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + point_state_validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "cenceled"]) + return false unless point_state_validator.valid?(@point_state) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] point_state Object to be assigned + def point_state=(point_state) + validator = EnumAttributeValidator.new('String', ["assumed", "fixed", "cenceled"]) + unless validator.valid?(point_state) + fail ArgumentError, "invalid value for \"point_state\", must be one of #{validator.allowable_values}." + end + @point_state = point_state + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + paid == o.paid && + point_state == o.point_state && + sale_deliveries == o.sale_deliveries + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [paid, point_state, sale_deliveries].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = ColorMeShop.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/color_me_shop/version.rb b/lib/color_me_shop/version.rb index ddf5d56..826aa7b 100644 --- a/lib/color_me_shop/version.rb +++ b/lib/color_me_shop/version.rb @@ -1,3 +1,15 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + module ColorMeShop - VERSION = '1.2.0.rc1' + VERSION = '1.1.0' end diff --git a/spec/api/category_api_spec.rb b/spec/api/category_api_spec.rb new file mode 100644 index 0000000..2df0706 --- /dev/null +++ b/spec/api/category_api_spec.rb @@ -0,0 +1,46 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::CategoryApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CategoryApi' do + before do + # run before each test + @api_instance = ColorMeShop::CategoryApi.new + end + + after do + # run after each test + end + + describe 'test an instance of CategoryApi' do + it 'should create an instance of CategoryApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::CategoryApi) + end + end + + # unit tests for get_product_categories + # 商品カテゴリー一覧を取得 + # + # @param [Hash] opts the optional parameters + # @return [GetProductCategories200Response] + describe 'get_product_categories test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/customer_api_spec.rb b/spec/api/customer_api_spec.rb new file mode 100644 index 0000000..eef1b85 --- /dev/null +++ b/spec/api/customer_api_spec.rb @@ -0,0 +1,85 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::CustomerApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'CustomerApi' do + before do + # run before each test + @api_instance = ColorMeShop::CustomerApi.new + end + + after do + # run after each test + end + + describe 'test an instance of CustomerApi' do + it 'should create an instance of CustomerApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::CustomerApi) + end + end + + # unit tests for get_customer + # 顧客データの取得 + # + # @param customer_id + # @param [Hash] opts the optional parameters + # @return [GetCustomer200Response] + describe 'get_customer test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_customers + # 顧客データのリストを取得 + # + # @param [Hash] opts the optional parameters + # @option opts [String] :ids 顧客IDで検索。カンマ区切りで複数指定可能 + # @option opts [String] :name 顧客名で部分一致検索 + # @option opts [String] :furigana 顧客フリガナで部分一致検索 + # @option opts [String] :mail 顧客メールアドレスで部分一致検索 + # @option opts [String] :postal 顧客の郵便番号で部分一致検索 + # @option opts [String] :tel 顧客の電話番号で部分一致検索 + # @option opts [String] :sex 顧客の性別で検索 - `male`: 男性 - `female`: 女性 + # @option opts [Boolean] :member `true`なら会員登録済みの顧客から検索 + # @option opts [Boolean] :receive_mail_magazine メルマガ受信可否で検索 + # @option opts [String] :make_date_min 指定日時以降に登録された顧客から検索 + # @option opts [String] :make_date_max 指定日時以前に登録された顧客から検索 + # @option opts [String] :update_date_min 指定日時以降に更新された顧客から検索 + # @option opts [String] :update_date_max 指定日時以前に更新された顧客から検索 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大100 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [GetCustomers200Response] + describe 'get_customers test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for post_customers + # 顧客データを追加 + # + # @param [Hash] opts the optional parameters + # @option opts [PostCustomersRequest] :post_customers_request + # @return [PostCustomers200Response] + describe 'post_customers test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/delivery_api_spec.rb b/spec/api/delivery_api_spec.rb new file mode 100644 index 0000000..6b5637b --- /dev/null +++ b/spec/api/delivery_api_spec.rb @@ -0,0 +1,57 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::DeliveryApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'DeliveryApi' do + before do + # run before each test + @api_instance = ColorMeShop::DeliveryApi.new + end + + after do + # run after each test + end + + describe 'test an instance of DeliveryApi' do + it 'should create an instance of DeliveryApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::DeliveryApi) + end + end + + # unit tests for get_deliveries + # 配送方法一覧を取得 + # + # @param [Hash] opts the optional parameters + # @return [GetDeliveries200Response] + describe 'get_deliveries test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_delivery_date_setting + # 配送日時設定を取得 + # + # @param [Hash] opts the optional parameters + # @return [GetDeliveryDateSetting200Response] + describe 'get_delivery_date_setting test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/gift_api_spec.rb b/spec/api/gift_api_spec.rb new file mode 100644 index 0000000..eff4a5e --- /dev/null +++ b/spec/api/gift_api_spec.rb @@ -0,0 +1,46 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::GiftApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GiftApi' do + before do + # run before each test + @api_instance = ColorMeShop::GiftApi.new + end + + after do + # run after each test + end + + describe 'test an instance of GiftApi' do + it 'should create an instance of GiftApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::GiftApi) + end + end + + # unit tests for get_gift + # ギフト設定を取得 + # + # @param [Hash] opts the optional parameters + # @return [GetGift200Response] + describe 'get_gift test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/group_api_spec.rb b/spec/api/group_api_spec.rb new file mode 100644 index 0000000..c2b41ab --- /dev/null +++ b/spec/api/group_api_spec.rb @@ -0,0 +1,46 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::GroupApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'GroupApi' do + before do + # run before each test + @api_instance = ColorMeShop::GroupApi.new + end + + after do + # run after each test + end + + describe 'test an instance of GroupApi' do + it 'should create an instance of GroupApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::GroupApi) + end + end + + # unit tests for get_product_groups + # 商品グループ一覧を取得 + # + # @param [Hash] opts the optional parameters + # @return [GetProductGroups200Response] + describe 'get_product_groups test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/payment_api_spec.rb b/spec/api/payment_api_spec.rb new file mode 100644 index 0000000..bc27897 --- /dev/null +++ b/spec/api/payment_api_spec.rb @@ -0,0 +1,46 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::PaymentApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'PaymentApi' do + before do + # run before each test + @api_instance = ColorMeShop::PaymentApi.new + end + + after do + # run after each test + end + + describe 'test an instance of PaymentApi' do + it 'should create an instance of PaymentApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::PaymentApi) + end + end + + # unit tests for get_payments + # 決済設定の一覧を取得 + # + # @param [Hash] opts the optional parameters + # @return [GetPayments200Response] + describe 'get_payments test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/product_api_spec.rb b/spec/api/product_api_spec.rb new file mode 100644 index 0000000..b4302ed --- /dev/null +++ b/spec/api/product_api_spec.rb @@ -0,0 +1,155 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::ProductApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ProductApi' do + before do + # run before each test + @api_instance = ColorMeShop::ProductApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ProductApi' do + it 'should create an instance of ProductApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::ProductApi) + end + end + + # unit tests for delete_product_pickup + # おすすめ商品情報の削除 + # 商品に付加されたおすすめ商品情報を削除します + # @param product_id 商品ID + # @param pickup_type おすすめ商品情報種別(0:おすすめ商品, 1:売れ筋商品, 3:新着商品, 4:イチオシ商品) + # @param [Hash] opts the optional parameters + # @return [PutProductPickup200Response] + describe 'delete_product_pickup test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_product + # 商品データの取得 + # + # @param product_id 商品ID + # @param [Hash] opts the optional parameters + # @return [PostProducts200Response] + describe 'get_product test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_product_variants + # 商品オプション一覧の取得 + # + # @param product_id 商品ID + # @param [Hash] opts the optional parameters + # @option opts [String] :model_number 型番で部分一致検索 + # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [GetProductVariants200Response] + describe 'get_product_variants test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_products + # 商品一覧の取得 + # 商品一覧を取得します。 オプションやバリエーションの数が多い場合、レスポンスの返却に時間がかかる場合があります。 `fields` リクエストパラメータで必要なキーを指定することを推奨します。 + # @param [Hash] opts the optional parameters + # @option opts [String] :ids 商品IDで検索。カンマ区切りにすることで複数検索が可能 + # @option opts [Integer] :category_id_big 大カテゴリーIDで検索 + # @option opts [Integer] :category_id_small 小カテゴリーIDで検索 + # @option opts [Integer] :group_ids グループIDで検索。カンマ区切りにすることで複数検索が可能 + # @option opts [String] :model_number 型番で部分一致検索 + # @option opts [String] :name 商品名で部分一致検索 + # @option opts [String] :display_state 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される + # @option opts [Boolean] :stock_managed `true`の場合、在庫管理している商品を検索 + # @option opts [Boolean] :recent_zero_stocks `true` の場合、過去1週間以内に更新された商品から検索 + # @option opts [String] :make_date_min 指定日時以降に作成された商品から検索 + # @option opts [String] :make_date_max 指定日時以前に作成された商品から検索 + # @option opts [String] :update_date_min 指定日時以降に更新された商品から検索 + # @option opts [String] :update_date_max 指定日時以前に更新された商品から検索 + # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [GetProducts200Response] + describe 'get_products test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for post_product_pickup + # おすすめ商品情報の追加 + # おすすめ商品情報(おすすめ商品、売れ筋商品、新着商品、イチオシ商品のいずれか)を商品に追加します。 + # @param product_id 商品ID + # @param put_product_pickup_request + # @param [Hash] opts the optional parameters + # @return [PutProductPickup200Response] + describe 'post_product_pickup test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for post_products + # 商品データの追加 + # + # @param post_products_request 商品データ + # @param [Hash] opts the optional parameters + # @return [PostProducts200Response] + describe 'post_products test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for put_product_pickup + # おすすめ商品情報の更新 + # おすすめ商品情報(おすすめ商品、売れ筋商品、新着商品、イチオシ商品のいずれか)を更新します。 + # @param product_id 商品ID + # @param put_product_pickup_request + # @param [Hash] opts the optional parameters + # @return [PutProductPickup200Response] + describe 'put_product_pickup test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for update_product + # 商品データの更新 + # + # @param product_id 商品ID + # @param [Hash] opts the optional parameters + # @option opts [UpdateProductRequest] :update_product_request 商品データ + # @return [PostProducts200Response] + describe 'update_product test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/sale_api_spec.rb b/spec/api/sale_api_spec.rb new file mode 100644 index 0000000..6a3ee51 --- /dev/null +++ b/spec/api/sale_api_spec.rb @@ -0,0 +1,131 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::SaleApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'SaleApi' do + before do + # run before each test + @api_instance = ColorMeShop::SaleApi.new + end + + after do + # run after each test + end + + describe 'test an instance of SaleApi' do + it 'should create an instance of SaleApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::SaleApi) + end + end + + # unit tests for cancel_sale + # 受注のキャンセル + # 受注をキャンセルすると、以下のことが起こります。 - 該当受注の商品購入数が0になる - 該当受注の合計金額が0になる - 該当受注の`canceled`が`true`になる - 該当受注に使用されたショップポイント・GMOポイントがキャンセルされる - 該当受注の決済がAmazon Pay、LINE Pay、または楽天ペイ(オンライン決済)である場合は、決済金額が自動的に購入者へ返金される - 該当受注の決済がPayPay(イプシロン)である場合には、イプシロン側の決済もキャンセルされる - ショップポイントがキャンセルされる 販売手数料確定前の場合は以下のことが起こります。 - 販売手数料が0になる - 付与したGMOポイントがキャンセルされる - 購入者が使用したGMOポイントがキャンセルされる 現在、以下の機能はサポートしていません。 - キャンセル連動設定を利用した、クレジット(イプシロン)決済のキャンセル - 分割された受注のキャンセル + # @param sale_id + # @param [Hash] opts the optional parameters + # @option opts [CancelSaleRequest] :cancel_sale_request + # @return [UpdateSale200Response] + describe 'cancel_sale test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_sale + # 受注データの取得 + # + # @param sale_id + # @param [Hash] opts the optional parameters + # @return [GetSale200Response] + describe 'get_sale test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_sales + # 受注データのリストを取得 + # 受注データのリストを取得します。(日付が指定されていない場合は直近1週間分を取得します。) + # @param [Hash] opts the optional parameters + # @option opts [String] :ids 受注IDで検索。カンマ区切りで複数指定可能 + # @option opts [String] :after 指定日時以降の受注から検索。 `after` 未指定時は `before` の指定日時の7日前の0時、 `before` 未指定時は現在から7日前の0時がデフォルト値となります。 + # @option opts [String] :before 指定日時以前の受注から検索 + # @option opts [String] :make_date_min `after`と同義 + # @option opts [String] :make_date_max `before`と同義 + # @option opts [String] :update_date_min 指定日時以降に更新された受注から検索 + # @option opts [String] :update_date_max 指定日時以前に更新された受注から検索 + # @option opts [String] :customer_ids 購入した顧客IDで検索。カンマ区切りにすることで複数検索が可能 + # @option opts [String] :customer_name 購入した顧客名で部分一致検索 + # @option opts [String] :customer_furigana 購入した顧客フリガナがで部分一致検索 + # @option opts [String] :customer_mail 購入した顧客メールアドレスで部分一致検索 + # @option opts [String] :accepted_mail_state 受注メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [String] :paid_mail_state 入金メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [String] :delivered_mail_state 配送メールの送信状態で検索 - `not_yet`: 未送信 - `sent`: 送信済み - `pass`: 送信しない + # @option opts [Boolean] :mobile `true`なら携帯からの受注のみ取得 + # @option opts [Boolean] :paid `true`なら入金済みの受注のみ取得 + # @option opts [Boolean] :delivered `true`なら配送済みの受注のみ取得 + # @option opts [Boolean] :canceled `true`ならキャンセル済みの受注のみ取得 + # @option opts [String] :payment_ids 使用された決済のIDで検索。カンマ区切りで複数指定可能 + # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大100 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [GetSales200Response] + describe 'get_sales test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for send_sales_mail + # メールの送信 + # 受注・入金確認・商品発送メールを送ることができます。 対象の受注が分割されている場合、 受注メール、入金確認メールは、親受注でのみ指定可能です。 + # @param sale_id + # @param [Hash] opts the optional parameters + # @option opts [SendSalesMailRequest] :send_sales_mail_request + # @return [nil] + describe 'send_sales_mail test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for stat_sale + # 売上集計の取得 + # + # @param [Hash] opts the optional parameters + # @option opts [String] :make_date 集計対象とする売上の作成日。形式は\"2017-04-12\"、\"2017/04/12\"など。指定しない場合は今日の日付が使われる + # @return [StatSale200Response] + describe 'stat_sale test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for update_sale + # 受注データの更新 + # 該当受注の決済がAmazon Pay、LINE Pay、または楽天ペイ(オンライン決済)である場合は、熨斗・メッセージカード・ラッピングの手数料を更新すると、決済金額が自動的に購入者に請求もしくは返金されます。 ただし、LINE Payの場合は、決済金額の変更は減額のみ行うことができます。 + # @param sale_id + # @param [Hash] opts the optional parameters + # @option opts [UpdateSaleRequest] :update_sale_request + # @return [UpdateSale200Response] + describe 'update_sale test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/shop_api_spec.rb b/spec/api/shop_api_spec.rb new file mode 100644 index 0000000..72ff173 --- /dev/null +++ b/spec/api/shop_api_spec.rb @@ -0,0 +1,46 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::ShopApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ShopApi' do + before do + # run before each test + @api_instance = ColorMeShop::ShopApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ShopApi' do + it 'should create an instance of ShopApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::ShopApi) + end + end + + # unit tests for get_shop + # ショップ情報の取得 + # ショップ名などの基本的な情報を取得することができるAPIです。 + # @param [Hash] opts the optional parameters + # @return [GetShop200Response] + describe 'get_shop test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/shop_coupon_api_spec.rb b/spec/api/shop_coupon_api_spec.rb new file mode 100644 index 0000000..b0cc3db --- /dev/null +++ b/spec/api/shop_coupon_api_spec.rb @@ -0,0 +1,58 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::ShopCouponApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'ShopCouponApi' do + before do + # run before each test + @api_instance = ColorMeShop::ShopCouponApi.new + end + + after do + # run after each test + end + + describe 'test an instance of ShopCouponApi' do + it 'should create an instance of ShopCouponApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::ShopCouponApi) + end + end + + # unit tests for get_coupon + # ショップクーポンの取得 + # + # @param coupon_id Coupon ID + # @param [Hash] opts the optional parameters + # @return [GetCoupon200Response] + describe 'get_coupon test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + # unit tests for get_coupons + # ショップクーポン一覧取得 + # + # @param [Hash] opts the optional parameters + # @return [GetCoupons200Response] + describe 'get_coupons test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api/stock_api_spec.rb b/spec/api/stock_api_spec.rb new file mode 100644 index 0000000..2920bea --- /dev/null +++ b/spec/api/stock_api_spec.rb @@ -0,0 +1,57 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' + +# Unit tests for ColorMeShop::StockApi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'StockApi' do + before do + # run before each test + @api_instance = ColorMeShop::StockApi.new + end + + after do + # run after each test + end + + describe 'test an instance of StockApi' do + it 'should create an instance of StockApi' do + expect(@api_instance).to be_instance_of(ColorMeShop::StockApi) + end + end + + # unit tests for get_stocks + # 在庫情報の取得 + # 在庫情報を商品名や型番で検索できるAPIです。 + # @param [Hash] opts the optional parameters + # @option opts [String] :ids 商品IDで検索。カンマ区切りにすることで複数検索が可能 + # @option opts [Integer] :category_id_big 大カテゴリーIDで検索 + # @option opts [Integer] :category_id_small 小カテゴリーIDで検索 + # @option opts [String] :model_number 型番で部分一致検索 + # @option opts [String] :name 商品名で部分一致検索 + # @option opts [String] :display_state 掲載設定で検索 - `showing`: 掲載状態 - `hidden`: 非掲載状態 - `showing_for_members`: 会員にのみ掲載 - `sale_for_members`: 掲載状態だが購入は会員のみ可能 + # @option opts [Integer] :stocks 在庫管理している商品のうち、在庫数が指定した数値以下の商品を検索。オプションごとに在庫管理している商品は、オプションごとの在庫数で検索される + # @option opts [Boolean] :recent_zero_stocks `true` の場合、過去1週間以内にオプションが更新された商品から検索 + # @option opts [String] :fields レスポンスJSONのキーをカンマ区切りで指定 + # @option opts [Integer] :limit レスポンスの件数を指定。指定がない場合は10。最大50 + # @option opts [Integer] :offset 指定した数値+1件目以降のデータを返す + # @return [GetStocks200Response] + describe 'get_stocks test' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/api_client_spec.rb b/spec/api_client_spec.rb index b18d46f..98eb77e 100644 --- a/spec/api_client_spec.rb +++ b/spec/api_client_spec.rb @@ -1,12 +1,12 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end @@ -89,6 +89,8 @@ end end + + describe '#deserialize' do it "handles Array" do api_client = ColorMeShop::ApiClient.new @@ -197,8 +199,8 @@ let(:api_client) { ColorMeShop::ApiClient.new } it 'works' do - expect(api_client.select_header_content_type(nil)).to eq('application/json') - expect(api_client.select_header_content_type([])).to eq('application/json') + expect(api_client.select_header_content_type(nil)).to be_nil + expect(api_client.select_header_content_type([])).to be_nil expect(api_client.select_header_content_type(['application/json'])).to eq('application/json') expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8') diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 26fde49..a73595e 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -1,12 +1,12 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end @@ -18,7 +18,7 @@ before(:each) do # uncomment below to setup host and base_path # require 'URI' - # uri = URI.parse("https://api.shop-pro.jp/") + # uri = URI.parse("https://api.shop-pro.jp") # ColorMeShop.configure do |c| # c.host = uri.host # c.base_path = uri.path @@ -28,14 +28,14 @@ describe '#base_url' do it 'should have the default value' do # uncomment below to test default value of the base path - # expect(config.base_url).to eq("https://api.shop-pro.jp/") + # expect(config.base_url).to eq("https://api.shop-pro.jp") end it 'should remove trailing slashes' do [nil, '', '/', '//'].each do |base_path| config.base_path = base_path # uncomment below to test trailing slashes - # expect(config.base_url).to eq("https://api.shop-pro.jp/") + # expect(config.base_url).to eq("https://api.shop-pro.jp") end end end diff --git a/spec/models/cancel_sale_request_spec.rb b/spec/models/cancel_sale_request_spec.rb new file mode 100644 index 0000000..805a585 --- /dev/null +++ b/spec/models/cancel_sale_request_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::CancelSaleRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::CancelSaleRequest do + let(:instance) { ColorMeShop::CancelSaleRequest.new } + + describe 'test an instance of CancelSaleRequest' do + it 'should create an instance of CancelSaleRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::CancelSaleRequest) + end + end + + describe 'test attribute "restock"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/customer_spec.rb b/spec/models/customer_spec.rb new file mode 100644 index 0000000..61c9bba --- /dev/null +++ b/spec/models/customer_spec.rb @@ -0,0 +1,184 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::Customer +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::Customer do + let(:instance) { ColorMeShop::Customer.new } + + describe 'test an instance of Customer' do + it 'should create an instance of Customer' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::Customer) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "furigana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "hojin"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "busho"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sex"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["male", "female"]) + # validator.allowable_values.each do |value| + # expect { instance.sex = value }.not_to raise_error + # end + end + end + + describe 'test attribute "birthday"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "postal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mail"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel_mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "other"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "member"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sales_count"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "receive_mail_magazine"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "answer_free_form1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "answer_free_form2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "answer_free_form3"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/delivery_charge_by_prefecture_spec.rb b/spec/models/delivery_charge_by_prefecture_spec.rb new file mode 100644 index 0000000..c215f41 --- /dev/null +++ b/spec/models/delivery_charge_by_prefecture_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::DeliveryChargeByPrefecture +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::DeliveryChargeByPrefecture do + let(:instance) { ColorMeShop::DeliveryChargeByPrefecture.new } + + describe 'test an instance of DeliveryChargeByPrefecture' do + it 'should create an instance of DeliveryChargeByPrefecture' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::DeliveryChargeByPrefecture) + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/delivery_date_setting_spec.rb b/spec/models/delivery_date_setting_spec.rb new file mode 100644 index 0000000..458e3eb --- /dev/null +++ b/spec/models/delivery_date_setting_spec.rb @@ -0,0 +1,60 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::DeliveryDateSetting +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::DeliveryDateSetting do + let(:instance) { ColorMeShop::DeliveryDateSetting.new } + + describe 'test an instance of DeliveryDateSetting' do + it 'should create an instance of DeliveryDateSetting' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::DeliveryDateSetting) + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "days"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "times"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/delivery_spec.rb b/spec/models/delivery_spec.rb new file mode 100644 index 0000000..60e734d --- /dev/null +++ b/spec/models/delivery_spec.rb @@ -0,0 +1,172 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::Delivery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::Delivery do + let(:instance) { ColorMeShop::Delivery.new } + + describe 'test an instance of Delivery' do + it 'should create an instance of Delivery' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::Delivery) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "method_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["other", "yamato", "yamato_pickup", "sagawa", "jp"]) + # validator.allowable_values.each do |value| + # expect { instance.method_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_free_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_free", "free", "free_to_limit"]) + # validator.allowable_values.each do |value| + # expect { instance.charge_free_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "charge_free_limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["fixed", "by_price", "by_area", "by_weight"]) + # validator.allowable_values.each do |value| + # expect { instance.charge_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_included"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "slip_number_use"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "slip_number_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "preferred_date_use"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "preferred_period_use"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unavailable_payment_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_coupon200_response_spec.rb b/spec/models/get_coupon200_response_spec.rb new file mode 100644 index 0000000..d9339b0 --- /dev/null +++ b/spec/models/get_coupon200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetCoupon200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetCoupon200Response do + let(:instance) { ColorMeShop::GetCoupon200Response.new } + + describe 'test an instance of GetCoupon200Response' do + it 'should create an instance of GetCoupon200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetCoupon200Response) + end + end + + describe 'test attribute "shop_coupon"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_coupons200_response_shop_coupons_inner_spec.rb b/spec/models/get_coupons200_response_shop_coupons_inner_spec.rb new file mode 100644 index 0000000..cbbb494 --- /dev/null +++ b/spec/models/get_coupons200_response_shop_coupons_inner_spec.rb @@ -0,0 +1,130 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetCoupons200ResponseShopCouponsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetCoupons200ResponseShopCouponsInner do + let(:instance) { ColorMeShop::GetCoupons200ResponseShopCouponsInner.new } + + describe 'test an instance of GetCoupons200ResponseShopCouponsInner' do + it 'should create an instance of GetCoupons200ResponseShopCouponsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetCoupons200ResponseShopCouponsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "code"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "coupon_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["amount", "rate", "delivery_charge"]) + # validator.allowable_values.each do |value| + # expect { instance.coupon_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "discount_amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "minimum_amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "starts_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "ends_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_usage_limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "usage_limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["indisposable", "disposable"]) + # validator.allowable_values.each do |value| + # expect { instance.usage_limit = value }.not_to raise_error + # end + end + end + + describe 'test attribute "group_limit_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["none", "including", "excluding"]) + # validator.allowable_values.each do |value| + # expect { instance.group_limit_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["unavailable", "available"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_coupons200_response_spec.rb b/spec/models/get_coupons200_response_spec.rb new file mode 100644 index 0000000..21f51ca --- /dev/null +++ b/spec/models/get_coupons200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetCoupons200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetCoupons200Response do + let(:instance) { ColorMeShop::GetCoupons200Response.new } + + describe 'test an instance of GetCoupons200Response' do + it 'should create an instance of GetCoupons200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetCoupons200Response) + end + end + + describe 'test attribute "shop_coupons"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_customer200_response_meta_spec.rb b/spec/models/get_customer200_response_meta_spec.rb new file mode 100644 index 0000000..56cf690 --- /dev/null +++ b/spec/models/get_customer200_response_meta_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetCustomer200ResponseMeta +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetCustomer200ResponseMeta do + let(:instance) { ColorMeShop::GetCustomer200ResponseMeta.new } + + describe 'test an instance of GetCustomer200ResponseMeta' do + it 'should create an instance of GetCustomer200ResponseMeta' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetCustomer200ResponseMeta) + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "offset"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_customer200_response_spec.rb b/spec/models/get_customer200_response_spec.rb new file mode 100644 index 0000000..22b04a8 --- /dev/null +++ b/spec/models/get_customer200_response_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetCustomer200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetCustomer200Response do + let(:instance) { ColorMeShop::GetCustomer200Response.new } + + describe 'test an instance of GetCustomer200Response' do + it 'should create an instance of GetCustomer200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetCustomer200Response) + end + end + + describe 'test attribute "customer"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_customers200_response_spec.rb b/spec/models/get_customers200_response_spec.rb new file mode 100644 index 0000000..ae1ed12 --- /dev/null +++ b/spec/models/get_customers200_response_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetCustomers200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetCustomers200Response do + let(:instance) { ColorMeShop::GetCustomers200Response.new } + + describe 'test an instance of GetCustomers200Response' do + it 'should create an instance of GetCustomers200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetCustomers200Response) + end + end + + describe 'test attribute "customers"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner_spec.rb b/spec/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner_spec.rb new file mode 100644 index 0000000..7eb9615 --- /dev/null +++ b/spec/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_area_inner_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner do + let(:instance) { ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner.new } + + describe 'test an instance of GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner' do + it 'should create an instance of GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByAreaInner) + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner_spec.rb b/spec/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner_spec.rb new file mode 100644 index 0000000..4c902b5 --- /dev/null +++ b/spec/models/get_deliveries200_response_deliveries_inner_charge_charge_ranges_by_weight_inner_inner_spec.rb @@ -0,0 +1,32 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveries200ResponseDeliveriesInnerChargeChargeRangesByWeightInnerInner do + describe '.openapi_one_of' do + it 'lists the items referenced in the oneOf array' do + expect(described_class.openapi_one_of).to_not be_empty + end + end + + describe '.build' do + it 'returns the correct model' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end +end diff --git a/spec/models/get_deliveries200_response_deliveries_inner_charge_spec.rb b/spec/models/get_deliveries200_response_deliveries_inner_charge_spec.rb new file mode 100644 index 0000000..acffbd9 --- /dev/null +++ b/spec/models/get_deliveries200_response_deliveries_inner_charge_spec.rb @@ -0,0 +1,78 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge do + let(:instance) { ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge.new } + + describe 'test an instance of GetDeliveries200ResponseDeliveriesInnerCharge' do + it 'should create an instance of GetDeliveries200ResponseDeliveriesInnerCharge' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetDeliveries200ResponseDeliveriesInnerCharge) + end + end + + describe 'test attribute "delivery_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_fixed"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_ranges_by_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_max_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_ranges_by_area"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_ranges_by_weight"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_ranges_max_weight"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_deliveries200_response_deliveries_inner_spec.rb b/spec/models/get_deliveries200_response_deliveries_inner_spec.rb new file mode 100644 index 0000000..04e488c --- /dev/null +++ b/spec/models/get_deliveries200_response_deliveries_inner_spec.rb @@ -0,0 +1,172 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveries200ResponseDeliveriesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveries200ResponseDeliveriesInner do + let(:instance) { ColorMeShop::GetDeliveries200ResponseDeliveriesInner.new } + + describe 'test an instance of GetDeliveries200ResponseDeliveriesInner' do + it 'should create an instance of GetDeliveries200ResponseDeliveriesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetDeliveries200ResponseDeliveriesInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "method_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["other", "yamato", "yamato_pickup", "sagawa", "jp"]) + # validator.allowable_values.each do |value| + # expect { instance.method_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_free_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_free", "free", "free_to_limit"]) + # validator.allowable_values.each do |value| + # expect { instance.charge_free_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "charge_free_limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["fixed", "by_price", "by_area", "by_weight"]) + # validator.allowable_values.each do |value| + # expect { instance.charge_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_included"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "slip_number_use"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "slip_number_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "preferred_date_use"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "preferred_period_use"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unavailable_payment_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_deliveries200_response_spec.rb b/spec/models/get_deliveries200_response_spec.rb new file mode 100644 index 0000000..051898f --- /dev/null +++ b/spec/models/get_deliveries200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveries200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveries200Response do + let(:instance) { ColorMeShop::GetDeliveries200Response.new } + + describe 'test an instance of GetDeliveries200Response' do + it 'should create an instance of GetDeliveries200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetDeliveries200Response) + end + end + + describe 'test attribute "deliveries"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_delivery_date_setting200_response_delivery_date_days_spec.rb b/spec/models/get_delivery_date_setting200_response_delivery_date_days_spec.rb new file mode 100644 index 0000000..0b1cbad --- /dev/null +++ b/spec/models/get_delivery_date_setting200_response_delivery_date_days_spec.rb @@ -0,0 +1,60 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays do + let(:instance) { ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays.new } + + describe 'test an instance of GetDeliveryDateSetting200ResponseDeliveryDateDays' do + it 'should create an instance of GetDeliveryDateSetting200ResponseDeliveryDateDays' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateDays) + end + end + + describe 'test attribute "enabled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "default"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "min"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "max"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "comment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_delivery_date_setting200_response_delivery_date_spec.rb b/spec/models/get_delivery_date_setting200_response_delivery_date_spec.rb new file mode 100644 index 0000000..863dd7f --- /dev/null +++ b/spec/models/get_delivery_date_setting200_response_delivery_date_spec.rb @@ -0,0 +1,60 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate do + let(:instance) { ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate.new } + + describe 'test an instance of GetDeliveryDateSetting200ResponseDeliveryDate' do + it 'should create an instance of GetDeliveryDateSetting200ResponseDeliveryDate' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDate) + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "days"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "times"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_delivery_date_setting200_response_delivery_date_times_spec.rb b/spec/models/get_delivery_date_setting200_response_delivery_date_times_spec.rb new file mode 100644 index 0000000..d3cc17e --- /dev/null +++ b/spec/models/get_delivery_date_setting200_response_delivery_date_times_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes do + let(:instance) { ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes.new } + + describe 'test an instance of GetDeliveryDateSetting200ResponseDeliveryDateTimes' do + it 'should create an instance of GetDeliveryDateSetting200ResponseDeliveryDateTimes' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetDeliveryDateSetting200ResponseDeliveryDateTimes) + end + end + + describe 'test attribute "enabled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "periods"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "comment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_delivery_date_setting200_response_spec.rb b/spec/models/get_delivery_date_setting200_response_spec.rb new file mode 100644 index 0000000..74c560f --- /dev/null +++ b/spec/models/get_delivery_date_setting200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetDeliveryDateSetting200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetDeliveryDateSetting200Response do + let(:instance) { ColorMeShop::GetDeliveryDateSetting200Response.new } + + describe 'test an instance of GetDeliveryDateSetting200Response' do + it 'should create an instance of GetDeliveryDateSetting200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetDeliveryDateSetting200Response) + end + end + + describe 'test attribute "delivery_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_gift200_response_gift_card_spec.rb b/spec/models/get_gift200_response_gift_card_spec.rb new file mode 100644 index 0000000..fac4f47 --- /dev/null +++ b/spec/models/get_gift200_response_gift_card_spec.rb @@ -0,0 +1,54 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetGift200ResponseGiftCard +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetGift200ResponseGiftCard do + let(:instance) { ColorMeShop::GetGift200ResponseGiftCard.new } + + describe 'test an instance of GetGift200ResponseGiftCard' do + it 'should create an instance of GetGift200ResponseGiftCard' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetGift200ResponseGiftCard) + end + end + + describe 'test attribute "enabled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "text_enabled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "types"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "comment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_gift200_response_gift_card_types_inner_spec.rb b/spec/models/get_gift200_response_gift_card_types_inner_spec.rb new file mode 100644 index 0000000..ca95805 --- /dev/null +++ b/spec/models/get_gift200_response_gift_card_types_inner_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetGift200ResponseGiftCardTypesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetGift200ResponseGiftCardTypesInner do + let(:instance) { ColorMeShop::GetGift200ResponseGiftCardTypesInner.new } + + describe 'test an instance of GetGift200ResponseGiftCardTypesInner' do + it 'should create an instance of GetGift200ResponseGiftCardTypesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetGift200ResponseGiftCardTypesInner) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_gift200_response_gift_noshi_spec.rb b/spec/models/get_gift200_response_gift_noshi_spec.rb new file mode 100644 index 0000000..bcfb987 --- /dev/null +++ b/spec/models/get_gift200_response_gift_noshi_spec.rb @@ -0,0 +1,60 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetGift200ResponseGiftNoshi +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetGift200ResponseGiftNoshi do + let(:instance) { ColorMeShop::GetGift200ResponseGiftNoshi.new } + + describe 'test an instance of GetGift200ResponseGiftNoshi' do + it 'should create an instance of GetGift200ResponseGiftNoshi' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetGift200ResponseGiftNoshi) + end + end + + describe 'test attribute "enabled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "text_enabled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "text_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "types"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "comment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_gift200_response_gift_noshi_types_inner_spec.rb b/spec/models/get_gift200_response_gift_noshi_types_inner_spec.rb new file mode 100644 index 0000000..2c09500 --- /dev/null +++ b/spec/models/get_gift200_response_gift_noshi_types_inner_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetGift200ResponseGiftNoshiTypesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetGift200ResponseGiftNoshiTypesInner do + let(:instance) { ColorMeShop::GetGift200ResponseGiftNoshiTypesInner.new } + + describe 'test an instance of GetGift200ResponseGiftNoshiTypesInner' do + it 'should create an instance of GetGift200ResponseGiftNoshiTypesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetGift200ResponseGiftNoshiTypesInner) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_gift200_response_gift_spec.rb b/spec/models/get_gift200_response_gift_spec.rb new file mode 100644 index 0000000..5cdd2f4 --- /dev/null +++ b/spec/models/get_gift200_response_gift_spec.rb @@ -0,0 +1,72 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetGift200ResponseGift +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetGift200ResponseGift do + let(:instance) { ColorMeShop::GetGift200ResponseGift.new } + + describe 'test an instance of GetGift200ResponseGift' do + it 'should create an instance of GetGift200ResponseGift' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetGift200ResponseGift) + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "enabled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_gift200_response_gift_wrapping_spec.rb b/spec/models/get_gift200_response_gift_wrapping_spec.rb new file mode 100644 index 0000000..2d571c2 --- /dev/null +++ b/spec/models/get_gift200_response_gift_wrapping_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetGift200ResponseGiftWrapping +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetGift200ResponseGiftWrapping do + let(:instance) { ColorMeShop::GetGift200ResponseGiftWrapping.new } + + describe 'test an instance of GetGift200ResponseGiftWrapping' do + it 'should create an instance of GetGift200ResponseGiftWrapping' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetGift200ResponseGiftWrapping) + end + end + + describe 'test attribute "enabled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "types"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "comment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_gift200_response_gift_wrapping_types_inner_spec.rb b/spec/models/get_gift200_response_gift_wrapping_types_inner_spec.rb new file mode 100644 index 0000000..0bd0e9c --- /dev/null +++ b/spec/models/get_gift200_response_gift_wrapping_types_inner_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetGift200ResponseGiftWrappingTypesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetGift200ResponseGiftWrappingTypesInner do + let(:instance) { ColorMeShop::GetGift200ResponseGiftWrappingTypesInner.new } + + describe 'test an instance of GetGift200ResponseGiftWrappingTypesInner' do + it 'should create an instance of GetGift200ResponseGiftWrappingTypesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetGift200ResponseGiftWrappingTypesInner) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_gift200_response_spec.rb b/spec/models/get_gift200_response_spec.rb new file mode 100644 index 0000000..730cc11 --- /dev/null +++ b/spec/models/get_gift200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetGift200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetGift200Response do + let(:instance) { ColorMeShop::GetGift200Response.new } + + describe 'test an instance of GetGift200Response' do + it 'should create an instance of GetGift200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetGift200Response) + end + end + + describe 'test attribute "gift"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_payments200_response_payments_inner_card_brands_inner_spec.rb b/spec/models/get_payments200_response_payments_inner_card_brands_inner_spec.rb new file mode 100644 index 0000000..1468991 --- /dev/null +++ b/spec/models/get_payments200_response_payments_inner_card_brands_inner_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner do + let(:instance) { ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner.new } + + describe 'test an instance of GetPayments200ResponsePaymentsInnerCardBrandsInner' do + it 'should create an instance of GetPayments200ResponsePaymentsInnerCardBrandsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetPayments200ResponsePaymentsInnerCardBrandsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_payments200_response_payments_inner_card_spec.rb b/spec/models/get_payments200_response_payments_inner_card_spec.rb new file mode 100644 index 0000000..787619c --- /dev/null +++ b/spec/models/get_payments200_response_payments_inner_card_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetPayments200ResponsePaymentsInnerCard +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetPayments200ResponsePaymentsInnerCard do + let(:instance) { ColorMeShop::GetPayments200ResponsePaymentsInnerCard.new } + + describe 'test an instance of GetPayments200ResponsePaymentsInnerCard' do + it 'should create an instance of GetPayments200ResponsePaymentsInnerCard' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetPayments200ResponsePaymentsInnerCard) + end + end + + describe 'test attribute "brands"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_payments200_response_payments_inner_cod_spec.rb b/spec/models/get_payments200_response_payments_inner_cod_spec.rb new file mode 100644 index 0000000..78b50f6 --- /dev/null +++ b/spec/models/get_payments200_response_payments_inner_cod_spec.rb @@ -0,0 +1,54 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetPayments200ResponsePaymentsInnerCod +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetPayments200ResponsePaymentsInnerCod do + let(:instance) { ColorMeShop::GetPayments200ResponsePaymentsInnerCod.new } + + describe 'test an instance of GetPayments200ResponsePaymentsInnerCod' do + it 'should create an instance of GetPayments200ResponsePaymentsInnerCod' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetPayments200ResponsePaymentsInnerCod) + end + end + + describe 'test attribute "changeable"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fees"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fee_max"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "changeable_by_total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_payments200_response_payments_inner_financial_spec.rb b/spec/models/get_payments200_response_payments_inner_financial_spec.rb new file mode 100644 index 0000000..b2fef0f --- /dev/null +++ b/spec/models/get_payments200_response_payments_inner_financial_spec.rb @@ -0,0 +1,64 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial do + let(:instance) { ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial.new } + + describe 'test an instance of GetPayments200ResponsePaymentsInnerFinancial' do + it 'should create an instance of GetPayments200ResponsePaymentsInnerFinancial' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetPayments200ResponsePaymentsInnerFinancial) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "branch_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "kouza_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["saving", "checking"]) + # validator.allowable_values.each do |value| + # expect { instance.kouza_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "kouza_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "kouza_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_payments200_response_payments_inner_spec.rb b/spec/models/get_payments200_response_payments_inner_spec.rb new file mode 100644 index 0000000..78de7b1 --- /dev/null +++ b/spec/models/get_payments200_response_payments_inner_spec.rb @@ -0,0 +1,138 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetPayments200ResponsePaymentsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetPayments200ResponsePaymentsInner do + let(:instance) { ColorMeShop::GetPayments200ResponsePaymentsInner.new } + + describe 'test an instance of GetPayments200ResponsePaymentsInner' do + it 'should create an instance of GetPayments200ResponsePaymentsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetPayments200ResponsePaymentsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fee"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "ip_code"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_end_note"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo_mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cod"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "financial"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_payments200_response_spec.rb b/spec/models/get_payments200_response_spec.rb new file mode 100644 index 0000000..f96d277 --- /dev/null +++ b/spec/models/get_payments200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetPayments200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetPayments200Response do + let(:instance) { ColorMeShop::GetPayments200Response.new } + + describe 'test an instance of GetPayments200Response' do + it 'should create an instance of GetPayments200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetPayments200Response) + end + end + + describe 'test attribute "payments"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_product_categories200_response_categories_inner_children_inner_spec.rb b/spec/models/get_product_categories200_response_categories_inner_children_inner_spec.rb new file mode 100644 index 0000000..432fb0c --- /dev/null +++ b/spec/models/get_product_categories200_response_categories_inner_children_inner_spec.rb @@ -0,0 +1,94 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner do + let(:instance) { ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner.new } + + describe 'test an instance of GetProductCategories200ResponseCategoriesInnerChildrenInner' do + it 'should create an instance of GetProductCategories200ResponseCategoriesInnerChildrenInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProductCategories200ResponseCategoriesInnerChildrenInner) + end + end + + describe 'test attribute "id_big"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "id_small"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_product_categories200_response_categories_inner_spec.rb b/spec/models/get_product_categories200_response_categories_inner_spec.rb new file mode 100644 index 0000000..8537c4e --- /dev/null +++ b/spec/models/get_product_categories200_response_categories_inner_spec.rb @@ -0,0 +1,100 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProductCategories200ResponseCategoriesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProductCategories200ResponseCategoriesInner do + let(:instance) { ColorMeShop::GetProductCategories200ResponseCategoriesInner.new } + + describe 'test an instance of GetProductCategories200ResponseCategoriesInner' do + it 'should create an instance of GetProductCategories200ResponseCategoriesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProductCategories200ResponseCategoriesInner) + end + end + + describe 'test attribute "id_big"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "id_small"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "children"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_product_categories200_response_spec.rb b/spec/models/get_product_categories200_response_spec.rb new file mode 100644 index 0000000..7d2a06d --- /dev/null +++ b/spec/models/get_product_categories200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProductCategories200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProductCategories200Response do + let(:instance) { ColorMeShop::GetProductCategories200Response.new } + + describe 'test an instance of GetProductCategories200Response' do + it 'should create an instance of GetProductCategories200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProductCategories200Response) + end + end + + describe 'test attribute "categories"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_product_groups200_response_groups_inner_spec.rb b/spec/models/get_product_groups200_response_groups_inner_spec.rb new file mode 100644 index 0000000..83d9a4a --- /dev/null +++ b/spec/models/get_product_groups200_response_groups_inner_spec.rb @@ -0,0 +1,82 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProductGroups200ResponseGroupsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProductGroups200ResponseGroupsInner do + let(:instance) { ColorMeShop::GetProductGroups200ResponseGroupsInner.new } + + describe 'test an instance of GetProductGroups200ResponseGroupsInner' do + it 'should create an instance of GetProductGroups200ResponseGroupsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProductGroups200ResponseGroupsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "parent_group_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_product_groups200_response_spec.rb b/spec/models/get_product_groups200_response_spec.rb new file mode 100644 index 0000000..69ea53a --- /dev/null +++ b/spec/models/get_product_groups200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProductGroups200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProductGroups200Response do + let(:instance) { ColorMeShop::GetProductGroups200Response.new } + + describe 'test an instance of GetProductGroups200Response' do + it 'should create an instance of GetProductGroups200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProductGroups200Response) + end + end + + describe 'test attribute "groups"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_product_variants200_response_spec.rb b/spec/models/get_product_variants200_response_spec.rb new file mode 100644 index 0000000..44e73bd --- /dev/null +++ b/spec/models/get_product_variants200_response_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProductVariants200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProductVariants200Response do + let(:instance) { ColorMeShop::GetProductVariants200Response.new } + + describe 'test an instance of GetProductVariants200Response' do + it 'should create an instance of GetProductVariants200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProductVariants200Response) + end + end + + describe 'test attribute "variants"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_products200_response_products_inner_category_spec.rb b/spec/models/get_products200_response_products_inner_category_spec.rb new file mode 100644 index 0000000..0b0716c --- /dev/null +++ b/spec/models/get_products200_response_products_inner_category_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProducts200ResponseProductsInnerCategory +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProducts200ResponseProductsInnerCategory do + let(:instance) { ColorMeShop::GetProducts200ResponseProductsInnerCategory.new } + + describe 'test an instance of GetProducts200ResponseProductsInnerCategory' do + it 'should create an instance of GetProducts200ResponseProductsInnerCategory' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProducts200ResponseProductsInnerCategory) + end + end + + describe 'test attribute "id_big"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "id_small"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_products200_response_products_inner_images_inner_spec.rb b/spec/models/get_products200_response_products_inner_images_inner_spec.rb new file mode 100644 index 0000000..dc12adf --- /dev/null +++ b/spec/models/get_products200_response_products_inner_images_inner_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProducts200ResponseProductsInnerImagesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProducts200ResponseProductsInnerImagesInner do + let(:instance) { ColorMeShop::GetProducts200ResponseProductsInnerImagesInner.new } + + describe 'test an instance of GetProducts200ResponseProductsInnerImagesInner' do + it 'should create an instance of GetProducts200ResponseProductsInnerImagesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProducts200ResponseProductsInnerImagesInner) + end + end + + describe 'test attribute "src"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "position"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_products200_response_products_inner_options_inner_spec.rb b/spec/models/get_products200_response_products_inner_options_inner_spec.rb new file mode 100644 index 0000000..97de560 --- /dev/null +++ b/spec/models/get_products200_response_products_inner_options_inner_spec.rb @@ -0,0 +1,72 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner do + let(:instance) { ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner.new } + + describe 'test an instance of GetProducts200ResponseProductsInnerOptionsInner' do + it 'should create an instance of GetProducts200ResponseProductsInnerOptionsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProducts200ResponseProductsInnerOptionsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "values"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_products200_response_products_inner_pickups_inner_spec.rb b/spec/models/get_products200_response_products_inner_pickups_inner_spec.rb new file mode 100644 index 0000000..35a42df --- /dev/null +++ b/spec/models/get_products200_response_products_inner_pickups_inner_spec.rb @@ -0,0 +1,54 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner do + let(:instance) { ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner.new } + + describe 'test an instance of GetProducts200ResponseProductsInnerPickupsInner' do + it 'should create an instance of GetProducts200ResponseProductsInnerPickupsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProducts200ResponseProductsInnerPickupsInner) + end + end + + describe 'test attribute "pickup_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_products200_response_products_inner_spec.rb b/spec/models/get_products200_response_products_inner_spec.rb new file mode 100644 index 0000000..105f430 --- /dev/null +++ b/spec/models/get_products200_response_products_inner_spec.rb @@ -0,0 +1,322 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProducts200ResponseProductsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProducts200ResponseProductsInner do + let(:instance) { ColorMeShop::GetProducts200ResponseProductsInner.new } + + describe 'test an instance of GetProducts200ResponseProductsInner' do + it 'should create an instance of GetProducts200ResponseProductsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProducts200ResponseProductsInner) + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stock_managed"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "few_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "group_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "sales_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sales_price_including_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sales_price_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price_including_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cost"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cool_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unavailable_payment_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unavailable_delivery_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "min_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "max_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_start_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_end_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "weight"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "soldout_display"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "simple_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "smartphone_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "thumbnail_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "images"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "options"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "variants"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pickups"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "digital_conent"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "regular_purchase"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_reduced"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "without_shipping"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_products200_response_products_inner_variants_inner_spec.rb b/spec/models/get_products200_response_products_inner_variants_inner_spec.rb new file mode 100644 index 0000000..91ef135 --- /dev/null +++ b/spec/models/get_products200_response_products_inner_variants_inner_spec.rb @@ -0,0 +1,126 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner do + let(:instance) { ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner.new } + + describe 'test an instance of GetProducts200ResponseProductsInnerVariantsInner' do + it 'should create an instance of GetProducts200ResponseProductsInnerVariantsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProducts200ResponseProductsInnerVariantsInner) + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option1_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "few_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_price_including_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_price_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_members_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_members_price_including_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_members_price_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_products200_response_spec.rb b/spec/models/get_products200_response_spec.rb new file mode 100644 index 0000000..7a128f5 --- /dev/null +++ b/spec/models/get_products200_response_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetProducts200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetProducts200Response do + let(:instance) { ColorMeShop::GetProducts200Response.new } + + describe 'test an instance of GetProducts200Response' do + it 'should create an instance of GetProducts200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetProducts200Response) + end + end + + describe 'test attribute "products"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sale200_response_sale_all_of_segment_spec.rb b/spec/models/get_sale200_response_sale_all_of_segment_spec.rb new file mode 100644 index 0000000..43cb8fb --- /dev/null +++ b/spec/models/get_sale200_response_sale_all_of_segment_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSale200ResponseSaleAllOfSegment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSale200ResponseSaleAllOfSegment do + let(:instance) { ColorMeShop::GetSale200ResponseSaleAllOfSegment.new } + + describe 'test an instance of GetSale200ResponseSaleAllOfSegment' do + it 'should create an instance of GetSale200ResponseSaleAllOfSegment' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSale200ResponseSaleAllOfSegment) + end + end + + describe 'test attribute "siblings_sale_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sale200_response_sale_spec.rb b/spec/models/get_sale200_response_sale_spec.rb new file mode 100644 index 0000000..f392320 --- /dev/null +++ b/spec/models/get_sale200_response_sale_spec.rb @@ -0,0 +1,312 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSale200ResponseSale +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSale200ResponseSale do + let(:instance) { ColorMeShop::GetSale200ResponseSale.new } + + describe 'test an instance of GetSale200ResponseSale' do + it 'should create an instance of GetSale200ResponseSale' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSale200ResponseSale) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "payment_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "paid"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivered"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "canceled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "accepted_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.accepted_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "paid_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.paid_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "delivered_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.delivered_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "accepted_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "paid_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivered_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "gmo_point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.gmo_point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "yahoo_point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.yahoo_point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "product_total_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fee"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "point_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "gmo_point_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "other_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "other_discount_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_gmo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_gmo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_yahoo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_yahoo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "customer"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_deliveries"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "segment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "totals"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sale200_response_spec.rb b/spec/models/get_sale200_response_spec.rb new file mode 100644 index 0000000..243c68d --- /dev/null +++ b/spec/models/get_sale200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSale200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSale200Response do + let(:instance) { ColorMeShop::GetSale200Response.new } + + describe 'test an instance of GetSale200Response' do + it 'should create an instance of GetSale200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSale200Response) + end + end + + describe 'test attribute "sale"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sales200_response_meta_spec.rb b/spec/models/get_sales200_response_meta_spec.rb new file mode 100644 index 0000000..e6db224 --- /dev/null +++ b/spec/models/get_sales200_response_meta_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSales200ResponseMeta +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSales200ResponseMeta do + let(:instance) { ColorMeShop::GetSales200ResponseMeta.new } + + describe 'test an instance of GetSales200ResponseMeta' do + it 'should create an instance of GetSales200ResponseMeta' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSales200ResponseMeta) + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "offset"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sales200_response_sales_inner_customer_spec.rb b/spec/models/get_sales200_response_sales_inner_customer_spec.rb new file mode 100644 index 0000000..c424457 --- /dev/null +++ b/spec/models/get_sales200_response_sales_inner_customer_spec.rb @@ -0,0 +1,184 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSales200ResponseSalesInnerCustomer +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSales200ResponseSalesInnerCustomer do + let(:instance) { ColorMeShop::GetSales200ResponseSalesInnerCustomer.new } + + describe 'test an instance of GetSales200ResponseSalesInnerCustomer' do + it 'should create an instance of GetSales200ResponseSalesInnerCustomer' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSales200ResponseSalesInnerCustomer) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "furigana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "hojin"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "busho"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sex"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["male", "female"]) + # validator.allowable_values.each do |value| + # expect { instance.sex = value }.not_to raise_error + # end + end + end + + describe 'test attribute "birthday"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "postal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mail"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel_mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "other"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "member"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sales_count"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "receive_mail_magazine"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "answer_free_form1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "answer_free_form2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "answer_free_form3"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sales200_response_sales_inner_details_inner_spec.rb b/spec/models/get_sales200_response_sales_inner_details_inner_spec.rb new file mode 100644 index 0000000..b97798c --- /dev/null +++ b/spec/models/get_sales200_response_sales_inner_details_inner_spec.rb @@ -0,0 +1,156 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSales200ResponseSalesInnerDetailsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSales200ResponseSalesInnerDetailsInner do + let(:instance) { ColorMeShop::GetSales200ResponseSalesInnerDetailsInner.new } + + describe 'test an instance of GetSales200ResponseSalesInnerDetailsInner' do + it 'should create an instance of GetSales200ResponseSalesInnerDetailsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSales200ResponseSalesInnerDetailsInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_delivery_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option1_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option1_index"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_index"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pristine_product_full_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_cost"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_thumbnail_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_mobile_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price_with_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "subtotal_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sales200_response_sales_inner_sale_deliveries_inner_spec.rb b/spec/models/get_sales200_response_sales_inner_sale_deliveries_inner_spec.rb new file mode 100644 index 0000000..e2bc314 --- /dev/null +++ b/spec/models/get_sales200_response_sales_inner_sale_deliveries_inner_spec.rb @@ -0,0 +1,198 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner do + let(:instance) { ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner.new } + + describe 'test an instance of GetSales200ResponseSalesInnerSaleDeliveriesInner' do + it 'should create an instance of GetSales200ResponseSalesInnerSaleDeliveriesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSales200ResponseSalesInnerSaleDeliveriesInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "detail_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "furigana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "postal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "preferred_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "preferred_period"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "slip_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi_text"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_text"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tracking_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivered"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sales200_response_sales_inner_segment_spec.rb b/spec/models/get_sales200_response_sales_inner_segment_spec.rb new file mode 100644 index 0000000..0d7065d --- /dev/null +++ b/spec/models/get_sales200_response_sales_inner_segment_spec.rb @@ -0,0 +1,90 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSales200ResponseSalesInnerSegment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSales200ResponseSalesInnerSegment do + let(:instance) { ColorMeShop::GetSales200ResponseSalesInnerSegment.new } + + describe 'test an instance of GetSales200ResponseSalesInnerSegment' do + it 'should create an instance of GetSales200ResponseSalesInnerSegment' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSales200ResponseSalesInnerSegment) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "parent_sale_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "splitted"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_total_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sales200_response_sales_inner_spec.rb b/spec/models/get_sales200_response_sales_inner_spec.rb new file mode 100644 index 0000000..a718714 --- /dev/null +++ b/spec/models/get_sales200_response_sales_inner_spec.rb @@ -0,0 +1,312 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSales200ResponseSalesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSales200ResponseSalesInner do + let(:instance) { ColorMeShop::GetSales200ResponseSalesInner.new } + + describe 'test an instance of GetSales200ResponseSalesInner' do + it 'should create an instance of GetSales200ResponseSalesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSales200ResponseSalesInner) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "payment_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "paid"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivered"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "canceled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "accepted_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.accepted_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "paid_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.paid_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "delivered_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.delivered_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "accepted_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "paid_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivered_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "gmo_point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.gmo_point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "yahoo_point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.yahoo_point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "product_total_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fee"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "point_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "gmo_point_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "other_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "other_discount_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_gmo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_gmo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_yahoo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_yahoo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "customer"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_deliveries"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "segment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "totals"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sales200_response_sales_inner_totals_spec.rb b/spec/models/get_sales200_response_sales_inner_totals_spec.rb new file mode 100644 index 0000000..d73fcc5 --- /dev/null +++ b/spec/models/get_sales200_response_sales_inner_totals_spec.rb @@ -0,0 +1,66 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSales200ResponseSalesInnerTotals +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSales200ResponseSalesInnerTotals do + let(:instance) { ColorMeShop::GetSales200ResponseSalesInnerTotals.new } + + describe 'test an instance of GetSales200ResponseSalesInnerTotals' do + it 'should create an instance of GetSales200ResponseSalesInnerTotals' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSales200ResponseSalesInnerTotals) + end + end + + describe 'test attribute "normal_tax_amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "reduced_tax_amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "discount_amount_for_normal_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "discount_amount_for_reduced_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_price_with_normal_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_price_with_reduced_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_sales200_response_spec.rb b/spec/models/get_sales200_response_spec.rb new file mode 100644 index 0000000..758e668 --- /dev/null +++ b/spec/models/get_sales200_response_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetSales200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetSales200Response do + let(:instance) { ColorMeShop::GetSales200Response.new } + + describe 'test an instance of GetSales200Response' do + it 'should create an instance of GetSales200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetSales200Response) + end + end + + describe 'test attribute "sales"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_shop200_response_shop_spec.rb b/spec/models/get_shop200_response_shop_spec.rb new file mode 100644 index 0000000..8665dd5 --- /dev/null +++ b/spec/models/get_shop200_response_shop_spec.rb @@ -0,0 +1,280 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetShop200ResponseShop +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetShop200ResponseShop do + let(:instance) { ColorMeShop::GetShop200ResponseShop.new } + + describe 'test an instance of GetShop200ResponseShop' do + it 'should create an instance of GetShop200ResponseShop' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetShop200ResponseShop) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["enabled", "suspended", "unsigned"]) + # validator.allowable_values.each do |value| + # expect { instance.state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "domain_plan"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["cmsp_sub_domain", "own_domain", "own_sub_domain"]) + # validator.allowable_values.each do |value| + # expect { instance.domain_plan = value }.not_to raise_error + # end + end + end + + describe 'test attribute "contract_plan"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["unknown", "economy", "small", "regular", "lolipop", "heteml", "platinum", "goope", "large", "dormant", "free", "premium"]) + # validator.allowable_values.each do |value| + # expect { instance.contract_plan = value }.not_to raise_error + # end + end + end + + describe 'test attribute "contract_start_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "contract_end_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "contract_term"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "last_login_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "setup_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "open_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) + # validator.allowable_values.each do |value| + # expect { instance.open_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "mobile_open_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) + # validator.allowable_values.each do |value| + # expect { instance.mobile_open_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "login_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name1_kana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name2_kana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "hojin"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "hojin_kana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "user_mail"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "postal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "title_short"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "shop_mail_1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "shop_mail_2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["excluded", "included"]) + # validator.allowable_values.each do |value| + # expect { instance.tax_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_rounding_method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["round_off", "round_down", "round_up"]) + # validator.allowable_values.each do |value| + # expect { instance.tax_rounding_method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "reduce_tax_rate"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "shop_logo_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_shop200_response_spec.rb b/spec/models/get_shop200_response_spec.rb new file mode 100644 index 0000000..e1fe888 --- /dev/null +++ b/spec/models/get_shop200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetShop200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetShop200Response do + let(:instance) { ColorMeShop::GetShop200Response.new } + + describe 'test an instance of GetShop200Response' do + it 'should create an instance of GetShop200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetShop200Response) + end + end + + describe 'test attribute "shop"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_stocks200_response_spec.rb b/spec/models/get_stocks200_response_spec.rb new file mode 100644 index 0000000..1f40ee8 --- /dev/null +++ b/spec/models/get_stocks200_response_spec.rb @@ -0,0 +1,42 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetStocks200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetStocks200Response do + let(:instance) { ColorMeShop::GetStocks200Response.new } + + describe 'test an instance of GetStocks200Response' do + it 'should create an instance of GetStocks200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetStocks200Response) + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_stocks200_response_stocks_inner_images_inner_spec.rb b/spec/models/get_stocks200_response_stocks_inner_images_inner_spec.rb new file mode 100644 index 0000000..6fc52b4 --- /dev/null +++ b/spec/models/get_stocks200_response_stocks_inner_images_inner_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetStocks200ResponseStocksInnerImagesInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetStocks200ResponseStocksInnerImagesInner do + let(:instance) { ColorMeShop::GetStocks200ResponseStocksInnerImagesInner.new } + + describe 'test an instance of GetStocks200ResponseStocksInnerImagesInner' do + it 'should create an instance of GetStocks200ResponseStocksInnerImagesInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetStocks200ResponseStocksInnerImagesInner) + end + end + + describe 'test attribute "src"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "position"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/get_stocks200_response_stocks_inner_spec.rb b/spec/models/get_stocks200_response_stocks_inner_spec.rb new file mode 100644 index 0000000..9cb0231 --- /dev/null +++ b/spec/models/get_stocks200_response_stocks_inner_spec.rb @@ -0,0 +1,250 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::GetStocks200ResponseStocksInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::GetStocks200ResponseStocksInner do + let(:instance) { ColorMeShop::GetStocks200ResponseStocksInner.new } + + describe 'test an instance of GetStocks200ResponseStocksInner' do + it 'should create an instance of GetStocks200ResponseStocksInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::GetStocks200ResponseStocksInner) + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option1_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "few_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "variant_model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "sales_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cost"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cool_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "min_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "max_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_start_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_end_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "weight"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "soldout_display"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "simple_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "smartphone_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "thumbnail_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "images"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/meta_spec.rb b/spec/models/meta_spec.rb new file mode 100644 index 0000000..6f7fc37 --- /dev/null +++ b/spec/models/meta_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::Meta +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::Meta do + let(:instance) { ColorMeShop::Meta.new } + + describe 'test an instance of Meta' do + it 'should create an instance of Meta' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::Meta) + end + end + + describe 'test attribute "total"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "offset"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/payment_spec.rb b/spec/models/payment_spec.rb new file mode 100644 index 0000000..205d1f8 --- /dev/null +++ b/spec/models/payment_spec.rb @@ -0,0 +1,138 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::Payment +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::Payment do + let(:instance) { ColorMeShop::Payment.new } + + describe 'test an instance of Payment' do + it 'should create an instance of Payment' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::Payment) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fee"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "ip_code"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_end_note"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo_mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cod"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "financial"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/post_customers200_response_spec.rb b/spec/models/post_customers200_response_spec.rb new file mode 100644 index 0000000..e93877e --- /dev/null +++ b/spec/models/post_customers200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PostCustomers200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PostCustomers200Response do + let(:instance) { ColorMeShop::PostCustomers200Response.new } + + describe 'test an instance of PostCustomers200Response' do + it 'should create an instance of PostCustomers200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PostCustomers200Response) + end + end + + describe 'test attribute "customer"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/post_customers_request_customer_spec.rb b/spec/models/post_customers_request_customer_spec.rb new file mode 100644 index 0000000..8d2131d --- /dev/null +++ b/spec/models/post_customers_request_customer_spec.rb @@ -0,0 +1,78 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PostCustomersRequestCustomer +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PostCustomersRequestCustomer do + let(:instance) { ColorMeShop::PostCustomersRequestCustomer.new } + + describe 'test an instance of PostCustomersRequestCustomer' do + it 'should create an instance of PostCustomersRequestCustomer' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PostCustomersRequestCustomer) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mail"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "postal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "add_member"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/post_customers_request_spec.rb b/spec/models/post_customers_request_spec.rb new file mode 100644 index 0000000..ae0a1e6 --- /dev/null +++ b/spec/models/post_customers_request_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PostCustomersRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PostCustomersRequest do + let(:instance) { ColorMeShop::PostCustomersRequest.new } + + describe 'test an instance of PostCustomersRequest' do + it 'should create an instance of PostCustomersRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PostCustomersRequest) + end + end + + describe 'test attribute "customer"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/post_products200_response_spec.rb b/spec/models/post_products200_response_spec.rb new file mode 100644 index 0000000..3f03760 --- /dev/null +++ b/spec/models/post_products200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PostProducts200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PostProducts200Response do + let(:instance) { ColorMeShop::PostProducts200Response.new } + + describe 'test an instance of PostProducts200Response' do + it 'should create an instance of PostProducts200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PostProducts200Response) + end + end + + describe 'test attribute "product"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/post_products_request_product_spec.rb b/spec/models/post_products_request_product_spec.rb new file mode 100644 index 0000000..3bb410c --- /dev/null +++ b/spec/models/post_products_request_product_spec.rb @@ -0,0 +1,64 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PostProductsRequestProduct +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PostProductsRequestProduct do + let(:instance) { ColorMeShop::PostProductsRequestProduct.new } + + describe 'test an instance of PostProductsRequestProduct' do + it 'should create an instance of PostProductsRequestProduct' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PostProductsRequestProduct) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category_id_big"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sales_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "tax_reduced"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/post_products_request_spec.rb b/spec/models/post_products_request_spec.rb new file mode 100644 index 0000000..80a4c68 --- /dev/null +++ b/spec/models/post_products_request_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PostProductsRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PostProductsRequest do + let(:instance) { ColorMeShop::PostProductsRequest.new } + + describe 'test an instance of PostProductsRequest' do + it 'should create an instance of PostProductsRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PostProductsRequest) + end + end + + describe 'test attribute "product"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_category_child_spec.rb b/spec/models/product_category_child_spec.rb new file mode 100644 index 0000000..09d107d --- /dev/null +++ b/spec/models/product_category_child_spec.rb @@ -0,0 +1,94 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ProductCategoryChild +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ProductCategoryChild do + let(:instance) { ColorMeShop::ProductCategoryChild.new } + + describe 'test an instance of ProductCategoryChild' do + it 'should create an instance of ProductCategoryChild' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ProductCategoryChild) + end + end + + describe 'test attribute "id_big"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "id_small"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_category_spec.rb b/spec/models/product_category_spec.rb new file mode 100644 index 0000000..af1199e --- /dev/null +++ b/spec/models/product_category_spec.rb @@ -0,0 +1,100 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ProductCategory +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ProductCategory do + let(:instance) { ColorMeShop::ProductCategory.new } + + describe 'test an instance of ProductCategory' do + it 'should create an instance of ProductCategory' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ProductCategory) + end + end + + describe 'test attribute "id_big"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "id_small"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "members_only"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "children"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_create_request_spec.rb b/spec/models/product_create_request_spec.rb new file mode 100644 index 0000000..dfcd413 --- /dev/null +++ b/spec/models/product_create_request_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ProductCreateRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ProductCreateRequest do + let(:instance) { ColorMeShop::ProductCreateRequest.new } + + describe 'test an instance of ProductCreateRequest' do + it 'should create an instance of ProductCreateRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ProductCreateRequest) + end + end + + describe 'test attribute "product"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_group_spec.rb b/spec/models/product_group_spec.rb new file mode 100644 index 0000000..ebacc5a --- /dev/null +++ b/spec/models/product_group_spec.rb @@ -0,0 +1,82 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ProductGroup +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ProductGroup do + let(:instance) { ColorMeShop::ProductGroup.new } + + describe 'test an instance of ProductGroup' do + it 'should create an instance of ProductGroup' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ProductGroup) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "parent_group_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_option_spec.rb b/spec/models/product_option_spec.rb new file mode 100644 index 0000000..cebce67 --- /dev/null +++ b/spec/models/product_option_spec.rb @@ -0,0 +1,72 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ProductOption +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ProductOption do + let(:instance) { ColorMeShop::ProductOption.new } + + describe 'test an instance of ProductOption' do + it 'should create an instance of ProductOption' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ProductOption) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "values"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_pickup_spec.rb b/spec/models/product_pickup_spec.rb new file mode 100644 index 0000000..831dc3b --- /dev/null +++ b/spec/models/product_pickup_spec.rb @@ -0,0 +1,66 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ProductPickup +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ProductPickup do + let(:instance) { ColorMeShop::ProductPickup.new } + + describe 'test an instance of ProductPickup' do + it 'should create an instance of ProductPickup' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ProductPickup) + end + end + + describe 'test attribute "pickup_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb new file mode 100644 index 0000000..a2c6e36 --- /dev/null +++ b/spec/models/product_spec.rb @@ -0,0 +1,322 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::Product +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::Product do + let(:instance) { ColorMeShop::Product.new } + + describe 'test an instance of Product' do + it 'should create an instance of Product' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::Product) + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stock_managed"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "few_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "group_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "sales_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sales_price_including_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sales_price_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price_including_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cost"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cool_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unavailable_payment_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unavailable_delivery_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "min_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "max_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_start_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_end_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "weight"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "soldout_display"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "simple_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "smartphone_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "thumbnail_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "images"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "options"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "variants"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pickups"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "digital_conent"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "regular_purchase"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_reduced"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "without_shipping"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_update_request_spec.rb b/spec/models/product_update_request_spec.rb new file mode 100644 index 0000000..f1f1656 --- /dev/null +++ b/spec/models/product_update_request_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ProductUpdateRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ProductUpdateRequest do + let(:instance) { ColorMeShop::ProductUpdateRequest.new } + + describe 'test an instance of ProductUpdateRequest' do + it 'should create an instance of ProductUpdateRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ProductUpdateRequest) + end + end + + describe 'test attribute "product"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/product_variant_spec.rb b/spec/models/product_variant_spec.rb new file mode 100644 index 0000000..b139226 --- /dev/null +++ b/spec/models/product_variant_spec.rb @@ -0,0 +1,126 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ProductVariant +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ProductVariant do + let(:instance) { ColorMeShop::ProductVariant.new } + + describe 'test an instance of ProductVariant' do + it 'should create an instance of ProductVariant' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ProductVariant) + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option1_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "few_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_price_including_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_price_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_members_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_members_price_including_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option_members_price_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/put_product_pickup200_response_pickup_spec.rb b/spec/models/put_product_pickup200_response_pickup_spec.rb new file mode 100644 index 0000000..505a7aa --- /dev/null +++ b/spec/models/put_product_pickup200_response_pickup_spec.rb @@ -0,0 +1,66 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PutProductPickup200ResponsePickup +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PutProductPickup200ResponsePickup do + let(:instance) { ColorMeShop::PutProductPickup200ResponsePickup.new } + + describe 'test an instance of PutProductPickup200ResponsePickup' do + it 'should create an instance of PutProductPickup200ResponsePickup' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PutProductPickup200ResponsePickup) + end + end + + describe 'test attribute "pickup_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "order_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/put_product_pickup200_response_spec.rb b/spec/models/put_product_pickup200_response_spec.rb new file mode 100644 index 0000000..e2ef60d --- /dev/null +++ b/spec/models/put_product_pickup200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PutProductPickup200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PutProductPickup200Response do + let(:instance) { ColorMeShop::PutProductPickup200Response.new } + + describe 'test an instance of PutProductPickup200Response' do + it 'should create an instance of PutProductPickup200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PutProductPickup200Response) + end + end + + describe 'test attribute "pickup"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/put_product_pickup_request_spec.rb b/spec/models/put_product_pickup_request_spec.rb new file mode 100644 index 0000000..0836e55 --- /dev/null +++ b/spec/models/put_product_pickup_request_spec.rb @@ -0,0 +1,46 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::PutProductPickupRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::PutProductPickupRequest do + let(:instance) { ColorMeShop::PutProductPickupRequest.new } + + describe 'test an instance of PutProductPickupRequest' do + it 'should create an instance of PutProductPickupRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::PutProductPickupRequest) + end + end + + describe 'test attribute "pickup_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('Integer', [0, 1, 3, 4]) + # validator.allowable_values.each do |value| + # expect { instance.pickup_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "order_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/sale_delivery_spec.rb b/spec/models/sale_delivery_spec.rb new file mode 100644 index 0000000..f3a67bb --- /dev/null +++ b/spec/models/sale_delivery_spec.rb @@ -0,0 +1,198 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::SaleDelivery +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::SaleDelivery do + let(:instance) { ColorMeShop::SaleDelivery.new } + + describe 'test an instance of SaleDelivery' do + it 'should create an instance of SaleDelivery' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::SaleDelivery) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "detail_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "furigana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "postal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "preferred_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "preferred_period"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "slip_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi_text"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_text"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tracking_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivered"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/sale_detail_spec.rb b/spec/models/sale_detail_spec.rb new file mode 100644 index 0000000..471e6f6 --- /dev/null +++ b/spec/models/sale_detail_spec.rb @@ -0,0 +1,156 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::SaleDetail +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::SaleDetail do + let(:instance) { ColorMeShop::SaleDetail.new } + + describe 'test an instance of SaleDetail' do + it 'should create an instance of SaleDetail' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::SaleDetail) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_delivery_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option1_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option1_index"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_index"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pristine_product_full_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_cost"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_thumbnail_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_mobile_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price_with_tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "subtotal_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/sale_spec.rb b/spec/models/sale_spec.rb new file mode 100644 index 0000000..217f902 --- /dev/null +++ b/spec/models/sale_spec.rb @@ -0,0 +1,312 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::Sale +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::Sale do + let(:instance) { ColorMeShop::Sale.new } + + describe 'test an instance of Sale' do + it 'should create an instance of Sale' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::Sale) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "payment_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "paid"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivered"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "canceled"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "accepted_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.accepted_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "paid_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.paid_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "delivered_mail_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["not_yet", "sent", "pass"]) + # validator.allowable_values.each do |value| + # expect { instance.delivered_mail_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "accepted_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "paid_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivered_mail_sent_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "gmo_point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.gmo_point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "yahoo_point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.yahoo_point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "product_total_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fee"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "noshi_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "card_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "wrapping_total_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "point_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "gmo_point_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "other_discount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "other_discount_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_gmo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_gmo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "granted_yahoo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "use_yahoo_points"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "external_order_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "customer"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "details"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_deliveries"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "segment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "totals"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/send_sales_mail_request_mail_spec.rb b/spec/models/send_sales_mail_request_mail_spec.rb new file mode 100644 index 0000000..3530779 --- /dev/null +++ b/spec/models/send_sales_mail_request_mail_spec.rb @@ -0,0 +1,40 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::SendSalesMailRequestMail +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::SendSalesMailRequestMail do + let(:instance) { ColorMeShop::SendSalesMailRequestMail.new } + + describe 'test an instance of SendSalesMailRequestMail' do + it 'should create an instance of SendSalesMailRequestMail' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::SendSalesMailRequestMail) + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["accepted", "paid", "delivered"]) + # validator.allowable_values.each do |value| + # expect { instance.type = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/send_sales_mail_request_spec.rb b/spec/models/send_sales_mail_request_spec.rb new file mode 100644 index 0000000..6fbc536 --- /dev/null +++ b/spec/models/send_sales_mail_request_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::SendSalesMailRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::SendSalesMailRequest do + let(:instance) { ColorMeShop::SendSalesMailRequest.new } + + describe 'test an instance of SendSalesMailRequest' do + it 'should create an instance of SendSalesMailRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::SendSalesMailRequest) + end + end + + describe 'test attribute "mail"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/shop_coupon_spec.rb b/spec/models/shop_coupon_spec.rb new file mode 100644 index 0000000..d75f87f --- /dev/null +++ b/spec/models/shop_coupon_spec.rb @@ -0,0 +1,130 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::ShopCoupon +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::ShopCoupon do + let(:instance) { ColorMeShop::ShopCoupon.new } + + describe 'test an instance of ShopCoupon' do + it 'should create an instance of ShopCoupon' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::ShopCoupon) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "code"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "coupon_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["amount", "rate", "delivery_charge"]) + # validator.allowable_values.each do |value| + # expect { instance.coupon_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "discount_amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "minimum_amount"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "starts_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "ends_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "total_usage_limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "usage_limit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["indisposable", "disposable"]) + # validator.allowable_values.each do |value| + # expect { instance.usage_limit = value }.not_to raise_error + # end + end + end + + describe 'test attribute "group_limit_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["none", "including", "excluding"]) + # validator.allowable_values.each do |value| + # expect { instance.group_limit_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["unavailable", "available"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "created_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "updated_at"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/shop_spec.rb b/spec/models/shop_spec.rb new file mode 100644 index 0000000..1ae074f --- /dev/null +++ b/spec/models/shop_spec.rb @@ -0,0 +1,280 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::Shop +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::Shop do + let(:instance) { ColorMeShop::Shop.new } + + describe 'test an instance of Shop' do + it 'should create an instance of Shop' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::Shop) + end + end + + describe 'test attribute "id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["enabled", "suspended", "unsigned"]) + # validator.allowable_values.each do |value| + # expect { instance.state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "domain_plan"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["cmsp_sub_domain", "own_domain", "own_sub_domain"]) + # validator.allowable_values.each do |value| + # expect { instance.domain_plan = value }.not_to raise_error + # end + end + end + + describe 'test attribute "contract_plan"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["unknown", "economy", "small", "regular", "lolipop", "heteml", "platinum", "goope", "large", "dormant", "free", "premium"]) + # validator.allowable_values.each do |value| + # expect { instance.contract_plan = value }.not_to raise_error + # end + end + end + + describe 'test attribute "contract_start_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "contract_end_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "contract_term"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "last_login_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "setup_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "open_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) + # validator.allowable_values.each do |value| + # expect { instance.open_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "mobile_open_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["opened", "closed", "prepare", "paused"]) + # validator.allowable_values.each do |value| + # expect { instance.mobile_open_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "login_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name1_kana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name2_kana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "hojin"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "hojin_kana"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "user_mail"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tel"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "fax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "postal"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "pref_name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "address2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "title"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "title_short"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "shop_mail_1"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "shop_mail_2"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_type"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["excluded", "included"]) + # validator.allowable_values.each do |value| + # expect { instance.tax_type = value }.not_to raise_error + # end + end + end + + describe 'test attribute "tax"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_rounding_method"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["round_off", "round_down", "round_up"]) + # validator.allowable_values.each do |value| + # expect { instance.tax_rounding_method = value }.not_to raise_error + # end + end + end + + describe 'test attribute "reduce_tax_rate"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "shop_logo_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/stat_sale200_response_sales_stat_spec.rb b/spec/models/stat_sale200_response_sales_stat_spec.rb new file mode 100644 index 0000000..5dde9f2 --- /dev/null +++ b/spec/models/stat_sale200_response_sales_stat_spec.rb @@ -0,0 +1,78 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::StatSale200ResponseSalesStat +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::StatSale200ResponseSalesStat do + let(:instance) { ColorMeShop::StatSale200ResponseSalesStat.new } + + describe 'test an instance of StatSale200ResponseSalesStat' do + it 'should create an instance of StatSale200ResponseSalesStat' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::StatSale200ResponseSalesStat) + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount_today"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "count_today"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount_last_7days"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "count_last_7days"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "amount_this_month"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "count_this_month"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/stat_sale200_response_spec.rb b/spec/models/stat_sale200_response_spec.rb new file mode 100644 index 0000000..7187872 --- /dev/null +++ b/spec/models/stat_sale200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::StatSale200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::StatSale200Response do + let(:instance) { ColorMeShop::StatSale200Response.new } + + describe 'test an instance of StatSale200Response' do + it 'should create an instance of StatSale200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::StatSale200Response) + end + end + + describe 'test attribute "sales_stat"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/stock_spec.rb b/spec/models/stock_spec.rb new file mode 100644 index 0000000..69b178c --- /dev/null +++ b/spec/models/stock_spec.rb @@ -0,0 +1,250 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::Stock +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::Stock do + let(:instance) { ColorMeShop::Stock.new } + + describe 'test an instance of Stock' do + it 'should create an instance of Stock' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::Stock) + end + end + + describe 'test attribute "account_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "product_id"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option1_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "few_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "variant_model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "sales_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cost"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "delivery_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cool_charge"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "min_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "max_num"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_start_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sale_end_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "unit"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "weight"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "soldout_display"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sort"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "simple_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "smartphone_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "make_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "update_date"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "memo"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "mobile_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "thumbnail_image_url"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "images"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/update_product_request_product_spec.rb b/spec/models/update_product_request_product_spec.rb new file mode 100644 index 0000000..a1af34a --- /dev/null +++ b/spec/models/update_product_request_product_spec.rb @@ -0,0 +1,136 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateProductRequestProduct +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateProductRequestProduct do + let(:instance) { ColorMeShop::UpdateProductRequestProduct.new } + + describe 'test an instance of UpdateProductRequestProduct' do + it 'should create an instance of UpdateProductRequestProduct' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::UpdateProductRequestProduct) + end + end + + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category_id_big"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "category_id_small"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "cost"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "sales_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "members_price"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "model_number"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "simple_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "smartphone_expl"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "display_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["showing", "hidden", "showing_for_members", "sale_for_members"]) + # validator.allowable_values.each do |value| + # expect { instance.display_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "stock_managed"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "group_ids"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "variants"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "tax_reduced"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/update_product_request_product_stocks_one_of_spec.rb b/spec/models/update_product_request_product_stocks_one_of_spec.rb new file mode 100644 index 0000000..99f5920 --- /dev/null +++ b/spec/models/update_product_request_product_stocks_one_of_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateProductRequestProductStocksOneOf +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateProductRequestProductStocksOneOf do + let(:instance) { ColorMeShop::UpdateProductRequestProductStocksOneOf.new } + + describe 'test an instance of UpdateProductRequestProductStocksOneOf' do + it 'should create an instance of UpdateProductRequestProductStocksOneOf' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::UpdateProductRequestProductStocksOneOf) + end + end + + describe 'test attribute "increment"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/update_product_request_product_stocks_spec.rb b/spec/models/update_product_request_product_stocks_spec.rb new file mode 100644 index 0000000..0fd254e --- /dev/null +++ b/spec/models/update_product_request_product_stocks_spec.rb @@ -0,0 +1,32 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateProductRequestProductStocks +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateProductRequestProductStocks do + describe '.openapi_one_of' do + it 'lists the items referenced in the oneOf array' do + expect(described_class.openapi_one_of).to_not be_empty + end + end + + describe '.build' do + it 'returns the correct model' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end +end diff --git a/spec/models/update_product_request_product_variants_inner_spec.rb b/spec/models/update_product_request_product_variants_inner_spec.rb new file mode 100644 index 0000000..4a818b8 --- /dev/null +++ b/spec/models/update_product_request_product_variants_inner_spec.rb @@ -0,0 +1,48 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateProductRequestProductVariantsInner +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateProductRequestProductVariantsInner do + let(:instance) { ColorMeShop::UpdateProductRequestProductVariantsInner.new } + + describe 'test an instance of UpdateProductRequestProductVariantsInner' do + it 'should create an instance of UpdateProductRequestProductVariantsInner' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::UpdateProductRequestProductVariantsInner) + end + end + + describe 'test attribute "option1_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "option2_value"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "stocks"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/update_product_request_product_variants_inner_stocks_spec.rb b/spec/models/update_product_request_product_variants_inner_stocks_spec.rb new file mode 100644 index 0000000..5dfd865 --- /dev/null +++ b/spec/models/update_product_request_product_variants_inner_stocks_spec.rb @@ -0,0 +1,32 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateProductRequestProductVariantsInnerStocks +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateProductRequestProductVariantsInnerStocks do + describe '.openapi_one_of' do + it 'lists the items referenced in the oneOf array' do + expect(described_class.openapi_one_of).to_not be_empty + end + end + + describe '.build' do + it 'returns the correct model' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end +end diff --git a/spec/models/update_product_request_spec.rb b/spec/models/update_product_request_spec.rb new file mode 100644 index 0000000..b5e1218 --- /dev/null +++ b/spec/models/update_product_request_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateProductRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateProductRequest do + let(:instance) { ColorMeShop::UpdateProductRequest.new } + + describe 'test an instance of UpdateProductRequest' do + it 'should create an instance of UpdateProductRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::UpdateProductRequest) + end + end + + describe 'test attribute "product"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/update_sale200_response_spec.rb b/spec/models/update_sale200_response_spec.rb new file mode 100644 index 0000000..4bc30c4 --- /dev/null +++ b/spec/models/update_sale200_response_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateSale200Response +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateSale200Response do + let(:instance) { ColorMeShop::UpdateSale200Response.new } + + describe 'test an instance of UpdateSale200Response' do + it 'should create an instance of UpdateSale200Response' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::UpdateSale200Response) + end + end + + describe 'test attribute "sale"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/update_sale_request_sale_spec.rb b/spec/models/update_sale_request_sale_spec.rb new file mode 100644 index 0000000..31374e6 --- /dev/null +++ b/spec/models/update_sale_request_sale_spec.rb @@ -0,0 +1,52 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateSaleRequestSale +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateSaleRequestSale do + let(:instance) { ColorMeShop::UpdateSaleRequestSale.new } + + describe 'test an instance of UpdateSaleRequestSale' do + it 'should create an instance of UpdateSaleRequestSale' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::UpdateSaleRequestSale) + end + end + + describe 'test attribute "paid"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + + describe 'test attribute "point_state"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["assumed", "fixed", "cenceled"]) + # validator.allowable_values.each do |value| + # expect { instance.point_state = value }.not_to raise_error + # end + end + end + + describe 'test attribute "sale_deliveries"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/models/update_sale_request_spec.rb b/spec/models/update_sale_request_spec.rb new file mode 100644 index 0000000..ab9aa94 --- /dev/null +++ b/spec/models/update_sale_request_spec.rb @@ -0,0 +1,36 @@ +=begin +#カラーミーショップ API + +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
+ +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 7.2.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for ColorMeShop::UpdateSaleRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe ColorMeShop::UpdateSaleRequest do + let(:instance) { ColorMeShop::UpdateSaleRequest.new } + + describe 'test an instance of UpdateSaleRequest' do + it 'should create an instance of UpdateSaleRequest' do + # uncomment below to test the instance creation + #expect(instance).to be_instance_of(ColorMeShop::UpdateSaleRequest) + end + end + + describe 'test attribute "sale"' do + it 'should work' do + # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/ + end + end + +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cb8472f..d7c3aa7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,12 +1,12 @@ =begin #カラーミーショップ API -## カラーミーショップ API [カラーミーショップ](https://shop-pro.jp) APIでは、受注の検索や商品情報の更新を行うことができます。 ## 利用手順 はじめに、カラーミーデベロッパーアカウントを用意します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリケーション登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 その後、カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面で確認できるクライアントID| |`response_type`|\"code\"という文字列| |`scope`| 別表参照| |`redirect_url`|アプリケーション登録時に入力したリダイレクトURL| `scope`は、以下のうち、アプリケーションが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのIDとパスワードの入力を求められます。 承認ボタンを押すと、このアプリケーションがショップのデータにアクセスすることが許可され、リダイレクトURLへリダイレクトされます。 承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリケーション登録時のリダイレクトURLに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされます。 末尾のパスが認可コードになっています。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 最後に、認可コードとアクセストークンを交換します。以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリケーション詳細画面に表示されているクライアントID| |`client_secret`|アプリケーション詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"という文字列| |`redirect_uri`|アプリケーション登録時に入力したリダイレクトURL| ```console # curl での例 $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返ってきます。 ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、許可済みアプリケーション一覧画面から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する際の例を示します。 ```console # curlの例 $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPI v1では - エラーコード - エラーメッセージ - ステータスコード の配列でエラーを表現します。以下に例を示します。 ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` +## カラーミーショップ API ## 利用手順 ### OAuthアプリケーションの登録 デベロッパーアカウントをお持ちでない場合は作成します。[デベロッパー登録ページ](https://api.shop-pro.jp/developers/sign_up)から登録してください。 次に、[登録ページ](https://api.shop-pro.jp/oauth/applications/new)からアプリ登録を行ってください。 スマートフォンのWebViewを利用する場合は、リダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を入力してください。 ### 認可 カラーミーショップアカウントの認証ページを開きます。認証ページのURLは、`https://api.shop-pro.jp/oauth/authorize`に必要なパラメータをつけたものです。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面で確認できるクライアントID| |`response_type`|\"code\"を指定| |`scope`| 別表参照| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| `scope`は、以下のうち、アプリが利用したい機能をスペース区切りで指定してください。 |スコープ|機能| |---|---| |`read_products`|商品データの参照| |`write_products`|在庫データの更新| |`read_sales`|受注・顧客データの参照| |`write_sales`|受注データの更新| |`read_shop_coupons`|ショップクーポンの参照| 以下のようなURLとなります。 ``` https://api.shop-pro.jp/oauth/authorize?client_id=CLIENT_ID&redirect_uri=REDIRECT_URI&response_type=code&scope=read_products%20write_products ``` 初めてこのページを訪れる場合は、カラーミーショップアカウントのログインIDとパスワードの入力を求められます。 ログイン後の認証ページでアプリとの連携が承認された場合は、`code`というクエリパラメータに認可コードが付与されます。承認がキャンセルされた、またはエラーが起きた場合は、 `error`パラメータにエラーの内容を表す文字列が与えられます。 アプリ登録時のリダイレクトURIに`urn:ietf:wg:oauth:2.0:oob`を指定した場合は、以下のようなURLにリダイレクトされ、 認可コードがURLの末尾に付与されます。 ``` https://api.shop-pro.jp/oauth/authorize/AUTH_CODE ``` 認可コードの有効期限は発行から10分間です。 ### 認可コードをアクセストークンに交換 以下のパラメータを付けて、`https://api.shop-pro.jp/oauth/token`へリクエストを送ります。 |パラメータ名|値| |---|---| |`client_id`|アプリ詳細画面に表示されているクライアントID| |`client_secret`|アプリ詳細画面に表示されているクライアントシークレット| |`code`|取得した認可コード| |`grant_type`|\"authorization_code\"を指定| |`redirect_uri`|アプリ登録時に入力したリダイレクトURI| curlによるリクエストの例を以下に示します。 ```console $ curl -X POST \\ -d'client_id=CLIENT_ID' \\ -d'client_secret=CLIENT_SECRET' \\ -d'code=CODE' \\ -d'grant_type=authorization_code' \\ -d'redirect_uri=REDIRECT_URI' \\ 'https://api.shop-pro.jp/oauth/token' ``` リクエストが成功すると、以下のようなJSONが返却されます ```json { \"access_token\": \"d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX\", \"token_type\": \"bearer\", \"scope\": \"read_products write_products\" } ``` アクセストークンに有効期限はありませんが、[許可済みアプリ一覧画面](https://admin.shop-pro.jp/?mode=app_use_lst)から失効させることができます。なお、同じ認可コードをアクセストークンに交換できるのは1度だけです。 ### APIの利用 取得したアクセストークンは、Authorizationヘッダに入れて使用します。以下にショップ情報を取得する例を示します。 ```console $ curl -H 'Authorization: Bearer d461ab8XXXXXXXXXXXXXXXXXXXXXXXXX' https://api.shop-pro.jp/v1/shop.json ``` ## エラー カラーミーショップAPIでは、以下の形式の配列でエラーを表現します。 - `code` エラーコード - `message` エラーメッセージ - `status` ステータスコード ```json { \"errors\": [ { \"code\": 404100, \"message\": \"レコードが見つかりませんでした。\", \"status\": 404 } ] } ``` ## 都道府県コードについて APIを利用して都道府県コードを更新したり、レスポンスを参照される際には以下の表を参考にしてください。
都道府県コード一覧 |id|都道府県| |---|---| |1|北海道| |2|青森県| |3|岩手県| |4|秋田県| |5|宮城県| |6|山形県| |7|福島県| |8|茨城県| |9|栃木県| |10|群馬県| |11|埼玉県| |12|千葉県| |13|東京都| |14|神奈川県| |15|新潟県| |16|福井県| |17|石川県| |18|富山県| |19|静岡県| |20|山梨県| |21|長野県| |22|愛知県| |23|岐阜県| |24|三重県| |25|和歌山県| |26|滋賀県| |27|奈良県| |28|京都府| |29|大阪府| |30|兵庫県| |31|岡山県| |32|広島県| |33|鳥取県| |34|島根県| |35|山口県| |36|香川県| |37|徳島県| |38|愛媛県| |39|高知県| |40|福岡県| |41|佐賀県| |42|長崎県| |43|大分県| |44|熊本県| |45|宮崎県| |46|鹿児島県| |47|沖縄県| |48|海外|
-OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech -OpenAPI Generator version: 3.0.1-SNAPSHOT +OpenAPI Generator version: 7.2.0-SNAPSHOT =end