clicksend_client 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +78 -0
  4. data/Rakefile +8 -0
  5. data/clicksend_client-1.0.1.gem +0 -0
  6. data/clicksend_client.gemspec +45 -0
  7. data/docs/Account.md +15 -0
  8. data/docs/AccountApi.md +433 -0
  9. data/docs/AccountForgotPasswordVerify.md +10 -0
  10. data/docs/AccountRechargeApi.md +330 -0
  11. data/docs/AccountVerify.md +10 -0
  12. data/docs/Address.md +14 -0
  13. data/docs/Attachment.md +12 -0
  14. data/docs/Contact.md +23 -0
  15. data/docs/ContactApi.md +416 -0
  16. data/docs/ContactList.md +8 -0
  17. data/docs/ContactListApi.md +398 -0
  18. data/docs/ContactListImport.md +9 -0
  19. data/docs/CountriesApi.md +50 -0
  20. data/docs/CreditCard.md +13 -0
  21. data/docs/DateBefore.md +8 -0
  22. data/docs/DeliveryIssue.md +12 -0
  23. data/docs/DeliveryIssuesApi.md +119 -0
  24. data/docs/DeliveryReceiptRule.md +12 -0
  25. data/docs/DetectAddressApi.md +62 -0
  26. data/docs/Email.md +15 -0
  27. data/docs/EmailAddress.md +8 -0
  28. data/docs/EmailCampaign.md +15 -0
  29. data/docs/EmailDeliveryReceiptRulesApi.md +286 -0
  30. data/docs/EmailFrom.md +9 -0
  31. data/docs/EmailMarketingApi.md +793 -0
  32. data/docs/EmailRecipient.md +9 -0
  33. data/docs/EmailSMSAddress.md +10 -0
  34. data/docs/EmailTemplateNew.md +9 -0
  35. data/docs/EmailTemplateUpdate.md +9 -0
  36. data/docs/EmailToSmsApi.md +395 -0
  37. data/docs/FAXApi.md +401 -0
  38. data/docs/FAXDeliveryReceiptRulesApi.md +286 -0
  39. data/docs/FaxMessage.md +15 -0
  40. data/docs/FaxMessageCollection.md +9 -0
  41. data/docs/Fields.md +8 -0
  42. data/docs/FieldsFields.md +23 -0
  43. data/docs/ForgotPassword.md +8 -0
  44. data/docs/ForgotUsername.md +9 -0
  45. data/docs/InboundFAXRulesApi.md +286 -0
  46. data/docs/InboundFaxRule.md +12 -0
  47. data/docs/InboundSMSRule.md +14 -0
  48. data/docs/InboundSMSRulesApi.md +286 -0
  49. data/docs/MMSApi.md +228 -0
  50. data/docs/MasterEmailTemplatesApi.md +290 -0
  51. data/docs/MmsCampaign.md +14 -0
  52. data/docs/MmsCampaignApi.md +338 -0
  53. data/docs/MmsMessage.md +17 -0
  54. data/docs/MmsMessageCollection.md +9 -0
  55. data/docs/NumberApi.md +183 -0
  56. data/docs/PostLetter.md +14 -0
  57. data/docs/PostLetterApi.md +227 -0
  58. data/docs/PostPostcard.md +9 -0
  59. data/docs/PostPostcardApi.md +227 -0
  60. data/docs/PostRecipient.md +16 -0
  61. data/docs/PostReturnAddressApi.md +284 -0
  62. data/docs/ReferralAccountApi.md +65 -0
  63. data/docs/ResellerAccount.md +15 -0
  64. data/docs/ResellerAccountApi.md +230 -0
  65. data/docs/ResellerAccountTransferCredit.md +10 -0
  66. data/docs/SMSApi.md +999 -0
  67. data/docs/SMSDeliveryReceiptRulesApi.md +286 -0
  68. data/docs/SearchApi.md +68 -0
  69. data/docs/SmsCampaign.md +12 -0
  70. data/docs/SmsCampaignApi.md +338 -0
  71. data/docs/SmsMessage.md +16 -0
  72. data/docs/SmsMessageCollection.md +8 -0
  73. data/docs/SmsTemplate.md +9 -0
  74. data/docs/StatisticsApi.md +104 -0
  75. data/docs/StrippedString.md +8 -0
  76. data/docs/Subaccount.md +18 -0
  77. data/docs/SubaccountApi.md +338 -0
  78. data/docs/TimezonesApi.md +65 -0
  79. data/docs/TransactionalEmailApi.md +237 -0
  80. data/docs/TransferCreditApi.md +62 -0
  81. data/docs/UploadApi.md +65 -0
  82. data/docs/UploadFile.md +8 -0
  83. data/docs/Url.md +8 -0
  84. data/docs/UserEmailTemplatesApi.md +284 -0
  85. data/docs/VoiceApi.md +547 -0
  86. data/docs/VoiceDeliveryReceiptRulesApi.md +286 -0
  87. data/docs/VoiceMessage.md +18 -0
  88. data/docs/VoiceMessageCollection.md +8 -0
  89. data/lib/clicksend_client.rb +121 -0
  90. data/lib/clicksend_client/api/account_api.rb +447 -0
  91. data/lib/clicksend_client/api/account_recharge_api.rb +346 -0
  92. data/lib/clicksend_client/api/contact_api.rb +463 -0
  93. data/lib/clicksend_client/api/contact_list_api.rb +427 -0
  94. data/lib/clicksend_client/api/countries_api.rb +71 -0
  95. data/lib/clicksend_client/api/delivery_issues_api.rb +139 -0
  96. data/lib/clicksend_client/api/detect_address_api.rb +77 -0
  97. data/lib/clicksend_client/api/email_delivery_receipt_rules_api.rb +310 -0
  98. data/lib/clicksend_client/api/email_marketing_api.rb +829 -0
  99. data/lib/clicksend_client/api/email_to_sms_api.rb +423 -0
  100. data/lib/clicksend_client/api/fax_api.rb +425 -0
  101. data/lib/clicksend_client/api/fax_delivery_receipt_rules_api.rb +310 -0
  102. data/lib/clicksend_client/api/inbound_fax_rules_api.rb +310 -0
  103. data/lib/clicksend_client/api/inbound_sms_rules_api.rb +310 -0
  104. data/lib/clicksend_client/api/master_email_templates_api.rb +323 -0
  105. data/lib/clicksend_client/api/mms_api.rb +243 -0
  106. data/lib/clicksend_client/api/mms_campaign_api.rb +361 -0
  107. data/lib/clicksend_client/api/number_api.rb +213 -0
  108. data/lib/clicksend_client/api/post_letter_api.rb +248 -0
  109. data/lib/clicksend_client/api/post_postcard_api.rb +248 -0
  110. data/lib/clicksend_client/api/post_return_address_api.rb +307 -0
  111. data/lib/clicksend_client/api/referral_account_api.rb +85 -0
  112. data/lib/clicksend_client/api/reseller_account_api.rb +253 -0
  113. data/lib/clicksend_client/api/search_api.rb +92 -0
  114. data/lib/clicksend_client/api/sms_api.rb +1032 -0
  115. data/lib/clicksend_client/api/sms_campaign_api.rb +361 -0
  116. data/lib/clicksend_client/api/sms_delivery_receipt_rules_api.rb +310 -0
  117. data/lib/clicksend_client/api/statistics_api.rb +119 -0
  118. data/lib/clicksend_client/api/subaccount_api.rb +361 -0
  119. data/lib/clicksend_client/api/timezones_api.rb +85 -0
  120. data/lib/clicksend_client/api/transactional_email_api.rb +260 -0
  121. data/lib/clicksend_client/api/transfer_credit_api.rb +77 -0
  122. data/lib/clicksend_client/api/upload_api.rb +84 -0
  123. data/lib/clicksend_client/api/user_email_templates_api.rb +307 -0
  124. data/lib/clicksend_client/api/voice_api.rb +570 -0
  125. data/lib/clicksend_client/api/voice_delivery_receipt_rules_api.rb +310 -0
  126. data/lib/clicksend_client/api_client.rb +389 -0
  127. data/lib/clicksend_client/api_error.rb +38 -0
  128. data/lib/clicksend_client/configuration.rb +209 -0
  129. data/lib/clicksend_client/models/account.rb +295 -0
  130. data/lib/clicksend_client/models/account_forgot_password_verify.rb +219 -0
  131. data/lib/clicksend_client/models/account_verify.rb +220 -0
  132. data/lib/clicksend_client/models/address.rb +270 -0
  133. data/lib/clicksend_client/models/attachment.rb +250 -0
  134. data/lib/clicksend_client/models/contact.rb +345 -0
  135. data/lib/clicksend_client/models/contact_list.rb +190 -0
  136. data/lib/clicksend_client/models/contact_list_import.rb +207 -0
  137. data/lib/clicksend_client/models/credit_card.rb +265 -0
  138. data/lib/clicksend_client/models/date_before.rb +185 -0
  139. data/lib/clicksend_client/models/delivery_issue.rb +240 -0
  140. data/lib/clicksend_client/models/delivery_receipt_rule.rb +250 -0
  141. data/lib/clicksend_client/models/email.rb +277 -0
  142. data/lib/clicksend_client/models/email_address.rb +189 -0
  143. data/lib/clicksend_client/models/email_campaign.rb +287 -0
  144. data/lib/clicksend_client/models/email_from.rb +200 -0
  145. data/lib/clicksend_client/models/email_recipient.rb +200 -0
  146. data/lib/clicksend_client/models/email_sms_address.rb +215 -0
  147. data/lib/clicksend_client/models/email_template_new.rb +205 -0
  148. data/lib/clicksend_client/models/email_template_update.rb +200 -0
  149. data/lib/clicksend_client/models/fax_message.rb +262 -0
  150. data/lib/clicksend_client/models/fax_message_collection.rb +207 -0
  151. data/lib/clicksend_client/models/fields.rb +184 -0
  152. data/lib/clicksend_client/models/fields_fields.rb +335 -0
  153. data/lib/clicksend_client/models/forgot_password.rb +189 -0
  154. data/lib/clicksend_client/models/forgot_username.rb +194 -0
  155. data/lib/clicksend_client/models/inbound_fax_rule.rb +250 -0
  156. data/lib/clicksend_client/models/inbound_sms_rule.rb +280 -0
  157. data/lib/clicksend_client/models/mms_campaign.rb +272 -0
  158. data/lib/clicksend_client/models/mms_message.rb +294 -0
  159. data/lib/clicksend_client/models/mms_message_collection.rb +207 -0
  160. data/lib/clicksend_client/models/post_letter.rb +267 -0
  161. data/lib/clicksend_client/models/post_postcard.rb +209 -0
  162. data/lib/clicksend_client/models/post_recipient.rb +302 -0
  163. data/lib/clicksend_client/models/reseller_account.rb +295 -0
  164. data/lib/clicksend_client/models/reseller_account_transfer_credit.rb +220 -0
  165. data/lib/clicksend_client/models/sms_campaign.rb +242 -0
  166. data/lib/clicksend_client/models/sms_message.rb +279 -0
  167. data/lib/clicksend_client/models/sms_message_collection.rb +192 -0
  168. data/lib/clicksend_client/models/sms_template.rb +205 -0
  169. data/lib/clicksend_client/models/stripped_string.rb +190 -0
  170. data/lib/clicksend_client/models/subaccount.rb +325 -0
  171. data/lib/clicksend_client/models/upload_file.rb +190 -0
  172. data/lib/clicksend_client/models/url.rb +190 -0
  173. data/lib/clicksend_client/models/voice_message.rb +316 -0
  174. data/lib/clicksend_client/models/voice_message_collection.rb +192 -0
  175. data/lib/clicksend_client/version.rb +15 -0
  176. data/spec/api/account_api_spec.rb +131 -0
  177. data/spec/api/account_recharge_api_spec.rb +107 -0
  178. data/spec/api/contact_api_spec.rb +129 -0
  179. data/spec/api/contact_list_api_spec.rb +123 -0
  180. data/spec/api/countries_api_spec.rb +46 -0
  181. data/spec/api/delivery_issues_api_spec.rb +60 -0
  182. data/spec/api/detect_address_api_spec.rb +47 -0
  183. data/spec/api/email_delivery_receipt_rules_api_spec.rb +98 -0
  184. data/spec/api/email_marketing_api_spec.rb +213 -0
  185. data/spec/api/email_to_sms_api_spec.rb +122 -0
  186. data/spec/api/fax_api_spec.rb +125 -0
  187. data/spec/api/fax_delivery_receipt_rules_api_spec.rb +98 -0
  188. data/spec/api/inbound_fax_rules_api_spec.rb +98 -0
  189. data/spec/api/inbound_sms_rules_api_spec.rb +98 -0
  190. data/spec/api/master_email_templates_api_spec.rb +99 -0
  191. data/spec/api/mms_api_spec.rb +84 -0
  192. data/spec/api/mms_campaign_api_spec.rb +109 -0
  193. data/spec/api/number_api_spec.rb +76 -0
  194. data/spec/api/post_letter_api_spec.rb +84 -0
  195. data/spec/api/post_postcard_api_spec.rb +84 -0
  196. data/spec/api/post_return_address_api_spec.rb +97 -0
  197. data/spec/api/referral_account_api_spec.rb +48 -0
  198. data/spec/api/reseller_account_api_spec.rb +85 -0
  199. data/spec/api/search_api_spec.rb +49 -0
  200. data/spec/api/sms_api_spec.rb +259 -0
  201. data/spec/api/sms_campaign_api_spec.rb +109 -0
  202. data/spec/api/sms_delivery_receipt_rules_api_spec.rb +98 -0
  203. data/spec/api/statistics_api_spec.rb +57 -0
  204. data/spec/api/subaccount_api_spec.rb +109 -0
  205. data/spec/api/timezones_api_spec.rb +48 -0
  206. data/spec/api/transactional_email_api_spec.rb +88 -0
  207. data/spec/api/transfer_credit_api_spec.rb +47 -0
  208. data/spec/api/upload_api_spec.rb +48 -0
  209. data/spec/api/user_email_templates_api_spec.rb +97 -0
  210. data/spec/api/voice_api_spec.rb +157 -0
  211. data/spec/api/voice_delivery_receipt_rules_api_spec.rb +98 -0
  212. data/spec/api_client_spec.rb +226 -0
  213. data/spec/configuration_spec.rb +42 -0
  214. data/spec/models/account_forgot_password_verify_spec.rb +53 -0
  215. data/spec/models/account_spec.rb +83 -0
  216. data/spec/models/account_verify_spec.rb +53 -0
  217. data/spec/models/address_spec.rb +77 -0
  218. data/spec/models/attachment_spec.rb +65 -0
  219. data/spec/models/contact_list_import_spec.rb +47 -0
  220. data/spec/models/contact_list_spec.rb +41 -0
  221. data/spec/models/contact_spec.rb +131 -0
  222. data/spec/models/credit_card_spec.rb +71 -0
  223. data/spec/models/date_before_spec.rb +41 -0
  224. data/spec/models/delivery_issue_spec.rb +65 -0
  225. data/spec/models/delivery_receipt_rule_spec.rb +65 -0
  226. data/spec/models/email_address_spec.rb +41 -0
  227. data/spec/models/email_campaign_spec.rb +83 -0
  228. data/spec/models/email_from_spec.rb +47 -0
  229. data/spec/models/email_recipient_spec.rb +47 -0
  230. data/spec/models/email_sms_address_spec.rb +53 -0
  231. data/spec/models/email_spec.rb +83 -0
  232. data/spec/models/email_template_new_spec.rb +47 -0
  233. data/spec/models/email_template_update_spec.rb +47 -0
  234. data/spec/models/fax_message_collection_spec.rb +47 -0
  235. data/spec/models/fax_message_spec.rb +83 -0
  236. data/spec/models/fields_fields_spec.rb +131 -0
  237. data/spec/models/fields_spec.rb +41 -0
  238. data/spec/models/forgot_password_spec.rb +41 -0
  239. data/spec/models/forgot_username_spec.rb +47 -0
  240. data/spec/models/inbound_fax_rule_spec.rb +65 -0
  241. data/spec/models/inbound_sms_rule_spec.rb +77 -0
  242. data/spec/models/mms_campaign_spec.rb +77 -0
  243. data/spec/models/mms_message_collection_spec.rb +47 -0
  244. data/spec/models/mms_message_spec.rb +95 -0
  245. data/spec/models/post_letter_spec.rb +77 -0
  246. data/spec/models/post_postcard_spec.rb +47 -0
  247. data/spec/models/post_recipient_spec.rb +89 -0
  248. data/spec/models/reseller_account_spec.rb +83 -0
  249. data/spec/models/reseller_account_transfer_credit_spec.rb +53 -0
  250. data/spec/models/sms_campaign_spec.rb +65 -0
  251. data/spec/models/sms_message_collection_spec.rb +41 -0
  252. data/spec/models/sms_message_spec.rb +89 -0
  253. data/spec/models/sms_template_spec.rb +47 -0
  254. data/spec/models/stripped_string_spec.rb +41 -0
  255. data/spec/models/subaccount_spec.rb +101 -0
  256. data/spec/models/upload_file_spec.rb +41 -0
  257. data/spec/models/url_spec.rb +41 -0
  258. data/spec/models/voice_message_collection_spec.rb +41 -0
  259. data/spec/models/voice_message_spec.rb +101 -0
  260. data/spec/spec_helper.rb +111 -0
  261. metadata +568 -0
@@ -0,0 +1,250 @@
1
+ =begin
2
+ #ClickSend v3 API
3
+
4
+ # This is an official SDK for [ClickSend](https://clicksend.com) Below you will find a current list of the available methods for clicksend. *NOTE: You will need to create a free account to use the API. You can register [here](https://dashboard.clicksend.com/#/signup/step1/)..*
5
+
6
+ OpenAPI spec version: 3.1
7
+ Contact: support@clicksend.com
8
+ Generated by: https://github.com/clicksend-api/clicksend-codegen.git
9
+ ClickSend Codegen version: 2.4.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ClickSendClient
16
+ # Email attachment
17
+ class Attachment
18
+ # The base64-encoded contents of the file.
19
+ attr_accessor :content
20
+
21
+ # The type of file being attached.
22
+ attr_accessor :type
23
+
24
+ # The name of the file being attached.
25
+ attr_accessor :filename
26
+
27
+ # Inline for content that can be displayed within the email, or attachment for any other files.
28
+ attr_accessor :disposition
29
+
30
+ # An ID for the content.
31
+ attr_accessor :content_id
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'content' => :'content',
37
+ :'type' => :'type',
38
+ :'filename' => :'filename',
39
+ :'disposition' => :'disposition',
40
+ :'content_id' => :'content_id'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.clicksend_types
46
+ {
47
+ :'content' => :'String',
48
+ :'type' => :'String',
49
+ :'filename' => :'String',
50
+ :'disposition' => :'String',
51
+ :'content_id' => :'String'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
62
+
63
+ if attributes.has_key?(:'content')
64
+ self.content = attributes[:'content']
65
+ end
66
+
67
+ if attributes.has_key?(:'type')
68
+ self.type = attributes[:'type']
69
+ end
70
+
71
+ if attributes.has_key?(:'filename')
72
+ self.filename = attributes[:'filename']
73
+ end
74
+
75
+ if attributes.has_key?(:'disposition')
76
+ self.disposition = attributes[:'disposition']
77
+ end
78
+
79
+ if attributes.has_key?(:'content_id')
80
+ self.content_id = attributes[:'content_id']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ if @content.nil?
89
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
90
+ end
91
+
92
+ if @type.nil?
93
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
94
+ end
95
+
96
+ if @filename.nil?
97
+ invalid_properties.push('invalid value for "filename", filename cannot be nil.')
98
+ end
99
+
100
+ if @disposition.nil?
101
+ invalid_properties.push('invalid value for "disposition", disposition cannot be nil.')
102
+ end
103
+
104
+ if @content_id.nil?
105
+ invalid_properties.push('invalid value for "content_id", content_id cannot be nil.')
106
+ end
107
+
108
+ invalid_properties
109
+ end
110
+
111
+ # Check to see if the all the properties in the model are valid
112
+ # @return true if the model is valid
113
+ def valid?
114
+ return false if @content.nil?
115
+ return false if @type.nil?
116
+ return false if @filename.nil?
117
+ return false if @disposition.nil?
118
+ return false if @content_id.nil?
119
+ true
120
+ end
121
+
122
+ # Checks equality by comparing each attribute.
123
+ # @param [Object] Object to be compared
124
+ def ==(o)
125
+ return true if self.equal?(o)
126
+ self.class == o.class &&
127
+ content == o.content &&
128
+ type == o.type &&
129
+ filename == o.filename &&
130
+ disposition == o.disposition &&
131
+ content_id == o.content_id
132
+ end
133
+
134
+ # @see the `==` method
135
+ # @param [Object] Object to be compared
136
+ def eql?(o)
137
+ self == o
138
+ end
139
+
140
+ # Calculates hash code according to all attributes.
141
+ # @return [Fixnum] Hash code
142
+ def hash
143
+ [content, type, filename, disposition, content_id].hash
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ self.class.clicksend_types.each_pair do |key, type|
152
+ if type =~ /\AArray<(.*)>/i
153
+ # check to ensure the input is an array given that the the attribute
154
+ # is documented as an array but the input is not
155
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
156
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
160
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
161
+ end
162
+
163
+ self
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def _deserialize(type, value)
171
+ case type.to_sym
172
+ when :DateTime
173
+ DateTime.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :BOOLEAN
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ temp_model = ClickSendClient.const_get(type).new
204
+ temp_model.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ next if value.nil?
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ # Outputs non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ # @param [Object] value Any valid value
235
+ # @return [Hash] Returns the value in the form of hash
236
+ def _to_hash(value)
237
+ if value.is_a?(Array)
238
+ value.compact.map { |v| _to_hash(v) }
239
+ elsif value.is_a?(Hash)
240
+ {}.tap do |hash|
241
+ value.each { |k, v| hash[k] = _to_hash(v) }
242
+ end
243
+ elsif value.respond_to? :to_hash
244
+ value.to_hash
245
+ else
246
+ value
247
+ end
248
+ end
249
+ end
250
+ end
@@ -0,0 +1,345 @@
1
+ =begin
2
+ #ClickSend v3 API
3
+
4
+ # This is an official SDK for [ClickSend](https://clicksend.com) Below you will find a current list of the available methods for clicksend. *NOTE: You will need to create a free account to use the API. You can register [here](https://dashboard.clicksend.com/#/signup/step1/)..*
5
+
6
+ OpenAPI spec version: 3.1
7
+ Contact: support@clicksend.com
8
+ Generated by: https://github.com/clicksend-api/clicksend-codegen.git
9
+ ClickSend Codegen version: 2.4.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module ClickSendClient
16
+ # Contains all details for the main contact.
17
+ class Contact
18
+ # Your phone number in E.164 format. Must be provided if no fax number or email.
19
+ attr_accessor :phone_number
20
+
21
+ #
22
+ attr_accessor :custom_1
23
+
24
+ # Your email. Must be provided if no phone number or fax number.
25
+ attr_accessor :email
26
+
27
+ # Your fax number. Must be provided if no phone number or email.
28
+ attr_accessor :fax_number
29
+
30
+ # Your first name.
31
+ attr_accessor :first_name
32
+
33
+ # Your street address
34
+ attr_accessor :address_line_1
35
+
36
+ #
37
+ attr_accessor :address_line_2
38
+
39
+ # Your nearest city
40
+ attr_accessor :address_city
41
+
42
+ # Your current state
43
+ attr_accessor :address_state
44
+
45
+ # Your current postcode
46
+ attr_accessor :address_postal_code
47
+
48
+ # Your current country
49
+ attr_accessor :address_country
50
+
51
+ # Your organisation name
52
+ attr_accessor :organization_name
53
+
54
+ #
55
+ attr_accessor :custom_2
56
+
57
+ #
58
+ attr_accessor :custom_3
59
+
60
+ #
61
+ attr_accessor :custom_4
62
+
63
+ # Your last name
64
+ attr_accessor :last_name
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'phone_number' => :'phone_number',
70
+ :'custom_1' => :'custom_1',
71
+ :'email' => :'email',
72
+ :'fax_number' => :'fax_number',
73
+ :'first_name' => :'first_name',
74
+ :'address_line_1' => :'address_line_1',
75
+ :'address_line_2' => :'address_line_2',
76
+ :'address_city' => :'address_city',
77
+ :'address_state' => :'address_state',
78
+ :'address_postal_code' => :'address_postal_code',
79
+ :'address_country' => :'address_country',
80
+ :'organization_name' => :'organization_name',
81
+ :'custom_2' => :'custom_2',
82
+ :'custom_3' => :'custom_3',
83
+ :'custom_4' => :'custom_4',
84
+ :'last_name' => :'last_name'
85
+ }
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.clicksend_types
90
+ {
91
+ :'phone_number' => :'String',
92
+ :'custom_1' => :'String',
93
+ :'email' => :'String',
94
+ :'fax_number' => :'String',
95
+ :'first_name' => :'String',
96
+ :'address_line_1' => :'String',
97
+ :'address_line_2' => :'String',
98
+ :'address_city' => :'String',
99
+ :'address_state' => :'String',
100
+ :'address_postal_code' => :'String',
101
+ :'address_country' => :'String',
102
+ :'organization_name' => :'String',
103
+ :'custom_2' => :'String',
104
+ :'custom_3' => :'String',
105
+ :'custom_4' => :'String',
106
+ :'last_name' => :'String'
107
+ }
108
+ end
109
+
110
+ # Initializes the object
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ def initialize(attributes = {})
113
+ return unless attributes.is_a?(Hash)
114
+
115
+ # convert string to symbol for hash key
116
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
117
+
118
+ if attributes.has_key?(:'phone_number')
119
+ self.phone_number = attributes[:'phone_number']
120
+ end
121
+
122
+ if attributes.has_key?(:'custom_1')
123
+ self.custom_1 = attributes[:'custom_1']
124
+ end
125
+
126
+ if attributes.has_key?(:'email')
127
+ self.email = attributes[:'email']
128
+ end
129
+
130
+ if attributes.has_key?(:'fax_number')
131
+ self.fax_number = attributes[:'fax_number']
132
+ end
133
+
134
+ if attributes.has_key?(:'first_name')
135
+ self.first_name = attributes[:'first_name']
136
+ end
137
+
138
+ if attributes.has_key?(:'address_line_1')
139
+ self.address_line_1 = attributes[:'address_line_1']
140
+ end
141
+
142
+ if attributes.has_key?(:'address_line_2')
143
+ self.address_line_2 = attributes[:'address_line_2']
144
+ end
145
+
146
+ if attributes.has_key?(:'address_city')
147
+ self.address_city = attributes[:'address_city']
148
+ end
149
+
150
+ if attributes.has_key?(:'address_state')
151
+ self.address_state = attributes[:'address_state']
152
+ end
153
+
154
+ if attributes.has_key?(:'address_postal_code')
155
+ self.address_postal_code = attributes[:'address_postal_code']
156
+ end
157
+
158
+ if attributes.has_key?(:'address_country')
159
+ self.address_country = attributes[:'address_country']
160
+ end
161
+
162
+ if attributes.has_key?(:'organization_name')
163
+ self.organization_name = attributes[:'organization_name']
164
+ end
165
+
166
+ if attributes.has_key?(:'custom_2')
167
+ self.custom_2 = attributes[:'custom_2']
168
+ end
169
+
170
+ if attributes.has_key?(:'custom_3')
171
+ self.custom_3 = attributes[:'custom_3']
172
+ end
173
+
174
+ if attributes.has_key?(:'custom_4')
175
+ self.custom_4 = attributes[:'custom_4']
176
+ end
177
+
178
+ if attributes.has_key?(:'last_name')
179
+ self.last_name = attributes[:'last_name']
180
+ end
181
+ end
182
+
183
+ # Show invalid properties with the reasons. Usually used together with valid?
184
+ # @return Array for valid properties with the reasons
185
+ def list_invalid_properties
186
+ invalid_properties = Array.new
187
+ if @phone_number.nil?
188
+ invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
189
+ end
190
+
191
+ if @custom_1.nil?
192
+ invalid_properties.push('invalid value for "custom_1", custom_1 cannot be nil.')
193
+ end
194
+
195
+ invalid_properties
196
+ end
197
+
198
+ # Check to see if the all the properties in the model are valid
199
+ # @return true if the model is valid
200
+ def valid?
201
+ return false if @phone_number.nil?
202
+ return false if @custom_1.nil?
203
+ true
204
+ end
205
+
206
+ # Checks equality by comparing each attribute.
207
+ # @param [Object] Object to be compared
208
+ def ==(o)
209
+ return true if self.equal?(o)
210
+ self.class == o.class &&
211
+ phone_number == o.phone_number &&
212
+ custom_1 == o.custom_1 &&
213
+ email == o.email &&
214
+ fax_number == o.fax_number &&
215
+ first_name == o.first_name &&
216
+ address_line_1 == o.address_line_1 &&
217
+ address_line_2 == o.address_line_2 &&
218
+ address_city == o.address_city &&
219
+ address_state == o.address_state &&
220
+ address_postal_code == o.address_postal_code &&
221
+ address_country == o.address_country &&
222
+ organization_name == o.organization_name &&
223
+ custom_2 == o.custom_2 &&
224
+ custom_3 == o.custom_3 &&
225
+ custom_4 == o.custom_4 &&
226
+ last_name == o.last_name
227
+ end
228
+
229
+ # @see the `==` method
230
+ # @param [Object] Object to be compared
231
+ def eql?(o)
232
+ self == o
233
+ end
234
+
235
+ # Calculates hash code according to all attributes.
236
+ # @return [Fixnum] Hash code
237
+ def hash
238
+ [phone_number, custom_1, email, fax_number, first_name, address_line_1, address_line_2, address_city, address_state, address_postal_code, address_country, organization_name, custom_2, custom_3, custom_4, last_name].hash
239
+ end
240
+
241
+ # Builds the object from hash
242
+ # @param [Hash] attributes Model attributes in the form of hash
243
+ # @return [Object] Returns the model itself
244
+ def build_from_hash(attributes)
245
+ return nil unless attributes.is_a?(Hash)
246
+ self.class.clicksend_types.each_pair do |key, type|
247
+ if type =~ /\AArray<(.*)>/i
248
+ # check to ensure the input is an array given that the the attribute
249
+ # is documented as an array but the input is not
250
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
251
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
252
+ end
253
+ elsif !attributes[self.class.attribute_map[key]].nil?
254
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
255
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
256
+ end
257
+
258
+ self
259
+ end
260
+
261
+ # Deserializes the data based on type
262
+ # @param string type Data type
263
+ # @param string value Value to be deserialized
264
+ # @return [Object] Deserialized data
265
+ def _deserialize(type, value)
266
+ case type.to_sym
267
+ when :DateTime
268
+ DateTime.parse(value)
269
+ when :Date
270
+ Date.parse(value)
271
+ when :String
272
+ value.to_s
273
+ when :Integer
274
+ value.to_i
275
+ when :Float
276
+ value.to_f
277
+ when :BOOLEAN
278
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
279
+ true
280
+ else
281
+ false
282
+ end
283
+ when :Object
284
+ # generic object (usually a Hash), return directly
285
+ value
286
+ when /\AArray<(?<inner_type>.+)>\z/
287
+ inner_type = Regexp.last_match[:inner_type]
288
+ value.map { |v| _deserialize(inner_type, v) }
289
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
290
+ k_type = Regexp.last_match[:k_type]
291
+ v_type = Regexp.last_match[:v_type]
292
+ {}.tap do |hash|
293
+ value.each do |k, v|
294
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
295
+ end
296
+ end
297
+ else # model
298
+ temp_model = ClickSendClient.const_get(type).new
299
+ temp_model.build_from_hash(value)
300
+ end
301
+ end
302
+
303
+ # Returns the string representation of the object
304
+ # @return [String] String presentation of the object
305
+ def to_s
306
+ to_hash.to_s
307
+ end
308
+
309
+ # to_body is an alias to to_hash (backward compatibility)
310
+ # @return [Hash] Returns the object in the form of hash
311
+ def to_body
312
+ to_hash
313
+ end
314
+
315
+ # Returns the object in the form of hash
316
+ # @return [Hash] Returns the object in the form of hash
317
+ def to_hash
318
+ hash = {}
319
+ self.class.attribute_map.each_pair do |attr, param|
320
+ value = self.send(attr)
321
+ next if value.nil?
322
+ hash[param] = _to_hash(value)
323
+ end
324
+ hash
325
+ end
326
+
327
+ # Outputs non-array value in the form of hash
328
+ # For object, use to_hash. Otherwise, just return the value
329
+ # @param [Object] value Any valid value
330
+ # @return [Hash] Returns the value in the form of hash
331
+ def _to_hash(value)
332
+ if value.is_a?(Array)
333
+ value.compact.map { |v| _to_hash(v) }
334
+ elsif value.is_a?(Hash)
335
+ {}.tap do |hash|
336
+ value.each { |k, v| hash[k] = _to_hash(v) }
337
+ end
338
+ elsif value.respond_to? :to_hash
339
+ value.to_hash
340
+ else
341
+ value
342
+ end
343
+ end
344
+ end
345
+ end