C# Class Connectster.Shopify.ShopifyCommunicator

Inheritance: IShopifyObject
Exibir arquivo Open project: shopster/NconnectSter Class Usage Examples

Public Methods

Method Description
CleanupXmlForDeserialization ( XmlDocument inDoc ) : XmlDocument

Remove tags w/ "nil=true" for "type=decimal" or "type=datetime". Do this because XMLSerializer crashes on these cases.

CleanupXmlForShopifySubmission ( XmlDocument inDoc ) : XmlDocument

Add " type="array" " to elements that require it. Remove xsi:nil="true" elements.

CreateCollection ( ShopifyStoreAuth storeAuth, ShopifyCollection collection ) : ShopifyResponse
CreateMetafield ( ShopifyStoreAuth storeAuth, ShopifyMetafield metaField, int productId ) : ShopifyResponse
CreateProduct ( ShopifyStoreAuth storeAuth, IShopifyProduct sP ) : ShopifyResponse
DateTimeToShopifyString ( System.DateTime time ) : string

encode a datetime as a string for filtering products, metafields etc. As per shopify's specification.

DeleteProduct ( ShopifyStoreAuth storeAuth, int productId ) : bool
GetAllMetafields ( ShopifyStoreAuth storeAuth, int limit, System.DateTime createdMin, System.DateTime createdMax, System.DateTime updatedMin, System.DateTime updatedMax, string fieldNamespace, string key, string valueType, int productId ) : List

GetAllProducts ( ShopifyStoreAuth storeAuth ) : List
GetCollection ( ShopifyStoreAuth storeAuth, int collectionId ) : ShopifyResponse
GetCollectionByName ( ShopifyStoreAuth storeAuth, string name ) : ShopifyResponse
GetListAllOrders ( ShopifyStoreAuth storeAuth ) : List
GetOrder ( ShopifyStoreAuth storeAuth, int orderId ) : ShopifyResponse
GetPageOfProducts ( ShopifyStoreAuth storeAuth, int numWanted, int pageNumber ) : List
GetProduct ( ShopifyStoreAuth storeAuth, int productId ) : ShopifyResponse
GetShopInformation ( ShopifyStoreAuth storeAuth ) : ShopifyResponse
Instance ( ) : ShopifyCommunicator
UpdateProduct ( ShopifyStoreAuth storeAuth, ShopifyProduct shopifyProduct ) : ShopifyResponse

Private Methods

Method Description
HashString ( string value ) : string

Hashes(MD5) the given value. Typically used as "HashString(shopsterSecret + storeAuthToken)"

IsValidXml ( string input ) : XmlDocument
ShopifyCommunicator ( ) : System
ShopifyDelete ( string path, string storePassword ) : XmlDocument
ShopifyGet ( string path, string storePassword ) : XmlDocument

loads and returns the XML document found at path , using the storePassword.

ShopifyPutPost ( string path, string storePassword, XmlDocument xDocPost, string method ) : XmlDocument

PUT/POSTs the given XMLDocument to the path w/ the storePassword.

Method Details

CleanupXmlForDeserialization() public static method

Remove tags w/ "nil=true" for "type=decimal" or "type=datetime". Do this because XMLSerializer crashes on these cases.
public static CleanupXmlForDeserialization ( XmlDocument inDoc ) : XmlDocument
inDoc System.Xml.XmlDocument The XmlDocument you want cleaned up for deserialization.
return System.Xml.XmlDocument

CleanupXmlForShopifySubmission() public static method

Add " type="array" " to elements that require it. Remove xsi:nil="true" elements.
public static CleanupXmlForShopifySubmission ( XmlDocument inDoc ) : XmlDocument
inDoc System.Xml.XmlDocument XmlDocument to be cleaned before submission to Shopify.
return System.Xml.XmlDocument

CreateCollection() public method

public CreateCollection ( ShopifyStoreAuth storeAuth, ShopifyCollection collection ) : ShopifyResponse
storeAuth ShopifyStoreAuth
collection ShopifyCollection
return ShopifyResponse

CreateMetafield() public method

public CreateMetafield ( ShopifyStoreAuth storeAuth, ShopifyMetafield metaField, int productId ) : ShopifyResponse
storeAuth ShopifyStoreAuth
metaField ShopifyMetafield
productId int
return ShopifyResponse

CreateProduct() public method

public CreateProduct ( ShopifyStoreAuth storeAuth, IShopifyProduct sP ) : ShopifyResponse
storeAuth ShopifyStoreAuth
sP IShopifyProduct
return ShopifyResponse

DateTimeToShopifyString() public method

encode a datetime as a string for filtering products, metafields etc. As per shopify's specification.
public DateTimeToShopifyString ( System.DateTime time ) : string
time System.DateTime
return string

DeleteProduct() public method

public DeleteProduct ( ShopifyStoreAuth storeAuth, int productId ) : bool
storeAuth ShopifyStoreAuth
productId int
return bool

GetAllMetafields() public method

public GetAllMetafields ( ShopifyStoreAuth storeAuth, int limit, System.DateTime createdMin, System.DateTime createdMax, System.DateTime updatedMin, System.DateTime updatedMax, string fieldNamespace, string key, string valueType, int productId ) : List
storeAuth ShopifyStoreAuth
limit int
createdMin System.DateTime
createdMax System.DateTime
updatedMin System.DateTime
updatedMax System.DateTime
fieldNamespace string
key string
valueType string
productId int If productId is >0 get all metafields for that product, if null get metafields tagged to the shop.
return List

GetAllProducts() public method

public GetAllProducts ( ShopifyStoreAuth storeAuth ) : List
storeAuth ShopifyStoreAuth
return List

GetCollection() public method

public GetCollection ( ShopifyStoreAuth storeAuth, int collectionId ) : ShopifyResponse
storeAuth ShopifyStoreAuth
collectionId int
return ShopifyResponse

GetCollectionByName() public method

public GetCollectionByName ( ShopifyStoreAuth storeAuth, string name ) : ShopifyResponse
storeAuth ShopifyStoreAuth
name string
return ShopifyResponse

GetListAllOrders() public method

public GetListAllOrders ( ShopifyStoreAuth storeAuth ) : List
storeAuth ShopifyStoreAuth
return List

GetOrder() public method

public GetOrder ( ShopifyStoreAuth storeAuth, int orderId ) : ShopifyResponse
storeAuth ShopifyStoreAuth
orderId int
return ShopifyResponse

GetPageOfProducts() public method

public GetPageOfProducts ( ShopifyStoreAuth storeAuth, int numWanted, int pageNumber ) : List
storeAuth ShopifyStoreAuth
numWanted int
pageNumber int
return List

GetProduct() public method

public GetProduct ( ShopifyStoreAuth storeAuth, int productId ) : ShopifyResponse
storeAuth ShopifyStoreAuth
productId int
return ShopifyResponse

GetShopInformation() public method

public GetShopInformation ( ShopifyStoreAuth storeAuth ) : ShopifyResponse
storeAuth ShopifyStoreAuth
return ShopifyResponse

Instance() public static method

public static Instance ( ) : ShopifyCommunicator
return ShopifyCommunicator

UpdateProduct() public method

public UpdateProduct ( ShopifyStoreAuth storeAuth, ShopifyProduct shopifyProduct ) : ShopifyResponse
storeAuth ShopifyStoreAuth
shopifyProduct ShopifyProduct
return ShopifyResponse