Class: Wizypay::Merchant
- Defined in:
- lib/wizypay/merchant.rb
Class Method Summary collapse
Instance Method Summary collapse
- #ads ⇒ Object
- #categories ⇒ Object
- #network_updated_at ⇒ Object
- #primary_ad ⇒ Object
- #primary_ad_id ⇒ Object
- #versions ⇒ Object
Methods inherited from Resource
Class Method Details
.all(q = {}) ⇒ Object
8 9 10 |
# File 'lib/wizypay/merchant.rb', line 8 def self.all(q = {}) where(q) end |
.where(q) ⇒ Object
3 4 5 6 |
# File 'lib/wizypay/merchant.rb', line 3 def self.where(q) raw = ApiClient.get('/merchants', q) Collection.new(self, raw[:data], raw[:meta]) end |
Instance Method Details
#ads ⇒ Object
24 25 26 |
# File 'lib/wizypay/merchant.rb', line 24 def ads Collection.new(Ad, super['data'], super['meta']) end |
#categories ⇒ Object
28 29 30 |
# File 'lib/wizypay/merchant.rb', line 28 def categories Collection.new(MerchantCategory, super['data'], super['meta']) end |
#network_updated_at ⇒ Object
32 33 34 35 |
# File 'lib/wizypay/merchant.rb', line 32 def network_updated_at return nil unless super.present? Time.parse(super) end |
#primary_ad ⇒ Object
16 17 18 |
# File 'lib/wizypay/merchant.rb', line 16 def primary_ad Resource.new(super['data']) end |
#primary_ad_id ⇒ Object
20 21 22 |
# File 'lib/wizypay/merchant.rb', line 20 def primary_ad_id super || primary_ad.id || ads.first.try(:id) end |
#versions ⇒ Object
12 13 14 |
# File 'lib/wizypay/merchant.rb', line 12 def versions MerchantVersion.for(self) end |