{"id":182,"date":"2015-07-11T00:04:17","date_gmt":"2015-07-10T15:04:17","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2015\/07\/11\/rails_web_api_validation"},"modified":"2022-10-26T10:10:09","modified_gmt":"2022-10-26T01:10:09","slug":"rails_web_api_validation","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2015\/07\/11\/rails_web_api_validation\/","title":{"rendered":"Ruby on Rails \u3067 Web API \u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3059\u308b"},"content":{"rendered":"

MMM\u306e\u524d\u7530\u3067\u3059\u3002
\n\u65e9\u3044\u3082\u306e\u3067\u3001MMM\u306b\u5165\u793e\u3057\u3066\u304b\u30891\u5e74\u304c\u7d4c\u904e\u3057\u307e\u3057\u305f\u3002
\n\u632f\u308a\u8fd4\u3063\u3066\u307f\u308b\u3068\u3001\u3053\u306e1\u5e74\u306f\u307b\u307cRuby on Rails<\/strong>\u3067Web API<\/strong>\u3092\u4f5c\u3063\u3066\u3044\u307e\u3057\u305f\u3002
\n\u5e38\u306bRails<\/strong>\u306b\u89e6\u308c\u308b\u3053\u3068\u304c\u51fa\u6765\u3001\u975e\u5e38\u306b\u697d\u3057\u3044\u4e00\u5e74\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n

\u672c\u65e5\u306fRuby on Rails<\/strong> \u306e Web API<\/strong>\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u3069\u306e\u3088\u3046\u306b\u30c1\u30a7\u30c3\u30af\u3057\u3066\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u3057\u3066\u3044\u308b\u304b\u3092\u7e8f\u3081\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n

ruby version 2.2.2
\nRuby on Rails version 4.2.2<\/p>\n

\u4f55\u6545WebAPI\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u304c\u5fc5\u8981\u306a\u306e\u304b<\/h2>\n

\u4f8b\u3048\u3070\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u7121\u3057\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53d7\u3051\u53d6\u3063\u305f\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3067\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u3088\u3063\u3066\u671f\u5f85\u3057\u306a\u3044\u7d50\u679c\u306b\u306a\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n

Book.where(id: params[:book_id])<\/code><\/pre>\n

\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u306fActiveRecord<\/strong>\u306e\u57fa\u672c\u7684\u306a\u691c\u7d22\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u304c\u3001params[:book_id]<\/code>\u304c\u6587\u5b57\u5217\u3067\u3082\u6570\u5024\u3067\u3082\u914d\u5217\u3067\u3082\u691c\u7d22\u3057\u307e\u3059\u3002
\n\u578b\u3092\u53b3\u5bc6\u306b\u30c1\u30a7\u30c3\u30af\u3057\u306a\u304f\u3066\u3082\u52d5\u3044\u3066\u3057\u307e\u3046\u3001\u3068\u3044\u3046\u3068\u3053\u308d\u304cRuby\u306e\u3044\u3044\u3068\u3053\u308d\u3067\u3082\u3042\u308a\u3001\u60aa\u3044\u3068\u3053\u308d\u3067\u3059\u3088\u306d\u3002
\n\u578b\u306eError<\/strong>\u306b\u306a\u3089\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u306f\u3001\u958b\u767a\u8005\u304c\u53b3\u5bc6\u306b\u30c1\u30a7\u30c3\u30af\u3057\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n

\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u30b5\u30fc\u30d0\u30fc\u5074\u3067\u306f\u914d\u5217\u3067\u53d7\u3051\u53d6\u308a\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u4e00\u89a7\u3092\u8fd4\u3059\u3001\u3068\u3044\u3046\u51e6\u7406\u3092\u3057\u305f\u304b\u3063\u305f\u3068\u3057\u3066\u3082\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u914d\u5217\u3067\u30dd\u30b9\u30c8\u3057\u306a\u3044\u6642\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002
\n\u3057\u304b\u3057\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306f\u5c11\u306a\u304f\u3068\u3082\u3001\uff11\u3064\u306f\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u53d6\u5f97\u51fa\u6765\u308b\u306e\u3067\u3001\u30a8\u30e9\u30fc\u3067\u306f\u306a\u3044\u3068\u52d8\u9055\u3044\u3057\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u3066\u3057\u307e\u3046\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n

\u3053\u3046\u3044\u3063\u305f\u3053\u3068\u3092\u672a\u7136\u306b\u9632\u3050\u305f\u3081\u306b\u3001\u578b\u30c1\u30a7\u30c3\u30af\u306a\u3069\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u51e6\u7406\u304c\u5fc5\u8981\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002
\n\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306a\u3069\u306b\u914d\u5217\u3067\u30dd\u30b9\u30c8\u3057\u3066\u4e0b\u3055\u3044\u3068\u66f8\u3044\u3066\u3044\u308b\u306e\u3067\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306e\u8cac\u4efb\u3067\u3059\u3088<\/strong>\u3001\u3068\u3044\u3046\u898b\u65b9\u3082\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u305d\u3082\u305d\u3082API\u3068\u3057\u3066\u3001\u671f\u5f85\u3057\u306a\u3044\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u53d7\u3051\u4ed8\u3051\u304c\u51fa\u6765\u3066\u3057\u307e\u3046\u3001\u3068\u3044\u3046\u3053\u3068\u304c\u304a\u304b\u3057\u3044\u306e\u3060\u3068\u601d\u3044\u307e\u3059\u3002
\nWebAPI<\/strong>\u306f\u3001\u69d8\u3005\u306a\u958b\u767a\u8005\u304c\u4f7f\u3046\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u958b\u767a\u8005\u306b\u3088\u3063\u3066\u30df\u30b9\u304c\u8d77\u3053\u3063\u305f\u308a\u3059\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002
\n\u7d50\u8ad6\u3068\u3057\u3066\u306f\u3001\u3084\u306f\u308a\u30b5\u30fc\u30d0\u30fc\u5074\u3067\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u8a18\u8f09\u901a\u308a\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u53b3\u5bc6\u306b\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3001\u4e0d\u6b63\u306a\u6642\u306f\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306b\u6559\u3048\u3066\u3042\u3052\u308b\u3001\u3068\u3044\u3046\u51e6\u7406\u3092\u3059\u308b\u3053\u3068\u304c\u4e00\u756a\u826f\u3044\u306e\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\u3069\u306e\u3088\u3046\u306b\u5b9f\u88c5\u3059\u308b\u304b<\/h2>\n

\u524d\u7f6e\u304d\u306f\u3055\u3066\u304a\u304d\u3001\u5b9f\u969b\u306eAPI\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u3069\u306e\u3088\u3046\u306b\u5b9f\u88c5\u3059\u308b\u306e\u304cRuby on Rails<\/strong>\u3068\u3057\u3066\u826f\u3044\u65b9\u6cd5\u306a\u306e\u304b\uff1f\u3068\u3044\u3046\u3053\u3068\u3092\u3001\u793e\u5185\u306e\u30b5\u30fc\u30d0\u30fc\u30c1\u30fc\u30e0\u3067\u8b70\u8ad6\u3057\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n

\u73fe\u5728\u4f7f\u3063\u3066\u3044\u308b\u65b9\u6cd5\u306f\u3001API\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u5c02\u7528\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u3092\u4f5c\u308a\u3001\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3001\u3068\u3044\u3046\u5b9f\u88c5\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u30fb\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u591a\u3044\u6642\u3084\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30ed\u30b8\u30c3\u30af\u304c\u8907\u96d1\u306a\u6642\u306f\u3001\u4fdd\u5b58\u3084\u691c\u7d22\u3092\u3059\u308b\u30af\u30e9\u30b9\u3068\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u307f\u3092\u3059\u308b\u30af\u30e9\u30b9\u3092\u5206\u5272\u3059\u308b
\n\u30fb\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5c11\u306a\u3044\u6642\u306f\u4fdd\u5b58\u3084\u691c\u7d22\u3059\u308b\u30af\u30e9\u30b9\u3068\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3059\u308b\u30af\u30e9\u30b9\u3092\u4e00\u7dd2\u306b\u3059\u308b<\/p>\n

\u4e0a\u8a182\u3064\u306e\u30d1\u30bf\u30fc\u30f3\u306b\u5206\u3051\u3066\u5b9f\u88c5\u3092\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5c11\u306a\u3044\u6642<\/h3>\n

\u4f8b\u3048\u3070\u672c\u3092\u4fdd\u5b58\u3059\u308b\u3001\u3068\u3044\u3046API\u3092\u4f5c\u3063\u3066\u307f\u307e\u3059\u3002<\/p>\n

\u4fdd\u5b58 + \u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30af\u30e9\u30b9<\/strong><\/p>\n

# Book\nclass BookForm\n  include Virtus.model\n  include ActiveModel::Model\n\n  NATURAL_NUMBER = { only_integer: true, greater_than_or_equal_to: 0 }\n\n  attribute :price, Integer\n  attribute :author, String\n  attribute :publisher, String\n  attribute :store, Array\n\n  validates :book_id, presence: true, numericality: NATURAL_NUMBER\n  validates :author, presence: true\n  validates :publisher, presence: true\n  validates :store_id, array_with_integer: true, if: 'store.present?'\n\n  def save!\n    book = Book.new(price: price, author: author, publisher: publisher)\n    book.stores = Store.where(id: sotore_id)\n    book.save!\n  end\nend<\/code><\/pre>\n

Virtus.model<\/strong>\u3067\u5c5e\u6027\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3001ActiveModel::Model<\/strong>\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u6a5f\u80fd\u3092\u4f7f\u3046\u70ba\u306b\u305d\u308c\u305e\u308c\u3092include<\/strong>\u3057\u3066\u3044\u307e\u3059\u3002
\n\u3053\u3061\u3089\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u3002
\n\u80a5\u5927\u5316\u3057\u305fActiveRecord\u30e2\u30c7\u30eb\u3092\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u3059\u308b7\u3064\u306e\u65b9\u6cd5<\/a><\/p>\n

\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u5b9f\u88c5<\/strong><\/p>\n

# Api\nmodule Api\n  # version 1\n  module V1\n    # Book\n    class BookController < ActionController::Base\n\n      def create\n        book_form = BookForm.new(book_params)\n        render_400(book_form) if book_form.invalid?\n        book_form.save!\n        render_200\n      end\n\n      def book_params\n        params.permit(:price, :author, :publisher, :sotore_id)\n      end\n\n      def render_200\n        render json: { status: 200, message: 'success!' }\n      end\n\n      def render_400(book_form)\n        json = { status: 400,\n                 message: 'invalid params',\n                 error_params: errors(book_form) }\n        render json: json\n      end\n\n      def errors(book_form)\n        book_form.errors.messages.keys.map(&:to_s)\n      end\n    end\n  end\nend<\/code><\/pre>\n

BookForm<\/strong>\u30af\u30e9\u30b9\u306b\u5bfe\u3057\u3066ActiveModel<\/strong>\u306einvalid?**\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u3057\u3066\u3044\u307e\u3059\u3002
\n\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u30a8\u30e9\u30fc\u306e\u6642\u306f\u3001\u3069\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c<\/strong>invalid**\u306a\u306e\u304b\u3082\u8fd4\u3057\u3066\u3042\u3052\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u591a\u3044\u6642\u3084\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30ed\u30b8\u30c3\u30af\u304c\u8907\u96d1\u306a\u6642<\/h3>\n

\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u591a\u3044\u6642\u306f\u3084\u30ed\u30b8\u30c3\u30af\u304c\u8907\u96d1\u306a\u6642\u306f\u3001\u66f4\u306b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u3092\u5225\u3067\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n

# BooksParamsValidator\nclass BooksParamsValidator\n  include ActiveModel::Model\n  NATURAL_NUMBER = { only_integer: true, greater_than_or_equal_to: 0 }\n\n  attr_accessor :book_id,\n                :author,\n                :publisher,\n                :store,\n                :publisher_tel,\n                :publisher_email\n\n  validates :book_id, presence: true, numericality: NATURAL_NUMBER\n  validates :author, presence: true\n  validates :publisher, presence: true\n  validates :store, array_with_integer: true, allow_blank: true\n\n  # publisher_tel\u3068publisher_email\u306f\u3069\u3061\u3089\u304b\u304c\u5fc5\u9808\u3067\u3001\n  # \u540c\u6642\u306b\u6307\u5b9a\u51fa\u6765\u306a\u3044\u3001\u3068\u3044\u3046\u30ed\u30b8\u30c3\u30af\n  validates :publisher_tel, presence: true, if: 'publisher_email.nil?'\n  validates :publisher_email, presence: true, if: 'publisher_tel.nil?'\n  validate :prohibit_2_publisher_attributes\n\n  def prohibit_2_publisher_attributes\n    errors_add(:publisher) if publisher_tel.present? && publisher_email.present?\n  end\n\n  def errors_add(key)\n    errors.add(key, key.to_s.delete('_id') + ' have 2 attributes')\n  end\n\n  class << self\n    def init_with_params(params)\n      new(params.permit(:book_id,\n                        :author,\n                        :publisher,\n                        :publisher_tel,\n                        :publisher_email,\n                        store: []))\n    end\n  end\nend<\/code><\/pre>\n

\u4e0a\u8a18\u306e\u3088\u3046\u306b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30ed\u30b8\u30c3\u30af\u304c\u8907\u96d1\u306b\u306a\u3063\u3066\u304f\u308b\u3068\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u3092\u5206\u3051\u305f\u307b\u3046\u304c\u898b\u901a\u3057\u304c\u826f\u304f\u306a\u3063\u3066\u826f\u3044\u3068\u601d\u3044\u307e\u3059\u3002
\ninit_with_params(params)<\/code>\u30e1\u30bd\u30c3\u30c9\u3067\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306eActionController::Parameters<\/code>\u3092\u305d\u306e\u307e\u307e\u53d7\u3051\u53d6\u3063\u3066permit<\/code>\u3059\u308b\u3088\u3046\u306b\u3057\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306e\u8ca0\u62c5\u3092\u8efd\u304f\u3057\u3066\u3044\u307e\u3059\u3002
\n\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u66f8\u304d\u307e\u3059\u3002<\/p>\n

 book_validator = BookValidator.init_with_params(params)\n render_400(book_validator) if book_validator.inivalid?<\/code><\/pre>\n

\u307e\u305f\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u3067validates :store, array_with_integer<\/code>\u306e\u3088\u3046\u306b\u66f8\u3044\u3066\u3044\u308b\u914d\u5217\u3067\u3001\u304b\u3064\u4e2d\u8eab\u304c\u6570\u5024\u304b\u3092\u78ba\u8a8d\u3059\u308barray_with_integer<\/strong>\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30e1\u30bd\u30c3\u30c9\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306b\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

class ArrayWithIntegerValidator < ActiveModel::EachValidator\n  def validate_each(record, attribute, value)\n    return errors_add(record, attribute) if value.nil?\n    return errors_add(record, attribute) unless value.instance_of?(Array)\n    return errors_add(record, attribute) if value.empty?\n    value.each do |v|\n      return errors_add(record, attribute) unless v.is_a?(Integer)\n    end\n  end\n\n  def errors_add(record, attribute)\n    record.errors[attribute] << (options[:message] || 'not array with integer')\n  end\nend<\/code><\/pre>\n

\u3053\u308c\u3067\u7d50\u69cb\u53b3\u5bc6\u306b\u30c1\u30a7\u30c3\u30af\u6a5f\u80fd\u3092\u6301\u305f\u305b\u3001\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30ed\u30b8\u30c3\u30af\u3092\u5206\u5272\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u898b\u901a\u3057\u3092\u826f\u304f\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305f\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n

\u30c6\u30b9\u30c8\u306b\u3064\u3044\u3066<\/h2>\n

\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u3067\u30c6\u30b9\u30c8\u3059\u308b\u304b\u3001end-to-end test<\/strong>\u3067\u30c6\u30b9\u30c8\u3059\u308b\u304b\u3069\u3061\u3089\u304c\u826f\u3044\u304b\u3002<\/p>\n

DB\u306b\u4fdd\u5b58\u3055\u308c\u308b\u307e\u3067\u306b\u306f\u4ee5\u4e0b\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u304c\u901a\u308a\u307e\u3059\u3002<\/p>\n

\u30fb\u30ea\u30af\u30a8\u30b9\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3
\n\u30fbActiveRecord\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3
\n\u30fbDB\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3<\/p>\n

\u672c\u6765\u3001\u4e0a\u8a18\u306e\u5404\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u540c\u4e00\u306b\u3059\u308b\u3079\u304d\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u5b8c\u5168\u306b\u540c\u4e00\u306b\u3059\u308b\u306e\u306f\u96e3\u3057\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002
\n\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u306e\u30c6\u30b9\u30c8\u306e\u307f\u3060\u3068\u4e0d\u5341\u5206\u306a\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u5fc5\u305aend-to-end test<\/strong>\u3067\u30c1\u30a7\u30c3\u30af\u3057\u3001\u91cd\u8907\u306b\u306a\u308b\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u30af\u30e9\u30b9\u306e\u30c6\u30b9\u30c8\u306f\u7701\u7565\u3059\u308b\u3053\u3068\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n

<\/h2>\n

\u4ee5\u4e0a\u3001\u5f0a\u793e\u3067\u5b9f\u88c5\u3057\u3066\u3044\u308bRuby on Rails \u3067\u306e WebAPI<\/strong>\u306e\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066\u7e8f\u3081\u3066\u307f\u307e\u3057\u305f\u3002
\n\u5b9f\u88c5\u3067\u60a9\u3093\u3067\u3044\u308b\u65b9\u306e\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n

Ruby on Rails\u3092\u6d3b\u7528\u3057\u305fWeb\u30b5\u30fc\u30d3\u30b9\u3084\u696d\u52d9\u30b7\u30b9\u30c6\u30e0\u958b\u767a<\/a>\u3092\u3054\u691c\u8a0e\u306e\u4f01\u696d\u69d8\u306f\u3001\u662f\u975eMMM\u306b\u3054\u76f8\u8ac7\u4e0b\u3055\u3044\u307e\u305b\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

MMM\u306e\u524d\u7530\u3067\u3059\u3002 \u65e9\u3044\u3082\u306e\u3067\u3001MMM\u306b\u5165\u793e\u3057\u3066\u304b\u30891\u5e74\u304c\u7d4c\u904e\u3057\u307e\u3057\u305f\u3002 \u632f\u308a\u8fd4\u3063\u3066\u307f\u308b\u3068\u3001\u3053\u306e1\u5e74\u306f\u307b\u307cRuby on Rails\u3067Web API\u3092\u4f5c\u3063\u3066\u3044\u307e\u3057\u305f\u3002 \u5e38\u306bRails\u306b\u89e6\u308c\u308b\u3053\u3068\u304c\u51fa\u6765\u3001\u975e\u5e38\u306b\u697d\u3057\u3044\u4e00\u5e74\u306b\u306a\u308a\u307e\u3057\u305f\u3002 \u672c\u65e5\u306fRuby on Rails \u306e Web API\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u3069\u306e\u3088\u3046\u306b\u30c1\u30a7\u30c3\u30af\u3057\u3066\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u3092\u3057\u3066\u3044\u308b\u304b\u3092\u7e8f\u3081\u3066\u307f\u307e\u3057\u305f\u3002 ruby v […]<\/p>\n","protected":false},"author":1,"featured_media":684,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[42],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/182"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=182"}],"version-history":[{"count":1,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/182\/revisions"}],"predecessor-version":[{"id":3367,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/182\/revisions\/3367"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}