Class: HashBlue::Account
Overview
This class models the Account entity, providing an easy way to CRUD operations using ActiveRecord as design model
Examples of use:
# Initialize client with a valid access token HashBlue::Client.user = <valid_access_token>
# Retrieve all messages messages = HashBlue::Message.find(:all)
# Retrieve a specific message message = HashBlue::Message.find(<valid_message_id>)
# Retrieve a contact messages messages = HashBlue::Message.find(=> <valid_contact_id>)
# Retrieve favourite messages messages = HashBlue::Message.favourites
# Mark a message as favourite message = HashBlue::Message.find(<valid_message_id>) message.favourite!
# Unmark a message as favourite message = HashBlue::Message.find(<valid_message_id>) message.unfavourite!
# Create a message HashBlue::Message.create!(<phone_number>, <content>)
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#msisdn ⇒ Object
Returns the value of attribute msisdn.
-
#phone_number ⇒ Object
Returns the value of attribute phone_number.
Class Method Summary collapse
-
.find ⇒ Object
Get user account.
Instance Method Summary collapse
Methods inherited from Client
client, delete, get, post, put
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email.
50 51 52 |
# File 'lib/hash_blue/account.rb', line 50 def email @email end |
#msisdn ⇒ Object
Returns the value of attribute msisdn.
48 49 50 |
# File 'lib/hash_blue/account.rb', line 48 def msisdn @msisdn end |
#phone_number ⇒ Object
Returns the value of attribute phone_number.
49 50 51 |
# File 'lib/hash_blue/account.rb', line 49 def phone_number @phone_number end |
Class Method Details
.find ⇒ Object
Get user account
60 61 62 |
# File 'lib/hash_blue/account.rb', line 60 def find parse_response(get "/account") end |
Instance Method Details
#to_s ⇒ Object
52 53 54 |
# File 'lib/hash_blue/account.rb', line 52 def to_s "#{self.class.name} => {:phone_number => #{phone_number}, :msisdn => #{msisdn}, :email => #{email}}" end |