controller pageJson output from api
rubyを使用しているユーザーのtumblrアカウントから投稿を表示しようとしています。私は前にapiで何もしたことがない。私はハッシュテーブルを使用しようとしています。私は私がすることはできません多くの異なるフォーマットを試してきたRuby HashとTumblr API
{"blog"=>{"title"=>"Untitled", "name"=>"zombieprocess1", "total_posts"=>1, "posts"=>1, "url"=>"URL", "updated"=>1478191052, "description"=>"", "is_nsfw"=>false, "ask"=>false, "ask_page_title"=>"Ask me anything", "ask_anon"=>false, "followed"=>false, "can_send_fan_mail"=>true, "is_blocked_from_primary"=>false, "share_likes"=>true, "likes"=>1, "twitter_enabled"=>false, "twitter_send"=>false, "facebook_opengraph_enabled"=>"N", "tweet"=>"N", "facebook"=>"N", "followers"=>0, "primary"=>true, "admin"=>true, "messages"=>0, "queue"=>0, "drafts"=>0, "type"=>"public", "reply_conditions"=>3, "subscribed"=>false, "can_subscribe"=>false}, "posts"=>[{"blog_name"=>"zombieprocess1", "id"=>152689921093, "post_url"=>"URL", "slug"=>"", "type"=>"photo", "date"=>"2016-11-03 16:37:32 GMT", "timestamp"=>1478191052, "state"=>"published", "format"=>"html", "reblog_key"=>"NCDqGTzW", "tags"=>[], "short_url"=>"URL", "summary"=>"", "recommended_source"=>nil, "recommended_color"=>nil, "followed"=>false, "liked"=>true, "note_count"=>1, "caption"=>"", "reblog"=>{"tree_html"=>"", "comment"=>""}, "trail"=>[], "image_permalink"=>"url", "photos"=>[{"caption"=>"", "alt_sizes"=>[{"url"=>"URL", "width"=>400, "height"=>544}, {"url"=>"URL", "width"=>250, "height"=>340}, {"url"=>"URL", "width"=>100, "height"=>136}, {"url"=>"URL", "width"=>75, "height"=>75}], "original_size"=>{"url"=>"URL", "width"=>400, "height"=>544}}], "can_like"=>false, "can_reblog"=>true, "can_send_in_message"=>true, "can_reply"=>true, "display_avatar"=>true}], "total_posts"=>1}
応答は、このようなある
<%=Posts%>
を持って私の見解ページ使用してHTMLの
@Posts = client.posts"zombieprocess1.tumblr.com"
:のような私のコントローラのコードです投稿URLを取得したようです。私の考えはpost_urlを取得して、それぞれを埋め込んで、私のウェブページ上のtumblrと同じように表示することです。誰でも助けてくれますか?
私は両方を試しました。最初のものはエラーは返されませんが、私のページには何も掲載されません。私は '<%=blah%>を使用しています.2番目のものは'範囲の値が不正です 'というエラーを返しました。 – bmmccleb
コンソールで変数にハッシュを割り当て、 ?私があなたに与えたコードはpost_urlを返します。ビューまたはコントローラに別の問題がある可能性があります。 – moveson
私が間違っていることは本当にわかりません。私はGoogleに知っているすべてのものをgoogledしました。私はルビーでも非常に新しいです。私はコーディングの第2ビットを使用し、変数を修正しました。私はそれを私のコントローラーの@post_urlと等しく設定し、私のビューページにURLを印刷して、何も表示しませんでした。 – bmmccleb