Class: Synnex::Msp
- Inherits:
-
Object
- Object
- Synnex::Msp
- Defined in:
- lib/synnex/synnex_msp.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
- #customers ⇒ Object
- #find_customer(snx_eu_no) ⇒ Object
- #find_subscription(id) ⇒ Object
-
#initialize(hash) ⇒ Msp
constructor
Pass the parameters to Synnex::Msp.new(user_name: ‘user’, password: ‘pass’, reseller: 12345) Pass the parameter ‘production’ for the production endpoint.
Constructor Details
#initialize(hash) ⇒ Msp
Pass the parameters to Synnex::Msp.new(user_name: ‘user’, password: ‘pass’, reseller: 12345) Pass the parameter ‘production’ for the production endpoint
6 7 8 |
# File 'lib/synnex/synnex_msp.rb', line 6 def initialize(hash) @api = Synnex::API.new(hash) end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
3 4 5 |
# File 'lib/synnex/synnex_msp.rb', line 3 def api @api end |
Instance Method Details
#customers ⇒ Object
10 11 12 |
# File 'lib/synnex/synnex_msp.rb', line 10 def customers @customers ||= api.customers.map {|json| Synnex::Customer.new(json, self)} end |
#find_customer(snx_eu_no) ⇒ Object
14 15 16 |
# File 'lib/synnex/synnex_msp.rb', line 14 def find_customer(snx_eu_no) customers.find {|c| c.snx_eu_no == snx_eu_no} end |
#find_subscription(id) ⇒ Object
18 19 20 |
# File 'lib/synnex/synnex_msp.rb', line 18 def find_subscription(id) Synnex::Subscription.new(api.subscription(id), @api) end |