Sha256: cbbeae71fda43ebf477d761c65e098eb6253ac22719ae28ca8c7b50344dd295c

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

require_relative 'base'
require 'json'


class Customer < Base

  def create_customer(data)
    base_url = petra_object.base_url
    required_parameters = ["email"]
    check_passed_parameters(required_parameters, data)
    response = post_request("#{base_url}/customer", data)
    return response
  end

  def get_customers(page =1, per_page=50)
    base_url = petra_object.base_url
    response = get_request("#{base_url}/customer?perPage=#{per_page}&page=#{page}")
    return response
  end

  def get_customer(reference)
    base_url = petra_object.base_url
    response = get_request("#{base_url}/customer/#{reference}")
    return  response
  end

  def update_customer(reference, payload)
    base_url = petra_object.base_url
    required_parameters = ['first_name','last_name']
    check_passed_parameters(required_parameters, payload)
    response = put_request("#{base_url}/customer/#{reference}", payload)
    return  response
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
petra_sdk-0.1.4 lib/petra_sdk/modules/customer.rb