Class: InstagramUpload::Agent
- Inherits:
-
Object
- Object
- InstagramUpload::Agent
- Defined in:
- lib/instagram_upload/agent.rb
Constant Summary collapse
- SECRET_KEY =
'b4a23f5e39b5929e0666ac5de94c89d1618a2916'.freeze
- CONTENT_TYPE =
'application/x-www-form-urlencoded; charset=UTF-8'
- RESOLUTION =
%w[720x1280 320x480 480x800 1024x768 1280x720 768x1024 480x320].freeze
- VERSION =
['GT-N7000', 'SM-N9000', 'GT-I9220', 'GT-I9100'].freeze
- DPI =
%w[120 160 320 240].freeze
Instance Attribute Summary collapse
-
#device_id ⇒ Object
readonly
Returns the value of attribute device_id.
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
- #body(data) ⇒ Object
-
#initialize ⇒ Agent
constructor
A new instance of Agent.
Constructor Details
#initialize ⇒ Agent
Returns a new instance of Agent.
11 12 13 14 15 |
# File 'lib/instagram_upload/agent.rb', line 11 def initialize @guid = SecureRandom.uuid @device_id = 'android-' + guid @user_agent = generate_user_agent end |
Instance Attribute Details
#device_id ⇒ Object (readonly)
Returns the value of attribute device_id.
9 10 11 |
# File 'lib/instagram_upload/agent.rb', line 9 def device_id @device_id end |
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
9 10 11 |
# File 'lib/instagram_upload/agent.rb', line 9 def guid @guid end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
9 10 11 |
# File 'lib/instagram_upload/agent.rb', line 9 def user_agent @user_agent end |
Instance Method Details
#body(data) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/instagram_upload/agent.rb', line 17 def body(data) body_data = data.merge( 'guid': guid, 'device_id': device_id, 'Content-Type': CONTENT_TYPE ).to_json.tr("'", '"') 'ig_sig_key_version=4&signed_body=' + signature(body_data) + '.' + URI.encode(body_data, /\W/) end |