Module: JustShare
- Defined in:
- lib/just_share.rb,
lib/just_share/version.rb,
lib/generators/just_share/install_generator.rb
Overview
Module to have “global accessible vars to it gem scope”
Defined Under Namespace
Modules: Generators
Classes: Blogger, Delicious, Facebook, GooglePlus, LinkedIn, Pinterest, Reddit, SocialLinker, Tumblr, Twitter, Vk, Xing
Constant Summary
collapse
- MAJOR =
1
- MINOR =
0
- PATCH =
16
- VERSION =
"#{MAJOR}.#{MINOR}.#{PATCH}"
Class Method Summary
collapse
Class Method Details
.array_to_str_params(input_array) ⇒ Object
Convert it array to a simple String to be a GET HTTP param
49
50
51
52
53
54
55
|
# File 'lib/just_share.rb', line 49
def self.array_to_str_params input_array
input_array = input_array.split(',') if input_array.is_a?String
return_str = '' input_array.each { |item| return_str="#{return_str}#{item}," }
return_str = return_str.chomp(',') if return_str.last == ','
return_str end
|
100
101
102
|
# File 'lib/just_share.rb', line 100
def self.hash_tags
@hash_tags.nil? ? @hash_tags=[] : @hash_tags
end
|
74
75
76
77
78
|
# File 'lib/just_share.rb', line 74
def self.hash_tags=(hash_tags)
@hash_tags = hash_tags if hash_tags.is_a?Array
@hash_tags = [] if @hash_tags.nil?
@hash_tags.append(hash_tags) unless hash_tags.is_a?Array
end
|
.image_url ⇒ Object
96
97
98
|
# File 'lib/just_share.rb', line 96
def self.image_url
@image_url
end
|
.link ⇒ Object
84
85
86
|
# File 'lib/just_share.rb', line 84
def self.link
@link
end
|
.link=(link) ⇒ Object
62
63
64
|
# File 'lib/just_share.rb', line 62
def self.link=(link)
@link=link
end
|
.message ⇒ Object
92
93
94
|
# File 'lib/just_share.rb', line 92
def self.message
@message
end
|
.message=(message) ⇒ Object
70
71
72
|
# File 'lib/just_share.rb', line 70
def self.message=(message)
@message=message
end
|
.on(params = {}) ⇒ Object
Facade method to create the links
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/just_share.rb', line 24
def self.on(params={})
@via = params[:via] || JustShare.via
@link = params[:link] || JustShare.link
@message = params[:message] || JustShare.message
@hash_tags = params[:hash_tags] || JustShare.hash_tags
@image_url = params[:image_url] || JustShare.image_url
begin
social_network = "JustShare::#{params[:social].to_s.capitalize_humanized}".to_constant.new params
rescue Exception => e
if e.to_s.index('Linkedin').nil?
return ''
else
params[:social] = 'linked-in'
end
social_network = "JustShare::#{params[:social].to_s.capitalize_humanized}".to_constant.new params
end
social_network.get_post_link
end
|
.title ⇒ Object
88
89
90
|
# File 'lib/just_share.rb', line 88
def self.title
@title
end
|
.title=(title) ⇒ Object
66
67
68
|
# File 'lib/just_share.rb', line 66
def self.title=(title)
@title=title
end
|
.via ⇒ Object
80
81
82
|
# File 'lib/just_share.rb', line 80
def self.via
@via
end
|
.via=(via) ⇒ Object
Static methods to set the Attrs (it means not necessary those attrs in the ‘on’ method)
58
59
60
|
# File 'lib/just_share.rb', line 58
def self.via=(via)
@via=via
end
|