Sha256: 2fa02aca2f7926bf8942365d37697ccee3c3f82c0a83f204acba29c873c39016

Contents?: true

Size: 804 Bytes

Versions: 9

Compression:

Stored size: 804 Bytes

Contents

# frozen_string_literal: true
module ShopifyAPI
  class Customer < Base
    include Metafields

    def orders
      Order.find(:all, params: { customer_id: self.id })
    end

    def self.search(params)
      find(:all, from: :search, params: params)
    end

    def account_activation_url
      resource = post(:account_activation_url, {}, only_id)
      data = ActiveSupport::JSON.decode(resource.body.to_s)
      result = nil

      if data.key?('account_activation_url')
        result = data['account_activation_url']
      end
      result
    end

    def send_invite(customer_invite = ShopifyAPI::CustomerInvite.new)
      resource = post(:send_invite, {}, customer_invite.encode)
      ShopifyAPI::CustomerInvite.new(ShopifyAPI::CustomerInvite.format.decode(resource.body))
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
shopify_api-9.5.2 lib/shopify_api/resources/customer.rb
ruby_shopify_api-1.2.0 lib/ruby_shopify_api/resources/customer.rb
ruby_shopify_api-1.1.0 lib/shopify_api/resources/customer.rb
ruby_shopify_api-1.0.0 lib/shopify_api/resources/customer.rb
shopify_api-9.5.1 lib/shopify_api/resources/customer.rb
shopify_api-9.5 lib/shopify_api/resources/customer.rb
shopify_api-9.4.1 lib/shopify_api/resources/customer.rb
shopify_api-9.4.0 lib/shopify_api/resources/customer.rb
shopify_api-9.3.0 lib/shopify_api/resources/customer.rb