Sha256: f6458f2adfdf895559798fa7900555f53d66a7b5cd620d86aa42d3eacd55df68

Contents?: true

Size: 772 Bytes

Versions: 33

Compression:

Stored size: 772 Bytes

Contents

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

33 entries across 33 versions & 1 rubygems

Version Path
shopify_api-9.2.0 lib/shopify_api/resources/customer.rb
shopify_api-9.1.0 lib/shopify_api/resources/customer.rb
shopify_api-9.0.4 lib/shopify_api/resources/customer.rb
shopify_api-9.0.3 lib/shopify_api/resources/customer.rb
shopify_api-9.0.2 lib/shopify_api/resources/customer.rb
shopify_api-9.0.1 lib/shopify_api/resources/customer.rb
shopify_api-9.0.0 lib/shopify_api/resources/customer.rb
shopify_api-8.1.0 lib/shopify_api/resources/customer.rb
shopify_api-8.0.0 lib/shopify_api/resources/customer.rb
shopify_api-7.1.0 lib/shopify_api/resources/customer.rb
shopify_api-7.0.2 lib/shopify_api/resources/customer.rb
shopify_api-7.0.1 lib/shopify_api/resources/customer.rb
shopify_api-7.0.0 lib/shopify_api/resources/customer.rb
shopify_api-6.0.0 lib/shopify_api/resources/customer.rb
shopify_api-5.2.4 lib/shopify_api/resources/customer.rb
shopify_api-5.2.3 lib/shopify_api/resources/customer.rb
shopify_api-5.2.2 lib/shopify_api/resources/customer.rb
shopify_api-5.2.1 lib/shopify_api/resources/customer.rb
shopify_api-5.2.0 lib/shopify_api/resources/customer.rb
shopify_api-5.1.0 lib/shopify_api/resources/customer.rb