Class: Celery::User

Inherits:
Base
  • Object
show all
Defined in:
lib/celery/user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Celery::Base

Instance Attribute Details

#_idObject

Returns the value of attribute _id.



5
6
7
# File 'lib/celery/user.rb', line 5

def _id
  @_id
end

#access_tokenObject

Returns the value of attribute access_token.



5
6
7
# File 'lib/celery/user.rb', line 5

def access_token
  @access_token
end

#affirmObject

Returns the value of attribute affirm.



5
6
7
# File 'lib/celery/user.rb', line 5

def affirm
  @affirm
end

#analyticsObject

Returns the value of attribute analytics.



5
6
7
# File 'lib/celery/user.rb', line 5

def analytics
  @analytics
end

#businessObject

Returns the value of attribute business.



5
6
7
# File 'lib/celery/user.rb', line 5

def business
  @business
end

#confirmation_scriptsObject

Returns the value of attribute confirmation_scripts.



5
6
7
# File 'lib/celery/user.rb', line 5

def confirmation_scripts
  @confirmation_scripts
end

#confirmation_urlObject

Returns the value of attribute confirmation_url.



5
6
7
# File 'lib/celery/user.rb', line 5

def confirmation_url
  @confirmation_url
end

#createdObject

Returns the value of attribute created.



5
6
7
# File 'lib/celery/user.rb', line 5

def created
  @created
end

#created_dateObject

Returns the value of attribute created_date.



5
6
7
# File 'lib/celery/user.rb', line 5

def created_date
  @created_date
end

#currencyObject

Returns the value of attribute currency.



5
6
7
# File 'lib/celery/user.rb', line 5

def currency
  @currency
end

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/celery/user.rb', line 5

def email
  @email
end

#emailsObject

Returns the value of attribute emails.



5
6
7
# File 'lib/celery/user.rb', line 5

def emails
  @emails
end

#facebookObject

Returns the value of attribute facebook.



5
6
7
# File 'lib/celery/user.rb', line 5

def facebook
  @facebook
end

#flagsObject

Returns the value of attribute flags.



5
6
7
# File 'lib/celery/user.rb', line 5

def flags
  @flags
end

#has_affirmObject

Returns the value of attribute has_affirm.



5
6
7
# File 'lib/celery/user.rb', line 5

def has_affirm
  @has_affirm
end

#has_paypalxObject

Returns the value of attribute has_paypalx.



5
6
7
# File 'lib/celery/user.rb', line 5

def has_paypalx
  @has_paypalx
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/celery/user.rb', line 5

def id
  @id
end

#message_to_buyerObject

Returns the value of attribute message_to_buyer.



5
6
7
# File 'lib/celery/user.rb', line 5

def message_to_buyer
  @message_to_buyer
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/celery/user.rb', line 5

def name
  @name
end

#nexusObject

Returns the value of attribute nexus.



5
6
7
# File 'lib/celery/user.rb', line 5

def nexus
  @nexus
end

#notificationsObject

Returns the value of attribute notifications.



5
6
7
# File 'lib/celery/user.rb', line 5

def notifications
  @notifications
end

#paypal_emailObject

Returns the value of attribute paypal_email.



5
6
7
# File 'lib/celery/user.rb', line 5

def paypal_email
  @paypal_email
end

#shipping_ratesObject

Returns the value of attribute shipping_rates.



5
6
7
# File 'lib/celery/user.rb', line 5

def shipping_rates
  @shipping_rates
end

#stripeObject

Returns the value of attribute stripe.



5
6
7
# File 'lib/celery/user.rb', line 5

def stripe
  @stripe
end

#subscriptionObject

Returns the value of attribute subscription.



5
6
7
# File 'lib/celery/user.rb', line 5

def subscription
  @subscription
end

#tax_ratesObject

Returns the value of attribute tax_rates.



5
6
7
# File 'lib/celery/user.rb', line 5

def tax_rates
  @tax_rates
end

#twitterObject

Returns the value of attribute twitter.



5
6
7
# File 'lib/celery/user.rb', line 5

def twitter
  @twitter
end

#updatedObject

Returns the value of attribute updated.



5
6
7
# File 'lib/celery/user.rb', line 5

def updated
  @updated
end

#updated_dateObject

Returns the value of attribute updated_date.



5
6
7
# File 'lib/celery/user.rb', line 5

def updated_date
  @updated_date
end

#webhooksObject

Returns the value of attribute webhooks.



5
6
7
# File 'lib/celery/user.rb', line 5

def webhooks
  @webhooks
end

#websiteObject

Returns the value of attribute website.



5
6
7
# File 'lib/celery/user.rb', line 5

def website
  @website
end

Class Method Details

.meObject



32
33
34
35
36
37
38
# File 'lib/celery/user.rb', line 32

def me
  query_string  = Celery.endpoint + "users/me?"
  query_string += Celery.parameterize_options
  response = HTTParty.get(query_string)

  self.new(response['data'])
end

Instance Method Details

#perform_request(attrs) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/celery/user.rb', line 19

def perform_request(attrs)
  HTTParty.put(
    Celery.endpoint + "users/me?" + Celery.parameterize_options,
    body: attrs.to_json,
    headers: { 'Content-Type' => 'application/json' }
  )
end

#update(attrs = {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/celery/user.rb', line 12

def update(attrs={})
  update_local_object(attrs)
  response = perform_request(attrs)

  return response['meta']['code'] == 200 ? true : false
end

#update_local_object(attrs) ⇒ Object



27
28
29
# File 'lib/celery/user.rb', line 27

def update_local_object(attrs)
  attrs.each { |key, value| self.send("#{key}=", value) }
end