Class: Iterable::Export
- Inherits:
-
ApiResource
- Object
- ApiResource
- Iterable::Export
- Defined in:
- lib/iterable/export.rb
Overview
Interact with /export API endpoints
Direct Known Subclasses
Constant Summary collapse
- DATE_FORMAT =
'%Y-%m-%d %H:%M:%S'.freeze
- DATA_TYPES =
[ EMAIL_SEND_TYPE = 'emailSend'.freeze, EMAIL_OPEN_TYPE = 'emailOpen'.freeze, EMAIL_CLICK_TYPE = 'emailClick'.freeze, EMAIL_UNSUBSCRIBE_TYPE = 'emailUnSubscribe'.freeze, EMAIL_SUBSCRIBE_TYPE = 'emailSubscribe'.freeze, EMAIL_BOUNCE_TYPE = 'emailBounce'.freeze, EMAIL_COMPLAINT_TYPE = 'emailComplaint'.freeze, PUSH_SEND_TYPE = 'pushSend'.freeze, PUSH_BOUNCE_TYPE = 'pushBounce'.freeze, PUSH_OPEN_TYPE = 'pushOpen'.freeze, SMS_SEND_TYPE = 'smsSend'.freeze, SMS_BOUNCE_TYPE = 'smsBounce'.freeze, SMS_RECEIVED_TYPE = 'smsReceived'.freeze, IN_APP_OPEN_TYPE = 'inAppOpen'.freeze, IN_APP_CLICK_TYPE = 'inAppClick'.freeze, WEB_PUSH_SEND_TYPE = 'webPushSend'.freeze, HOSTED_UNSUBSCRIBE_CLICK_TYPE = 'hostedUnsubscribeClick'.freeze, PURCHASE_TYPE = 'purchase'.freeze, CUSTOM_EVENT_TYPE = 'customEvent'.freeze, USER_TYPE = 'user'.freeze ].freeze
- RANGES =
[ TODAY = 'Today'.freeze, YESTERDAY = 'Yesterday'.freeze, BEFORE_TODAY = 'BeforeToday'.freeze, ALL = 'All'.freeze ].freeze
Instance Attribute Summary collapse
-
#campaign_id ⇒ Object
readonly
Returns the value of attribute campaign_id.
-
#data_type ⇒ Object
readonly
Returns the value of attribute data_type.
-
#omit_fields ⇒ Object
readonly
Returns the value of attribute omit_fields.
-
#only_fields ⇒ Object
readonly
Returns the value of attribute only_fields.
Attributes inherited from ApiResource
Instance Method Summary collapse
-
#export(start_time, end_time) ⇒ Iterable::Response
Export data between a start and end time.
-
#export_range(range = Iterable::Export::TODAY) ⇒ Iterable::Response
Export data given a valid range constant [Iterable::Export::RANGES].
-
#format ⇒ Exception
The format of the exporter to be implemented by a subclass.
-
#initialize(data_type, only_fields = [], omit_fields = [], campaign_id = nil, conf = nil) ⇒ Iterable::Export
constructor
Initialize an [Iterable::Export] object to export data from Iterable.
Methods inherited from ApiResource
default_config, #default_config
Constructor Details
#initialize(data_type, only_fields = [], omit_fields = [], campaign_id = nil, conf = nil) ⇒ Iterable::Export
Initialize an [Iterable::Export] object to export data from Iterable
60 61 62 63 64 65 66 |
# File 'lib/iterable/export.rb', line 60 def initialize(data_type, only_fields = [], omit_fields = [], campaign_id = nil, conf = nil) # rubocop:disable Metrics/ParameterLists @data_type = data_type @only_fields = only_fields @omit_fields = omit_fields @campaign_id = campaign_id super conf end |
Instance Attribute Details
#campaign_id ⇒ Object (readonly)
Returns the value of attribute campaign_id.
47 48 49 |
# File 'lib/iterable/export.rb', line 47 def campaign_id @campaign_id end |
#data_type ⇒ Object (readonly)
Returns the value of attribute data_type.
47 48 49 |
# File 'lib/iterable/export.rb', line 47 def data_type @data_type end |
#omit_fields ⇒ Object (readonly)
Returns the value of attribute omit_fields.
47 48 49 |
# File 'lib/iterable/export.rb', line 47 def omit_fields @omit_fields end |
#only_fields ⇒ Object (readonly)
Returns the value of attribute only_fields.
47 48 49 |
# File 'lib/iterable/export.rb', line 47 def only_fields @only_fields end |
Instance Method Details
#export(start_time, end_time) ⇒ Iterable::Response
Export data between a start and end time
86 87 88 89 90 91 92 |
# File 'lib/iterable/export.rb', line 86 def export(start_time, end_time) params = { startDateTime: start_time.strftime(Iterable::Export::DATE_FORMAT), endDateTime: end_time.strftime(Iterable::Export::DATE_FORMAT) } Iterable.request(conf, base_path, request_params(params)).get end |
#export_range(range = Iterable::Export::TODAY) ⇒ Iterable::Response
Export data given a valid range constant [Iterable::Export::RANGES]
101 102 103 104 |
# File 'lib/iterable/export.rb', line 101 def export_range(range = Iterable::Export::TODAY) params = { range: range } Iterable.request(conf, base_path, request_params(params)).get end |
#format ⇒ Exception
The format of the exporter to be implemented by a subclass
74 75 76 |
# File 'lib/iterable/export.rb', line 74 def format raise '#format must be implemented in child class' end |