Class: MojitoImport::Importer
- Inherits:
-
Object
- Object
- MojitoImport::Importer
- Defined in:
- lib/mojito_import/importer.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#additional_row_data ⇒ Object
Returns the value of attribute additional_row_data.
-
#button_name ⇒ Object
Returns the value of attribute button_name.
-
#import_scenario_identifier ⇒ Object
Returns the value of attribute import_scenario_identifier.
-
#mojito_host ⇒ Object
Returns the value of attribute mojito_host.
-
#operator ⇒ Object
Returns the value of attribute operator.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/mojito_import/importer.rb', line 4 def access_token @access_token end |
#additional_row_data ⇒ Object
Returns the value of attribute additional_row_data.
5 6 7 |
# File 'lib/mojito_import/importer.rb', line 5 def additional_row_data @additional_row_data end |
#button_name ⇒ Object
Returns the value of attribute button_name.
5 6 7 |
# File 'lib/mojito_import/importer.rb', line 5 def @button_name end |
#import_scenario_identifier ⇒ Object
Returns the value of attribute import_scenario_identifier.
4 5 6 |
# File 'lib/mojito_import/importer.rb', line 4 def import_scenario_identifier @import_scenario_identifier end |
#mojito_host ⇒ Object
Returns the value of attribute mojito_host.
6 7 8 |
# File 'lib/mojito_import/importer.rb', line 6 def mojito_host @mojito_host end |
#operator ⇒ Object
Returns the value of attribute operator.
4 5 6 |
# File 'lib/mojito_import/importer.rb', line 4 def operator @operator end |
Class Method Details
.create(import_scenario_identifier:, operator: nil, access_token:, additional_row_data: {}, button_name: "Upload your file", mojito_manual_host: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mojito_import/importer.rb', line 8 def self.create(import_scenario_identifier: , operator: nil, access_token: , additional_row_data: {}, button_name: "Upload your file", mojito_manual_host: nil) importer = MojitoImport::Importer.new importer.access_token = access_token importer.additional_row_data = additional_row_data importer. = importer.mojito_host = mojito_manual_host || "https://script.mojito-import.com" importer.import_scenario_identifier = import_scenario_identifier importer.operator = operator importer end |
Instance Method Details
#iframe_source ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/mojito_import/importer.rb', line 28 def iframe_source begin iframe_import_id = import_id rescue RestClient::Unauthorized => e return "Unauthorized" end "#{mojito_host}/imports/#{iframe_import_id}/iframe?access_token=#{access_token}&operator=#{operator}" end |
#script_source ⇒ Object
24 25 26 |
# File 'lib/mojito_import/importer.rb', line 24 def script_source "#{mojito_host}/mojito.js" end |