Class: XLiveServices::MarketplacePublic

Inherits:
Object
  • Object
show all
Extended by:
Savon::Model
Defined in:
lib/xlive_services/marketplace_public.rb

Defined Under Namespace

Modules: SortField

Constant Summary collapse

ConfigurationName =
'IMarketplacePublic'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint, wgxService) ⇒ MarketplacePublic

Returns a new instance of MarketplacePublic.



24
25
26
27
# File 'lib/xlive_services/marketplace_public.rb', line 24

def initialize(endpoint, wgxService)
    @WgxService = wgxService
    client.globals[:endpoint] = endpoint
end

Class Method Details

.BuildOfferGUID(offerID, titleID = nil) ⇒ Object



29
30
31
32
33
# File 'lib/xlive_services/marketplace_public.rb', line 29

def self.BuildOfferGUID(offerID, titleID=nil)
    titleID = offerID >> 32 if titleID.nil?
    offerID &= 0xffffffff
    "%08x-0000-4000-8000-0000%08x" % [offerID, titleID]
end

Instance Method Details

#BuildOfferGUID(offerID, titleID = nil) ⇒ Object



35
36
37
# File 'lib/xlive_services/marketplace_public.rb', line 35

def BuildOfferGUID(offerID, titleID=nil)
    self.class.BuildOfferGUID(offerID, titleID)
end

#GetActivationKey(offerGUID) ⇒ Object



68
69
70
71
# File 'lib/xlive_services/marketplace_public.rb', line 68

def GetActivationKey(offerGUID)
    client.globals[:soap_header] = GetHeader(__callee__)
    client.call __callee__, message: { offerId: offerGUID }
end

#GetHeader(name) ⇒ Object



39
40
41
# File 'lib/xlive_services/marketplace_public.rb', line 39

def GetHeader(name)
    Utils::BuildHeader(client.globals[:endpoint], Utils::BuildAction(client.globals[:namespace], ConfigurationName, name.to_s), @WgxService.Token)
end

#GetLicensePublic(offerGUID) ⇒ Object



58
59
60
61
# File 'lib/xlive_services/marketplace_public.rb', line 58

def GetLicensePublic(offerGUID)
    client.globals[:soap_header] = GetHeader(__callee__)
    client.call __callee__, message: { offerId: offerGUID }
end

#GetMediaUrls(urls, offerGUID) ⇒ Object



73
74
75
76
# File 'lib/xlive_services/marketplace_public.rb', line 73

def GetMediaUrls(urls, offerGUID)
    client.globals[:soap_header] = GetHeader(__callee__)
    client.call __callee__, message: { urls: Utils::Serialization::Serialize('string[]', urls), offerID: offerGUID }
end

#GetOfferDetailsPublic(locale, offerGUID) ⇒ Object



53
54
55
56
# File 'lib/xlive_services/marketplace_public.rb', line 53

def GetOfferDetailsPublic(locale, offerGUID)
    client.globals[:soap_header] = GetHeader(__callee__)
    client.call __callee__, message: { locale: locale, offerId: offerGUID }
end

#GetPurchaseHistory(locale, pageNum = 1, orderBy = SortField::Title) ⇒ Object



43
44
45
46
# File 'lib/xlive_services/marketplace_public.rb', line 43

def GetPurchaseHistory(locale, pageNum = 1, orderBy = SortField::Title)
    client.globals[:soap_header] = GetHeader(__callee__)
    client.call __callee__, message: { locale: locale, pageNum: pageNum, orderBy: Utils::Serialization::Serialize('enum', orderBy) }
end

#GetSponsorToken(titleId) ⇒ Object



63
64
65
66
# File 'lib/xlive_services/marketplace_public.rb', line 63

def GetSponsorToken(titleId)
    client.globals[:soap_header] = GetHeader(__callee__)
    client.call __callee__, message: { titleId: titleId }
end

#ReadUserSettings(titleID, settings) ⇒ Object



48
49
50
51
# File 'lib/xlive_services/marketplace_public.rb', line 48

def ReadUserSettings(titleID, settings)
    client.globals[:soap_header] = GetHeader(__callee__)
    client.call __callee__, message: { titleID: titleID, settings: Utils::Serialization::Serialize('uint[]', settings) }
end