Class: Acme::Client::Resources::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/acme/client/resources/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, **arguments) ⇒ Account

Returns a new instance of Account.



6
7
8
9
# File 'lib/acme/client/resources/account.rb', line 6

def initialize(client, **arguments)
  @client = client
  assign_attributes(**arguments)
end

Instance Attribute Details

#contactObject (readonly)

Returns the value of attribute contact.



4
5
6
# File 'lib/acme/client/resources/account.rb', line 4

def contact
  @contact
end

#orders_urlObject (readonly)

Returns the value of attribute orders_url.



4
5
6
# File 'lib/acme/client/resources/account.rb', line 4

def orders_url
  @orders_url
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/acme/client/resources/account.rb', line 4

def status
  @status
end

#term_of_serviceObject (readonly)

Returns the value of attribute term_of_service.



4
5
6
# File 'lib/acme/client/resources/account.rb', line 4

def term_of_service
  @term_of_service
end

#urlObject (readonly)

Returns the value of attribute url.



4
5
6
# File 'lib/acme/client/resources/account.rb', line 4

def url
  @url
end

Instance Method Details

#deactivateObject



22
23
24
25
# File 'lib/acme/client/resources/account.rb', line 22

def deactivate
  assign_attributes(**@client..to_h)
  true
end

#kidObject



11
12
13
# File 'lib/acme/client/resources/account.rb', line 11

def kid
  url
end

#reloadObject



27
28
29
30
# File 'lib/acme/client/resources/account.rb', line 27

def reload
  assign_attributes(**@client..to_h)
  true
end

#to_hObject



32
33
34
35
36
37
38
39
# File 'lib/acme/client/resources/account.rb', line 32

def to_h
  {
    url: url,
    term_of_service: term_of_service,
    status: status,
    contact: contact
  }
end

#update(contact: nil, terms_of_service_agreed: nil) ⇒ Object



15
16
17
18
19
20
# File 'lib/acme/client/resources/account.rb', line 15

def update(contact: nil, terms_of_service_agreed: nil)
  assign_attributes(**@client.(
    contact: contact, terms_of_service_agreed: term_of_service
  ).to_h)
  true
end