Class: ProoflinkConnect::Share
- Inherits:
-
Object
- Object
- ProoflinkConnect::Share
- Defined in:
- lib/prooflink_connect/share.rb
Class Method Summary collapse
- .embedded(options = {}, config = ProoflinkConnect.config) ⇒ Object
- .post(transaction, message, position = nil) ⇒ Object
Class Method Details
.embedded(options = {}, config = ProoflinkConnect.config) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/prooflink_connect/share.rb', line 14 def self.( = {}, config = ProoflinkConnect.config) = { :width => "400px", :height => "355px", :locale => config.locale }.merge() src = "#{config.base_uri}/#{[:locale]}/shares/embedded/new?message=#{CGI.escape([:message])}" src << "&position=#{CGI.escape([:position])}" if [:position] styling = "width: #{[:width]}; height: #{[:height]};" styling << " border: 0; display: block;" = "frameborder='0' allowTransparency='true'" html = "<iframe src='#{src}' style='#{styling}' #{}></iframe>" html.respond_to?(:html_safe) ? html.html_safe : html end |
.post(transaction, message, position = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/prooflink_connect/share.rb', line 5 def self.post(transaction, , position = nil) uri = ProoflinkConnect.config.base_uri + "/shares/post_share_transaction" api_key = ProoflinkConnect.config.api_key params = {"api_key" => api_key, "transaction" => transaction, "message" => , "format" => "json"} params["position"] = position if position response = HTTParty.post(uri, :body => params) end |