public function create(array $subscriber)
    {
        $defaults = ['language' => 'sv', 'update_on_duplicate' => true, 'tags' => [], 'automation' => false];

        $subscriber = array_merge($defaults, $subscriber);

        $this->assertValidSubscriberParams($subscriber);

        $params = [
            'automation' => $subscriber['automation'],
            'update_on_duplicate' => $subscriber['update_on_duplicate'],
            'tags' => $subscriber['tags'],
            'subscribers' => $this->getSubscriberParams($subscriber)
        ];

        $request = new Request('subscribers');
        $request->setParams($params);

        $response = $this->client->post($request);

        $this->assertSuccessResponse($response);

        return $response->getData();
    }
public function create(array $subscriber)
    {
        $defaults = ['language' => 'sv', 'update_on_duplicate' => true, 'tags' => [], 'automation' => false];

        $subscriber = array_merge($defaults, $subscriber);

        $this->assertValidSubscriberParams($subscriber);

        $params = [
            'automation' => $subscriber['automation'],
            'update_on_duplicate' => $subscriber['update_on_duplicate'],
            'tags' => $subscriber['tags'],
            'subscribers' => $this->getSubscriberParams($subscriber)
        ];

        $request = new Request('subscribers');
        $request->setParams($params);

        $response = $this->client->post($request);

        $this->assertSuccessResponse($response);

        return $response->getData();
    }
public function create ( array $ subscriber ) { $ defaults = [ 'language' => 'sv' , 'update_on_duplicate' => true , 'tags' => [ ] , 'automation' => false ] ; $ subscriber = array_merge ( $ defaults , $ subscriber ) ; $ this -> assertValidSubscriberParams ( $ subscriber ) ; $ params = [ 'automation' => $ subscriber [ 'automation' ] , 'update_on_duplicate' => $ subscriber [ 'update_on_duplicate' ] , 'tags' => $ subscriber [ 'tags' ] , 'subscribers' => $ this -> getSubscriberParams ( $ subscriber ) ] ; $ request = new Request ( 'subscribers' ) ; $ request -> setParams ( $ params ) ; $ response = $ this -> client -> post ( $ request ) ; $ this -> assertSuccessResponse ( $ response ) ; return $ response -> getData ( ) ; }
Creates new subscriber

@link https://rule.se/apidoc/#subscribers-create-new-subscriber-post

@param array $subscriber
@return array
@throws \Exception
Creates new subscriber