Subversion Repositories SmartDukaan

Rev

Rev 13579 | Rev 14318 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13579 Rev 13583
Line 13... Line 13...
13
		$url = $apihost."store_products/index/$userId/page:$page";
13
		$url = $apihost."store_products/index/$userId/page:$page";
14
		// $params = array('client_id'=>$this->instagramconfig['client_id'],'client_secret'=>$this->instagramconfig['client_secret'],'grant_type'=>$this->instagramconfig['grant_type'],'redirect_uri'=>$this->instagramconfig['redirect_uri']);
14
		// $params = array('client_id'=>$this->instagramconfig['client_id'],'client_secret'=>$this->instagramconfig['client_secret'],'grant_type'=>$this->instagramconfig['grant_type'],'redirect_uri'=>$this->instagramconfig['redirect_uri']);
15
		return $this->make_request($url,null);
15
		return $this->make_request($url,null);
16
	}
16
	}
17
	
17
	
18
	public function getDealsByCategory($userId=null,$categoryId=3,$page=1) {
18
	public function getDealsByCategory($userId=null,$categoryId=null,$page=1) {
19
		$apihost = Configure::read('apihost');
19
		$apihost = Configure::read('apihost');
20
		$url = $apihost."store_products/category/$userId/$categoryId/page:$page";
20
		$url = $apihost."store_products/category/$userId/$categoryId/page:$page";
21
		// $params = array('client_id'=>$this->instagramconfig['client_id'],'client_secret'=>$this->instagramconfig['client_secret'],'grant_type'=>$this->instagramconfig['grant_type'],'redirect_uri'=>$this->instagramconfig['redirect_uri']);
21
		// $params = array('client_id'=>$this->instagramconfig['client_id'],'client_secret'=>$this->instagramconfig['client_secret'],'grant_type'=>$this->instagramconfig['grant_type'],'redirect_uri'=>$this->instagramconfig['redirect_uri']);
22
		return $this->make_request($url,null);
22
		return $this->make_request($url,null);
23
	}
23
	}
24
 
24
 
25
	public function getCategoryDeals($userId=2,$page=1) {
25
	public function getCategoryDeals($userId=null,$page=1) {
26
		$apihost = Configure::read('apihost');
26
		$apihost = Configure::read('apihost');
27
		$url = $apihost."store_products/bycategory/$userId/page:$page";
27
		$url = $apihost."store_products/bycategory/$userId/page:$page";
28
		// $params = array('client_id'=>$this->instagramconfig['client_id'],'client_secret'=>$this->instagramconfig['client_secret'],'grant_type'=>$this->instagramconfig['grant_type'],'redirect_uri'=>$this->instagramconfig['redirect_uri']);
28
		// $params = array('client_id'=>$this->instagramconfig['client_id'],'client_secret'=>$this->instagramconfig['client_secret'],'grant_type'=>$this->instagramconfig['grant_type'],'redirect_uri'=>$this->instagramconfig['redirect_uri']);
29
		return $this->make_request($url,null);
29
		return $this->make_request($url,null);
30
	}
30
	}
31
 
31
 
-
 
32
	public function getMyActions($userId=null) {
-
 
33
		$apihost = Configure::read('apihost');
-
 
34
		$url = $apihost."user_actions/by/$userId";
-
 
35
		// $params = array('client_id'=>$this->instagramconfig['client_id'],'client_secret'=>$this->instagramconfig['client_secret'],'grant_type'=>$this->instagramconfig['grant_type'],'redirect_uri'=>$this->instagramconfig['redirect_uri']);
-
 
36
		return $this->make_request($url,null);
-
 
37
	}
-
 
38
 
32
	public function make_request($url,$fields,$format='json'){
39
	public function make_request($url,$fields,$format='json'){
33
		$fields_string = '';
40
		$fields_string = '';
34
		if(!empty($fields)){
41
		if(!empty($fields)){
35
			foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
42
			foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
36
			rtrim($fields_string, '&');
43
			rtrim($fields_string, '&');