この記事を使用しようとしています: https://github.com/Licensario/licensario-rest-protocol/blob/master/rest-api.md#feature-usage
だから私は書いた:
## get request
feature_allocation_req = Net::HTTP::Get.new("/api/v1/users/external/#{user_id}/features/VIEW_TASKSed8e919e60/alloc?paymentPlanId=SUBSCRIPTI33dbf5e82a");
## add the headers
feature_allocation_req.add_field('ISV_API_KEY', 'bcffa3335a9068ab37ad51a68b4b47ea72f32a49c8f0b4f299a629edad04cdc3');
feature_allocation_req.add_field('ISV_API_SECRET', '14c990f3d4ee6354ee86fffdb057b3584f885c0d79cd3b354123e1b9acdc2227');
## start the get request
feature_allocation_result = nil
Net::HTTP.start("localhost", 3000) {|http|
feature_allocation_result = http.request(feature_allocation_req)
}
## print the number of the response (I got 200 - OK)
puts feature_allocation_result.code
## deserialize JSON objects
feature_allocation_parameters = Yajl::Parser.parse(feature_allocation_result.body);
total_parameter = feature_allocation_parameters["total"];
used_parameter = feature_allocation_parameters["used"];
available_parameter = feature_allocation_parameters["available"];
## print them
puts "***********************"
puts total_parameter, used_parameter, available_parameter
しかし、それは何も印刷しません。私は何か間違ったことを書きましたか?(問題があるとすれば、「JSON オブジェクトをデシリアライズする」の段階で問題が見つかると思いますが、試してみましたがJSON.parse
、これも機能しません)。
助けていただければ幸いです。