Class: Sellsy::Document
- Inherits:
-
Object
- Object
- Sellsy::Document
- Defined in:
- lib/sellsy/document.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#corp_name ⇒ Object
Returns the value of attribute corp_name.
-
#doctype ⇒ Object
Returns the value of attribute doctype.
-
#id ⇒ Object
Returns the value of attribute id.
-
#ident ⇒ Object
Returns the value of attribute ident.
-
#identity ⇒ Object
Returns the value of attribute identity.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#owner_full_name ⇒ Object
Returns the value of attribute owner_full_name.
-
#packaging_name ⇒ Object
Returns the value of attribute packaging_name.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#shipping_name ⇒ Object
Returns the value of attribute shipping_name.
-
#status ⇒ Object
Returns the value of attribute status.
-
#step ⇒ Object
Returns the value of attribute step.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#tax_rate ⇒ Object
Returns the value of attribute tax_rate.
-
#taxes_amount_sum ⇒ Object
Returns the value of attribute taxes_amount_sum.
-
#thirdid ⇒ Object
Returns the value of attribute thirdid.
-
#thirdname ⇒ Object
Returns the value of attribute thirdname.
-
#total_amount ⇒ Object
Returns the value of attribute total_amount.
-
#total_amount_taxes_free ⇒ Object
Returns the value of attribute total_amount_taxes_free.
-
#unit_amount ⇒ Object
Returns the value of attribute unit_amount.
Class Method Summary collapse
-
.create(document) ⇒ Object
contact”,“corpaddressid”:“36047”,“thirdaddressid”:“36048”,“shipaddressid”:“36049”,“rowsAmount”:“0.000000000”,“discountPercent”:“0.000000000”,“discountAmount”:“0.000000000”,“rowsAmountDiscounted”:“0.000000000”,“offerAmount”:“0.000000000”,“rowsAmountAllInc”:“0.000000000”,“packagingsAmount”:“49.900000000”,“shippingsAmount”:“60.000000000”,“totalAmountTaxesFree”:“109.900000000”,“taxesAmountSum”:“21.540400000”,“taxesAmountDetails”:“a:1:{s:12:"19.600000000";s:12:"21.540400000";”,“totalAmount”:“131.440400000”,“payDateText”:“”,“payDateCustom”:“0000-00-00”,“payMediumsText”:“a:1:i:0;s:7:"chu00e8que";”,“payCheckOrderText”:“”,“payBankAccountText”:“”,“shippingNbParcels”:“0”,“shippingWeight”:“0.000000000”,“shippingWeightUnit”:“g”,“shippingVolume”:“0.000000000”,“shippingTrackingNumber”:“”,“shippingTrackingUrl”:“”,“saveThirdPrefs”:“N”,“displayShipAddress”:“N”,“corpid”:“2”,“ownerid”:“2”,“linkedtype”:“invoice”,“linkedid”:“9512”,“created”:“2012-03-21 14:30:32”,“prefsid”:“14679”,“parentid”:“0”,“docmapid”:“11599”,“hasVat”:“Y”,“doctypeid”:“9512”,“step”:“draft”,“isDeposit”:“N”,“dueAmount”:“131.440400000”,“currencyid”:“1”,“currencyposition”:“right”,“numberformat”:“fr”,“numberdecimals”:“,”,“numberthousands”:“”,“numberprecision”:“2”,“formatted_dueAmount”:“131,44 u20ac”,“step_color”:“pink”,“step_hex”:“#C033DA”,“step_label”:“Non envoyu00e9e”,“step_css”:“colorDraft”,“step_banner”:“draft_f”,“step_id”:“draft”,“displayed_payMediumsText”:“chu00e8que”,“formatted_totalAmount”:“131,44 u20ac”,“formatted_totalAmountTaxesFree”:“109,90 u20ac”,“formatted_displayedDate”:“04/04/2012”,“formatted_payDateCustom”:“04/04/2012”,“noedit”:“N”}.
- .find(docid, doctype) ⇒ Object
- .get_for_copy(docid, doctype) ⇒ Object
-
.get_link(docid, doctype) ⇒ Object
contact”,“corpaddressid”:“36047”,“thirdaddressid”:“36048”,“shipaddressid”:“36049”,“rowsAmount”:“0.000000000”,“discountPercent”:“0.000000000”,“discountAmount”:“0.000000000”,“rowsAmountDiscounted”:“0.000000000”,“offerAmount”:“0.000000000”,“rowsAmountAllInc”:“0.000000000”,“packagingsAmount”:“49.900000000”,“shippingsAmount”:“60.000000000”,“totalAmountTaxesFree”:“109.900000000”,“taxesAmountSum”:“21.540400000”,“taxesAmountDetails”:“a:1:{s:12:"19.600000000";s:12:"21.540400000";”,“totalAmount”:“131.440400000”,“payDateText”:“”,“payDateCustom”:“0000-00-00”,“payMediumsText”:“a:1:i:0;s:7:"chu00e8que";”,“payCheckOrderText”:“”,“payBankAccountText”:“”,“shippingNbParcels”:“0”,“shippingWeight”:“0.000000000”,“shippingWeightUnit”:“g”,“shippingVolume”:“0.000000000”,“shippingTrackingNumber”:“”,“shippingTrackingUrl”:“”,“saveThirdPrefs”:“N”,“displayShipAddress”:“N”,“corpid”:“2”,“ownerid”:“2”,“linkedtype”:“invoice”,“linkedid”:“9512”,“created”:“2012-03-21 14:30:32”,“prefsid”:“14679”,“parentid”:“0”,“docmapid”:“11599”,“hasVat”:“Y”,“doctypeid”:“9512”,“step”:“draft”,“isDeposit”:“N”,“dueAmount”:“131.440400000”,“currencyid”:“1”,“currencyposition”:“right”,“numberformat”:“fr”,“numberdecimals”:“,”,“numberthousands”:“”,“numberprecision”:“2”,“formatted_dueAmount”:“131,44 u20ac”,“step_color”:“pink”,“step_hex”:“#C033DA”,“step_label”:“Non envoyu00e9e”,“step_css”:“colorDraft”,“step_banner”:“draft_f”,“step_id”:“draft”,“displayed_payMediumsText”:“chu00e8que”,“formatted_totalAmount”:“131,44 u20ac”,“formatted_totalAmountTaxesFree”:“109,90 u20ac”,“formatted_displayedDate”:“04/04/2012”,“formatted_payDateCustom”:“04/04/2012”,“noedit”:“N”}.
- .linked_documents(docid, doctype) ⇒ Object
- .search(params) ⇒ Object
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
18 19 20 |
# File 'lib/sellsy/document.rb', line 18 def amount @amount end |
#client_id ⇒ Object
Returns the value of attribute client_id.
15 16 17 |
# File 'lib/sellsy/document.rb', line 15 def client_id @client_id end |
#corp_name ⇒ Object
Returns the value of attribute corp_name.
6 7 8 |
# File 'lib/sellsy/document.rb', line 6 def corp_name @corp_name end |
#doctype ⇒ Object
Returns the value of attribute doctype.
22 23 24 |
# File 'lib/sellsy/document.rb', line 22 def doctype @doctype end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sellsy/document.rb', line 5 def id @id end |
#ident ⇒ Object
Returns the value of attribute ident.
26 27 28 |
# File 'lib/sellsy/document.rb', line 26 def ident @ident end |
#identity ⇒ Object
Returns the value of attribute identity.
9 10 11 |
# File 'lib/sellsy/document.rb', line 9 def identity @identity end |
#notes ⇒ Object
Returns the value of attribute notes.
28 29 30 |
# File 'lib/sellsy/document.rb', line 28 def notes @notes end |
#owner_full_name ⇒ Object
Returns the value of attribute owner_full_name.
7 8 9 |
# File 'lib/sellsy/document.rb', line 7 def owner_full_name @owner_full_name end |
#packaging_name ⇒ Object
Returns the value of attribute packaging_name.
16 17 18 |
# File 'lib/sellsy/document.rb', line 16 def packaging_name @packaging_name end |
#rows ⇒ Object
Returns the value of attribute rows.
29 30 31 |
# File 'lib/sellsy/document.rb', line 29 def rows @rows end |
#shipping_name ⇒ Object
Returns the value of attribute shipping_name.
17 18 19 |
# File 'lib/sellsy/document.rb', line 17 def shipping_name @shipping_name end |
#status ⇒ Object
Returns the value of attribute status.
8 9 10 |
# File 'lib/sellsy/document.rb', line 8 def status @status end |
#step ⇒ Object
Returns the value of attribute step.
25 26 27 |
# File 'lib/sellsy/document.rb', line 25 def step @step end |
#subject ⇒ Object
Returns the value of attribute subject.
27 28 29 |
# File 'lib/sellsy/document.rb', line 27 def subject @subject end |
#tax_rate ⇒ Object
Returns the value of attribute tax_rate.
20 21 22 |
# File 'lib/sellsy/document.rb', line 20 def tax_rate @tax_rate end |
#taxes_amount_sum ⇒ Object
Returns the value of attribute taxes_amount_sum.
12 13 14 |
# File 'lib/sellsy/document.rb', line 12 def taxes_amount_sum @taxes_amount_sum end |
#thirdid ⇒ Object
Returns the value of attribute thirdid.
23 24 25 |
# File 'lib/sellsy/document.rb', line 23 def thirdid @thirdid end |
#thirdname ⇒ Object
Returns the value of attribute thirdname.
24 25 26 |
# File 'lib/sellsy/document.rb', line 24 def thirdname @thirdname end |
#total_amount ⇒ Object
Returns the value of attribute total_amount.
13 14 15 |
# File 'lib/sellsy/document.rb', line 13 def total_amount @total_amount end |
#total_amount_taxes_free ⇒ Object
Returns the value of attribute total_amount_taxes_free.
11 12 13 |
# File 'lib/sellsy/document.rb', line 11 def total_amount_taxes_free @total_amount_taxes_free end |
#unit_amount ⇒ Object
Returns the value of attribute unit_amount.
19 20 21 |
# File 'lib/sellsy/document.rb', line 19 def unit_amount @unit_amount end |
Class Method Details
.create(document) ⇒ Object
contact”,“corpaddressid”:“36047”,“thirdaddressid”:“36048”,“shipaddressid”:“36049”,“rowsAmount”:“0.000000000”,“discountPercent”:“0.000000000”,“discountAmount”:“0.000000000”,“rowsAmountDiscounted”:“0.000000000”,“offerAmount”:“0.000000000”,“rowsAmountAllInc”:“0.000000000”,“packagingsAmount”:“49.900000000”,“shippingsAmount”:“60.000000000”,“totalAmountTaxesFree”:“109.900000000”,“taxesAmountSum”:“21.540400000”,“taxesAmountDetails”:“a:1:{s:12:"19.600000000";s:12:"21.540400000";”,“totalAmount”:“131.440400000”,“payDateText”:“”,“payDateCustom”:“0000-00-00”,“payMediumsText”:“a:1:i:0;s:7:"chu00e8que";”,“payCheckOrderText”:“”,“payBankAccountText”:“”,“shippingNbParcels”:“0”,“shippingWeight”:“0.000000000”,“shippingWeightUnit”:“g”,“shippingVolume”:“0.000000000”,“shippingTrackingNumber”:“”,“shippingTrackingUrl”:“”,“saveThirdPrefs”:“N”,“displayShipAddress”:“N”,“corpid”:“2”,“ownerid”:“2”,“linkedtype”:“invoice”,“linkedid”:“9512”,“created”:“2012-03-21 14:30:32”,“prefsid”:“14679”,“parentid”:“0”,“docmapid”:“11599”,“hasVat”:“Y”,“doctypeid”:“9512”,“step”:“draft”,“isDeposit”:“N”,“dueAmount”:“131.440400000”,“currencyid”:“1”,“currencyposition”:“right”,“numberformat”:“fr”,“numberdecimals”:“,”,“numberthousands”:“”,“numberprecision”:“2”,“formatted_dueAmount”:“131,44 u20ac”,“step_color”:“pink”,“step_hex”:“#C033DA”,“step_label”:“Non envoyu00e9e”,“step_css”:“colorDraft”,“step_banner”:“draft_f”,“step_id”:“draft”,“displayed_payMediumsText”:“chu00e8que”,“formatted_totalAmount”:“131,44 u20ac”,“formatted_totalAmountTaxesFree”:“109,90 u20ac”,“formatted_displayedDate”:“04/04/2012”,“formatted_payDateCustom”:“04/04/2012”,“noedit”:“N”}
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/sellsy/document.rb', line 83 def self.create(document) command = { 'method' => 'Document.create', 'params' => { 'document' => { 'doctype' => document.doctype, # 'parentId' => 'parentId', 'thirdid' => document.thirdid, 'ownerid' => document., # 'displayedDate' => 'displayedDate', 'subject' => document.subject, 'notes' => document.notes, # 'tags' => 'document_tags', # 'displayShipAddress' => 'displayshippaddress_enum', # 'rateCategory' => 'rateCategory', # 'globalDiscount' => 'globalDiscount', # 'globalDiscountUnit' => 'globalDiscountUnit', # 'hasDoubleVat' => 'hasDoubleVat', # 'currency' => 'currency', 'doclayout' => '52100', # 'payMediums' => 'payMediums', 'docspeakerStaffId' => document. #}, }, # 'paydate' => { # 'id' => 'paydate_id', # 'xdays' => 'paydate_xdays', # 'endmonth' => 'paydate_endmonth', # 'scaledDetails' => 'paydate_scaledDetails', # 'custom' => 'paydate_custom' # }, # 'thirdaddress' => { # 'id' => 'thirdaddress_id' # }, # 'shipaddress' => { # 'id' => 'shipaddress_id' # }, 'row' => document.rows #'row' => {} } } response = MultiJson.load(Sellsy::Api.request command) puts response.inspect @doc_id = response['response']['doc_id'] if response['response'] puts "doc_id = " + @doc_id.to_s @doc_id end |
.find(docid, doctype) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/sellsy/document.rb', line 65 def self.find(docid, doctype) command = { 'method' => 'Document.getOne', 'params' => { 'doctype' => doctype, 'docid' => docid } } response = MultiJson.load(Sellsy::Api.request command) if response['response'] estimate = response['response'] end estimate end |
.get_for_copy(docid, doctype) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/sellsy/document.rb', line 49 def self.get_for_copy(docid, doctype) command = { 'method' => 'Document.getForCopy', 'params' => { 'doctype' => doctype, 'docid' => docid } } response = MultiJson.load(Sellsy::Api.request command) if response['response'] estimate = response['response'] end estimate end |
.get_link(docid, doctype) ⇒ Object
contact”,“corpaddressid”:“36047”,“thirdaddressid”:“36048”,“shipaddressid”:“36049”,“rowsAmount”:“0.000000000”,“discountPercent”:“0.000000000”,“discountAmount”:“0.000000000”,“rowsAmountDiscounted”:“0.000000000”,“offerAmount”:“0.000000000”,“rowsAmountAllInc”:“0.000000000”,“packagingsAmount”:“49.900000000”,“shippingsAmount”:“60.000000000”,“totalAmountTaxesFree”:“109.900000000”,“taxesAmountSum”:“21.540400000”,“taxesAmountDetails”:“a:1:{s:12:"19.600000000";s:12:"21.540400000";”,“totalAmount”:“131.440400000”,“payDateText”:“”,“payDateCustom”:“0000-00-00”,“payMediumsText”:“a:1:i:0;s:7:"chu00e8que";”,“payCheckOrderText”:“”,“payBankAccountText”:“”,“shippingNbParcels”:“0”,“shippingWeight”:“0.000000000”,“shippingWeightUnit”:“g”,“shippingVolume”:“0.000000000”,“shippingTrackingNumber”:“”,“shippingTrackingUrl”:“”,“saveThirdPrefs”:“N”,“displayShipAddress”:“N”,“corpid”:“2”,“ownerid”:“2”,“linkedtype”:“invoice”,“linkedid”:“9512”,“created”:“2012-03-21 14:30:32”,“prefsid”:“14679”,“parentid”:“0”,“docmapid”:“11599”,“hasVat”:“Y”,“doctypeid”:“9512”,“step”:“draft”,“isDeposit”:“N”,“dueAmount”:“131.440400000”,“currencyid”:“1”,“currencyposition”:“right”,“numberformat”:“fr”,“numberdecimals”:“,”,“numberthousands”:“”,“numberprecision”:“2”,“formatted_dueAmount”:“131,44 u20ac”,“step_color”:“pink”,“step_hex”:“#C033DA”,“step_label”:“Non envoyu00e9e”,“step_css”:“colorDraft”,“step_banner”:“draft_f”,“step_id”:“draft”,“displayed_payMediumsText”:“chu00e8que”,“formatted_totalAmount”:“131,44 u20ac”,“formatted_totalAmountTaxesFree”:“109,90 u20ac”,“formatted_displayedDate”:“04/04/2012”,“formatted_payDateCustom”:“04/04/2012”,“noedit”:“N”}
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/sellsy/document.rb', line 32 def self.get_link(docid, doctype) command = { 'method' => 'Document.getPublicLink_v2', 'params' => { 'doctype' => doctype, 'docid' => docid } } response = MultiJson.load(Sellsy::Api.request command) if response['response'] value = response['response'] pdf = value['pdf'] end pdf end |
.linked_documents(docid, doctype) ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/sellsy/document.rb', line 157 def self.linked_documents(docid, doctype) command = { 'method' => 'Document.getLinkedDocuments', 'params' => { 'doctype' => doctype, 'docid' => docid } } response = MultiJson.load(Sellsy::Api.request command) puts "response" puts response['response']['directChildren'].inspect documents = [] if response['response'] response['response']['directChildren'].each do |key, value| document = Document.new document.id = value['id'].to_i document.ident = value['ident'] document.step = value['step'] document.subject = value['subject'] documents << document end end documents end |
.search(params) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/sellsy/document.rb', line 132 def self.search(params) command = { 'method' => 'Document.getList', 'params' => params } puts params response = MultiJson.load(Sellsy::Api.request command) puts response.inspect documents = [] if response['response'] response['response']['result'].each do |key, value| document = Document.new document.id = key document.ident = value['ident'] document.step = value['step'] document.subject = value['subject'] document.thirdname = value['thirdname'] documents << document end end documents end |