Class: BloomRemit2::Sender
- Inherits:
-
Object
- Object
- BloomRemit2::Sender
- Defined in:
- lib/bloom_remit2/sender.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#birthdate ⇒ Object
readonly
Returns the value of attribute birthdate.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#deleted ⇒ Object
readonly
Returns the value of attribute deleted.
-
#deleted_at ⇒ Object
readonly
Returns the value of attribute deleted_at.
-
#dragonpay_userid ⇒ Object
readonly
Returns the value of attribute dragonpay_userid.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#id_photo_name ⇒ Object
readonly
Returns the value of attribute id_photo_name.
-
#id_photo_uid ⇒ Object
readonly
Returns the value of attribute id_photo_uid.
-
#identification_details ⇒ Object
readonly
Returns the value of attribute identification_details.
-
#identification_number ⇒ Object
readonly
Returns the value of attribute identification_number.
-
#identification_type ⇒ Object
readonly
Returns the value of attribute identification_type.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#mobile ⇒ Object
readonly
Returns the value of attribute mobile.
-
#passport_expiry_date ⇒ Object
readonly
Returns the value of attribute passport_expiry_date.
-
#passport_number ⇒ Object
readonly
Returns the value of attribute passport_number.
-
#photo_name ⇒ Object
readonly
Returns the value of attribute photo_name.
-
#photo_uid ⇒ Object
readonly
Returns the value of attribute photo_uid.
-
#sending_level ⇒ Object
readonly
Returns the value of attribute sending_level.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#tin ⇒ Object
readonly
Returns the value of attribute tin.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#zip_code ⇒ Object
readonly
Returns the value of attribute zip_code.
Class Method Summary collapse
-
.create(sender_hash) ⇒ Object
Create a new sender under this partner.
-
.delete(sender_id) ⇒ Object
Delete a sender belonging to this partner.
-
.find_by_email(email) ⇒ Object
Show a sender belonging to this partner by supplying their email address.
-
.list ⇒ Object
Show a list of senders belonging to this partner.
-
.retrieve(id) ⇒ Object
Show a sender belonging to this partner.
-
.update(sender_id, sender_hash) ⇒ Object
Update the attributes of a sender belonging to this partner TODO: Doesn’t support identification or proof of address.
Instance Method Summary collapse
Constructor Details
#initialize(id, email = nil, first_name = nil, last_name = nil, passport_number = nil, passport_expiry_date = nil, tin = nil, mobile = nil, address = nil, city = nil, state = nil, zip_code = nil, country = nil, birthdate = nil, photo_uid = nil, photo_name = nil, id_photo_uid = nil, id_photo_name = nil, identification_type = nil, identification_number = nil, identification_details = nil, deleted_at = nil, dragonpay_userid = nil, sending_level = nil, occupation = nil, created_at = nil, updated_at = nil, deleted: false) ⇒ Sender
Returns a new instance of Sender.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/bloom_remit2/sender.rb', line 108 def initialize( id, email=nil, first_name=nil, last_name=nil, passport_number=nil, passport_expiry_date=nil, tin=nil, mobile=nil, address=nil, city=nil, state=nil, zip_code=nil, country=nil, birthdate=nil, photo_uid=nil, photo_name=nil, id_photo_uid=nil, id_photo_name=nil, identification_type=nil, identification_number=nil, identification_details=nil, deleted_at=nil, dragonpay_userid=nil, sending_level=nil, occupation=nil, created_at=nil, updated_at=nil, deleted: false ) @id = id @email = email @first_name = first_name @last_name = last_name @passport_number = passport_number @passport_expiry_date = passport_expiry_date @tin = tin @mobile = mobile @address = address @city = city @state = state @zip_code = zip_code @country = country @birthdate = birthdate @photo_uid = photo_uid @photo_name = photo_name @id_photo_uid = id_photo_uid @id_photo_name = id_photo_name @identification_type = identification_type @identification_number = identification_number @identification_details = identification_details @deleted_at = deleted_at @dragonpay_userid = dragonpay_userid @sending_level = sending_level @occupation = occupation @created_at = created_at @updated_at = updated_at @deleted = deleted end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def address @address end |
#birthdate ⇒ Object (readonly)
Returns the value of attribute birthdate.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def birthdate @birthdate end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def city @city end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def country @country end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def created_at @created_at end |
#deleted ⇒ Object (readonly)
Returns the value of attribute deleted.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def deleted @deleted end |
#deleted_at ⇒ Object (readonly)
Returns the value of attribute deleted_at.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def deleted_at @deleted_at end |
#dragonpay_userid ⇒ Object (readonly)
Returns the value of attribute dragonpay_userid.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def dragonpay_userid @dragonpay_userid end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def email @email end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def first_name @first_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def id @id end |
#id_photo_name ⇒ Object (readonly)
Returns the value of attribute id_photo_name.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def id_photo_name @id_photo_name end |
#id_photo_uid ⇒ Object (readonly)
Returns the value of attribute id_photo_uid.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def id_photo_uid @id_photo_uid end |
#identification_details ⇒ Object (readonly)
Returns the value of attribute identification_details.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def identification_details @identification_details end |
#identification_number ⇒ Object (readonly)
Returns the value of attribute identification_number.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def identification_number @identification_number end |
#identification_type ⇒ Object (readonly)
Returns the value of attribute identification_type.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def identification_type @identification_type end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def last_name @last_name end |
#mobile ⇒ Object (readonly)
Returns the value of attribute mobile.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def mobile @mobile end |
#passport_expiry_date ⇒ Object (readonly)
Returns the value of attribute passport_expiry_date.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def passport_expiry_date @passport_expiry_date end |
#passport_number ⇒ Object (readonly)
Returns the value of attribute passport_number.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def passport_number @passport_number end |
#photo_name ⇒ Object (readonly)
Returns the value of attribute photo_name.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def photo_name @photo_name end |
#photo_uid ⇒ Object (readonly)
Returns the value of attribute photo_uid.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def photo_uid @photo_uid end |
#sending_level ⇒ Object (readonly)
Returns the value of attribute sending_level.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def sending_level @sending_level end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def state @state end |
#tin ⇒ Object (readonly)
Returns the value of attribute tin.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def tin @tin end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def updated_at @updated_at end |
#zip_code ⇒ Object (readonly)
Returns the value of attribute zip_code.
106 107 108 |
# File 'lib/bloom_remit2/sender.rb', line 106 def zip_code @zip_code end |
Class Method Details
.create(sender_hash) ⇒ Object
Create a new sender under this partner
36 37 38 39 |
# File 'lib/bloom_remit2/sender.rb', line 36 def create(sender_hash) sender = Client.post(path, sender_hash) initialize_from_hash(sender['sender']) end |
.delete(sender_id) ⇒ Object
Delete a sender belonging to this partner
56 57 58 59 60 61 62 63 64 |
# File 'lib/bloom_remit2/sender.rb', line 56 def delete(sender_id) = Client.delete("#{path}/#{sender_id}").with_indifferent_access if [:success] == "We've successfully deleted that user." new( sender_id, deleted: true ) end end |
.find_by_email(email) ⇒ Object
Show a sender belonging to this partner by supplying their email address
21 22 23 24 |
# File 'lib/bloom_remit2/sender.rb', line 21 def find_by_email(email) sender = Client.get("#{path}/find_by_email", query: { email: email }) initialize_from_hash(sender['user']) end |
.list ⇒ Object
Show a list of senders belonging to this partner
6 7 8 9 |
# File 'lib/bloom_remit2/sender.rb', line 6 def list senders = Client.get(path) senders.map { |sender| initialize_from_hash(sender) } end |
.retrieve(id) ⇒ Object
Show a sender belonging to this partner
13 14 15 16 |
# File 'lib/bloom_remit2/sender.rb', line 13 def retrieve(id) sender = Client.get("#{path}/#{id}") initialize_from_hash(sender['user']) end |
.update(sender_id, sender_hash) ⇒ Object
Update the attributes of a sender belonging to this partner TODO: Doesn’t support identification or proof of address
45 46 47 48 49 50 51 52 |
# File 'lib/bloom_remit2/sender.rb', line 45 def update(sender_id, sender_hash) body = [] sender_hash.each do |k, v| body << ["user[#{k.to_s.downcase}]", v] end sender = Client.put("#{path}/#{sender_id}", body) initialize_from_hash(sender['user']) end |