interakt_rails 0.0.1.4 → 0.0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Gemfile +1 -1
- data/README.md +3 -3
- data/{interakthq_rails.gemspec → interakt_rails.gemspec} +3 -3
- data/lib/{interakthq_rails → interakt_rails}/import.rb +5 -5
- data/lib/interakt_rails/interakt.rake +12 -0
- data/lib/{interakthq_rails → interakt_rails}/railtie.rb +2 -2
- data/lib/{interakthq_rails → interakt_rails}/setting.rb +1 -1
- data/lib/{interakthq_rails → interakt_rails}/user_validator.rb +5 -5
- data/lib/interakt_rails/version.rb +3 -0
- data/lib/interakt_rails.rb +12 -0
- data/lib/rails/generators/interakt/config/config_generator.rb +21 -0
- data/lib/rails/generators/{interakthq/config/interakthq.rb.erb → interakt/config/interakt.rb.erb} +6 -6
- metadata +12 -12
- data/lib/interakthq_rails/interakthq.rake +0 -12
- data/lib/interakthq_rails/version.rb +0 -3
- data/lib/interakthq_rails.rb +0 -12
- data/lib/rails/generators/interakthq/config/config_generator.rb +0 -21
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yjk2YjE1OTJjODkxZTZmM2NlNTI3ODdhYzI1ZTExM2Q0M2Y0MGFmMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTY4M2RlYjBjNDBmNjY2Mzg0YTM1ZWJhNWNmMWY3YmU0OTZiMTY4ZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWU2NmI1NzJjMmNkNDUwZDgxNGM2YTE4M2MyNmU3NmE0ZWYzYmVkOWJmNjUy
|
10
|
+
NWEzNzBmYzEwOGQyNzhmOWRkMjczYmE3N2E2NzJhNjY1MDU1NTUzYTgyYTI3
|
11
|
+
Y2U0ZjNkM2Y0OGVlMjM5ZGExYzRiY2U3N2E2ZDhhYmFmMmY4Mjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWJkMmI2ZDEwMmM5YTZmMzM0MjlhODVlN2VkMTYwMzJiZTNmM2RjOGM4YWU1
|
14
|
+
NTA1YzA3ZDcyYWNhOTVjMmQ3OTBhZTU1MGJhY2U3NWQ4YjJiMWU4NjQ2Mjll
|
15
|
+
YWNjOTI1ZTdkYzkzNDRlOWVjYmU1NjA4MGE2ZWQ2NDdlOGI5MzQ=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# InteraktRails
|
2
2
|
|
3
3
|
TODO: Write a gem description
|
4
4
|
|
@@ -6,7 +6,7 @@ TODO: Write a gem description
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem '
|
9
|
+
gem 'interakt_rails'
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
@@ -14,7 +14,7 @@ And then execute:
|
|
14
14
|
|
15
15
|
Or install it yourself as:
|
16
16
|
|
17
|
-
$ gem install
|
17
|
+
$ gem install interakt_rails
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'interakt_rails/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "interakt_rails"
|
8
|
-
spec.version =
|
8
|
+
spec.version = InteraktRails::VERSION
|
9
9
|
spec.authors = ["Manoj"]
|
10
10
|
spec.email = ["manoj.delhi24@gmail.com"]
|
11
|
-
spec.description = %q{Import your users data into
|
11
|
+
spec.description = %q{Import your users data into interakt}
|
12
12
|
spec.summary = %q{The Customer Interaction HeadQuarter. Easily interact with every single user of your app.}
|
13
13
|
spec.homepage = "http://interakt.co/"
|
14
14
|
spec.license = "MIT"
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require "
|
1
|
+
require "interakt_rails/user_validator"
|
2
2
|
|
3
|
-
module
|
3
|
+
module InteraktRails
|
4
4
|
class Import
|
5
5
|
include UserValidator
|
6
6
|
|
@@ -12,7 +12,7 @@ module InterakthqRails
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.uri
|
15
|
-
host = (Rails.env.production? ? "http://
|
15
|
+
host = (Rails.env.production? ? "http://interakt.co" : "http://localhost:3000")
|
16
16
|
URI.parse(host + "/api/v1/members/import_data")
|
17
17
|
end
|
18
18
|
|
@@ -40,7 +40,7 @@ module InterakthqRails
|
|
40
40
|
|
41
41
|
def send_members( members)
|
42
42
|
request = Net::HTTP::Post.new(uri.request_uri)
|
43
|
-
request.basic_auth(
|
43
|
+
request.basic_auth(InteraktRails.config.app_id, InteraktRails.config.api_key)
|
44
44
|
request["Content-Type"] = "application/json"
|
45
45
|
request.body = {members: members}.to_json
|
46
46
|
|
@@ -60,7 +60,7 @@ module InterakthqRails
|
|
60
60
|
|
61
61
|
|
62
62
|
def custom_data_attributes_for_member(member)
|
63
|
-
if( (custom_data =
|
63
|
+
if( (custom_data = InteraktRails.config.user.custom_data).present?)
|
64
64
|
custom_data.inject({}) do |hash, (key, value)|
|
65
65
|
hash[key] = ( value.kind_of?(Proc) ? value.call(member) : member.send( value))
|
66
66
|
hash
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module
|
1
|
+
module InteraktRails
|
2
2
|
module UserValidator
|
3
3
|
EXPECTED_ATTRIBUTES = ['email', 'name', 'first_name', 'last_name','firstname', 'lastname', 'created_at']
|
4
4
|
|
5
5
|
def check_basic_validation
|
6
6
|
raise 'We only supports ActiveRecord' unless (defined?(ActiveRecord::Base) && (model_name < ActiveRecord::Base))
|
7
|
-
raise "You have to add 'app_id' in your 'config/initializers/
|
8
|
-
raise "You have to add 'api_key' in your 'config/initializers/
|
7
|
+
raise "You have to add 'app_id' in your 'config/initializers/interakt.rb' file first" unless InteraktRails.config.app_id.present?
|
8
|
+
raise "You have to add 'api_key' in your 'config/initializers/interakt.rb' file first" unless InteraktRails.config.api_key.present?
|
9
9
|
raise "Your model must have 'email' field" unless model_name.new.respond_to? :email
|
10
10
|
|
11
11
|
end
|
@@ -13,7 +13,7 @@ module InterakthqRails
|
|
13
13
|
def model_name
|
14
14
|
unless @model_name
|
15
15
|
begin
|
16
|
-
|
16
|
+
InteraktRails.config.user.model.call
|
17
17
|
rescue Exception => e
|
18
18
|
raise "Model doesn't exists"
|
19
19
|
end
|
@@ -27,7 +27,7 @@ module InterakthqRails
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def verify_reponse( response)
|
30
|
-
raise "Your 'app_id' is not corrent. Please correct it in 'config/initializers/
|
30
|
+
raise "Your 'app_id' is not corrent. Please correct it in 'config/initializers/interakt.rb'" if response.code.to_i == 401
|
31
31
|
raise "Something went wrong. Please report the issue." if response.code.to_i == 500
|
32
32
|
response_verified = true
|
33
33
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Interakt
|
2
|
+
module Generators
|
3
|
+
class ConfigGenerator < ::Rails::Generators::Base
|
4
|
+
|
5
|
+
def self.source_root
|
6
|
+
File.dirname(__FILE__)
|
7
|
+
end
|
8
|
+
|
9
|
+
argument :app_id, :desc => "Your interakt app-id, which can be found here: https://www.interakt.co/api_keys"
|
10
|
+
argument :api_key, :desc => "An interakt API key, for various rake tasks", :optional => true
|
11
|
+
|
12
|
+
def create_initializer_file
|
13
|
+
@app_id = app_id
|
14
|
+
@api_key = api_key
|
15
|
+
|
16
|
+
template("interakt.rb.erb", "config/initializers/interakt.rb")
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/rails/generators/{interakthq/config/interakthq.rb.erb → interakt/config/interakt.rb.erb}
RENAMED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
2
|
-
# ==
|
1
|
+
InteraktRails.config do |config|
|
2
|
+
# == interakt app_id
|
3
3
|
#
|
4
|
-
config.app_id = ENV["
|
4
|
+
config.app_id = ENV["interakt_APP_ID"] || "<%= @app_id %>"
|
5
5
|
|
6
|
-
# ==
|
7
|
-
# This is required for some
|
8
|
-
# you can generate one at https://www.
|
6
|
+
# == interakt API Key
|
7
|
+
# This is required for some interakt rake tasks like importing your users;
|
8
|
+
# you can generate one at https://www.interakt.co/.
|
9
9
|
#
|
10
10
|
<%- if @api_key -%>
|
11
11
|
config.api_key = "<%= @api_key %>"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interakt_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manoj
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ! '>'
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description: Import your users data into
|
55
|
+
description: Import your users data into interakt
|
56
56
|
email:
|
57
57
|
- manoj.delhi24@gmail.com
|
58
58
|
executables: []
|
@@ -65,16 +65,16 @@ files:
|
|
65
65
|
- LICENSE.txt
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
|
-
-
|
69
|
-
- lib/
|
70
|
-
- lib/
|
71
|
-
- lib/
|
72
|
-
- lib/
|
73
|
-
- lib/
|
74
|
-
- lib/
|
75
|
-
- lib/
|
76
|
-
- lib/rails/generators/
|
77
|
-
- lib/rails/generators/
|
68
|
+
- interakt_rails.gemspec
|
69
|
+
- lib/interakt_rails.rb
|
70
|
+
- lib/interakt_rails/import.rb
|
71
|
+
- lib/interakt_rails/interakt.rake
|
72
|
+
- lib/interakt_rails/railtie.rb
|
73
|
+
- lib/interakt_rails/setting.rb
|
74
|
+
- lib/interakt_rails/user_validator.rb
|
75
|
+
- lib/interakt_rails/version.rb
|
76
|
+
- lib/rails/generators/interakt/config/config_generator.rb
|
77
|
+
- lib/rails/generators/interakt/config/interakt.rb.erb
|
78
78
|
homepage: http://interakt.co/
|
79
79
|
licenses:
|
80
80
|
- MIT
|
data/lib/interakthq_rails.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Interakthq
|
2
|
-
module Generators
|
3
|
-
class ConfigGenerator < ::Rails::Generators::Base
|
4
|
-
|
5
|
-
def self.source_root
|
6
|
-
File.dirname(__FILE__)
|
7
|
-
end
|
8
|
-
|
9
|
-
argument :app_id, :desc => "Your Interakthq app-id, which can be found here: https://www.interakthq.com/api_keys"
|
10
|
-
argument :api_key, :desc => "An Interakthq API key, for various rake tasks", :optional => true
|
11
|
-
|
12
|
-
def create_initializer_file
|
13
|
-
@app_id = app_id
|
14
|
-
@api_key = api_key
|
15
|
-
|
16
|
-
template("interakthq.rb.erb", "config/initializers/interakthq.rb")
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|