Class: Mailfloss::Resources::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/mailfloss/resources.rb,
sig/resources.rbs

Overview

GET/PATCH /account

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#encode, #initialize

Constructor Details

This class inherits a constructor from Mailfloss::Resources::Base

Instance Method Details

#getTypes::account

GET /account — the authenticated account holder.

Returns:

  • (Types::account)


115
116
117
# File 'lib/mailfloss/resources.rb', line 115

def get
  client.request(:get, "/account")
end

#update(name: :__omit__, organization: :__omit__, phone: :__omit__, vat_id: :__omit__, country: :__omit__, address: :__omit__, notifications: :__omit__) ⇒ Hash

PATCH /account — update writable account & settings fields. Only the provided keys are sent.

Parameters:

  • name (String, nil) (defaults to: :__omit__)
  • organization (String, nil) (defaults to: :__omit__)
  • phone (String, nil) (defaults to: :__omit__)
  • vat_id (String, nil) (defaults to: :__omit__)
  • country (String, nil) (defaults to: :__omit__)
  • address (Hash, nil) (defaults to: :__omit__)

    partial { line1:, line2:, city:, state:, postal_code:, country: }

  • notifications (Hash, nil) (defaults to: :__omit__)

    partial { after_flossing:, weekly_report:, monthly_report:, payment_receipts: }

Returns:

  • (Hash)

    the full updated account (same shape as #get)



131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/mailfloss/resources.rb', line 131

def update(name: :__omit__, organization: :__omit__, phone: :__omit__, vat_id: :__omit__,
           country: :__omit__, address: :__omit__, notifications: :__omit__)
  body = {}
  body[:name] = name unless name == :__omit__
  body[:organization] = organization unless organization == :__omit__
  body[:phone] = phone unless phone == :__omit__
  body[:vat_id] = vat_id unless vat_id == :__omit__
  body[:country] = country unless country == :__omit__
  body[:address] = address unless address == :__omit__
  body[:notifications] = notifications unless notifications == :__omit__
  client.request(:patch, "/account", body: body)
end