public function getBlog() { $api_key = $this->config['consumer_key']; $path = 'blog/' . $this->options['base_hostname'] . '/info?api_key=' . $api_key; $result = $this->request($path); $json_result = json_decode($result, true); $mapping = ['id' => 'name', 'link' => 'url', 'title' => 'title', 'name' => 'name', 'description' => 'description', 'ask' => 'ask', 'ask_anon' => 'ask_anon', 'followers' => 'followers']; $blog = Blog::create($mapping, $json_result['response']['blog']); return $blog; }
public function getBlogs() { $path = 'user/info'; $result = $this->request($path); $profile_json = json_decode($result, true); $mapping = ['id' => 'name', 'link' => 'url', 'title' => 'title', 'name' => 'name', 'description' => 'description', 'ask' => 'ask', 'ask_anon' => 'ask_anon']; $blogs = []; foreach ($profile_json['response']['user']['blogs'] as $blog) { $blogs[$blog['name']] = Blog::create($mapping, $blog); } return $blogs; }