Class: Synnex::Msp

Inherits:
Object
  • Object
show all
Defined in:
lib/synnex/synnex_msp.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#apiObject (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

#customersObject



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