insta 0.2.9 → 0.3.0

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.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/Rakefile +30 -3
  4. data/exe/insta +6 -0
  5. data/lib/insta/ansi.rb +30 -0
  6. data/lib/insta/ci.rb +21 -0
  7. data/lib/insta/cli.rb +714 -0
  8. data/lib/insta/config_manifest.rb +56 -0
  9. data/lib/insta/configuration.rb +86 -2
  10. data/lib/insta/diff.rb +134 -0
  11. data/lib/insta/inline/call_finder.rb +37 -0
  12. data/lib/insta/inline/edit.rb +21 -0
  13. data/lib/insta/inline/file_patcher.rb +269 -0
  14. data/lib/insta/inline/pending_registry.rb +57 -0
  15. data/lib/insta/inline/pending_store.rb +145 -0
  16. data/lib/insta/minitest/assertions.rb +254 -0
  17. data/lib/insta/minitest/lifecycle.rb +12 -0
  18. data/lib/insta/minitest.rb +8 -0
  19. data/lib/insta/pending_locations.rb +64 -0
  20. data/lib/insta/pending_reporter.rb +47 -0
  21. data/lib/insta/redaction/applicator.rb +89 -0
  22. data/lib/insta/redaction/selector.rb +193 -0
  23. data/lib/insta/rspec/hooks.rb +18 -0
  24. data/lib/insta/rspec/matchers.rb +248 -0
  25. data/lib/insta/rspec.rb +7 -0
  26. data/lib/insta/serializers/base.rb +31 -0
  27. data/lib/insta/serializers/inspect.rb +14 -0
  28. data/lib/insta/serializers/json.rb +16 -0
  29. data/lib/insta/serializers/string.rb +14 -0
  30. data/lib/insta/serializers/yaml.rb +16 -0
  31. data/lib/insta/snapshot.rb +74 -0
  32. data/lib/insta/snapshot_content.rb +44 -0
  33. data/lib/insta/snapshot_file.rb +64 -0
  34. data/lib/insta/snapshot_mismatch_handler.rb +34 -0
  35. data/lib/insta/snapshot_name.rb +51 -0
  36. data/lib/insta/syntax_highlight.rb +20 -0
  37. data/lib/insta/update_coordinator.rb +22 -0
  38. data/lib/insta/version.rb +3 -1
  39. data/lib/insta.rb +42 -8
  40. data/lib/minitest/insta_plugin.rb +17 -0
  41. data/sig/insta/ansi.rbs +28 -0
  42. data/sig/insta/ci.rbs +10 -0
  43. data/sig/insta/cli.rbs +150 -0
  44. data/sig/insta/config_manifest.rbs +27 -0
  45. data/sig/insta/configuration.rbs +48 -0
  46. data/sig/insta/diff.rbs +38 -0
  47. data/sig/insta/inline/call_finder.rbs +22 -0
  48. data/sig/insta/inline/edit.rbs +18 -0
  49. data/sig/insta/inline/file_patcher.rbs +55 -0
  50. data/sig/insta/inline/pending_registry.rbs +22 -0
  51. data/sig/insta/inline/pending_store.rbs +41 -0
  52. data/sig/insta/minitest/assertions.rbs +52 -0
  53. data/sig/insta/minitest/lifecycle.rbs +10 -0
  54. data/sig/insta/minitest.rbs +2 -0
  55. data/sig/insta/pending_locations.rbs +22 -0
  56. data/sig/insta/pending_reporter.rbs +14 -0
  57. data/sig/insta/redaction/applicator.rbs +22 -0
  58. data/sig/insta/redaction/selector.rbs +58 -0
  59. data/sig/insta/rspec/hooks.rbs +10 -0
  60. data/sig/insta/rspec/matchers.rbs +71 -0
  61. data/sig/insta/rspec.rbs +2 -0
  62. data/sig/insta/serializers/base.rbs +21 -0
  63. data/sig/insta/serializers/inspect.rbs +10 -0
  64. data/sig/insta/serializers/json.rbs +10 -0
  65. data/sig/insta/serializers/string.rbs +10 -0
  66. data/sig/insta/serializers/yaml.rbs +10 -0
  67. data/sig/insta/snapshot.rbs +37 -0
  68. data/sig/insta/snapshot_content.rbs +14 -0
  69. data/sig/insta/snapshot_file.rbs +27 -0
  70. data/sig/insta/snapshot_mismatch_handler.rbs +12 -0
  71. data/sig/insta/snapshot_name.rbs +17 -0
  72. data/sig/insta/syntax_highlight.rbs +8 -0
  73. data/sig/insta/update_coordinator.rbs +11 -0
  74. data/sig/insta/version.rbs +5 -0
  75. data/sig/insta.rbs +12 -0
  76. data/sig/minitest/insta_plugin.rbs +6 -0
  77. data/sig/vendor/difftastic.rbs +19 -0
  78. data/sig/vendor/irb.rbs +5 -0
  79. data/sig/vendor/psych.rbs +7 -0
  80. data/sig/vendor/rspec.rbs +9 -0
  81. data/sig/vendor/rubygems.rbs +3 -0
  82. metadata +109 -54
  83. data/.DS_Store +0 -0
  84. data/.gitignore +0 -11
  85. data/.rspec +0 -3
  86. data/.travis.yml +0 -5
  87. data/CODE_OF_CONDUCT.md +0 -74
  88. data/Gemfile +0 -6
  89. data/Gemfile.lock +0 -35
  90. data/README.md +0 -41
  91. data/bin/console +0 -14
  92. data/bin/setup +0 -8
  93. data/insta.gemspec +0 -36
  94. data/lib/.DS_Store +0 -0
  95. data/lib/insta/account.rb +0 -127
  96. data/lib/insta/api.rb +0 -88
  97. data/lib/insta/constants.rb +0 -21
  98. data/lib/insta/device.rb +0 -11852
  99. data/lib/insta/feed.rb +0 -89
  100. data/lib/insta/location.rb +0 -18
  101. data/lib/insta/proxy_manager.rb +0 -23
  102. data/lib/insta/tag.rb +0 -18
  103. data/lib/insta/user.rb +0 -103
metadata CHANGED
@@ -1,97 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: insta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Renan Garcia
8
- autorequire:
7
+ - Marco Roth
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2018-02-26 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: bundler
13
+ name: difftastic
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - "~>"
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '1.16'
20
- type: :development
18
+ version: '0.2'
19
+ type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - "~>"
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '1.16'
25
+ version: '0.2'
27
26
  - !ruby/object:Gem::Dependency
28
- name: rake
27
+ name: irb
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
32
+ version: '1.0'
33
+ type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '10.0'
39
+ version: '1.0'
41
40
  - !ruby/object:Gem::Dependency
42
- name: rspec
41
+ name: prism
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - "~>"
44
+ - - ">="
46
45
  - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
46
+ version: '1.0'
47
+ type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
- - - "~>"
51
+ - - ">="
53
52
  - !ruby/object:Gem::Version
54
- version: '3.0'
55
- description: Welcome to Insta(pre-alpha) gem! This Gem is hard fork from vicoerv/instagram-private-api
56
- and the implement from huttarichard/instagram-private-api
53
+ version: '1.0'
54
+ description: 'Snapshot testing for Ruby with inline snapshots, difftastic diffs, and
55
+ interactive review. Supports Minitest and RSpec."
56
+
57
+ '
57
58
  email:
58
- - email@renangarcia.me
59
- executables: []
59
+ - marco.roth@intergga.ch
60
+ executables:
61
+ - insta
60
62
  extensions: []
61
63
  extra_rdoc_files: []
62
64
  files:
63
- - ".DS_Store"
64
- - ".gitignore"
65
- - ".rspec"
66
- - ".travis.yml"
67
- - CODE_OF_CONDUCT.md
68
- - Gemfile
69
- - Gemfile.lock
70
65
  - LICENSE.txt
71
- - README.md
72
66
  - Rakefile
73
- - bin/console
74
- - bin/setup
75
- - insta.gemspec
76
- - lib/.DS_Store
67
+ - exe/insta
77
68
  - lib/insta.rb
78
- - lib/insta/account.rb
79
- - lib/insta/api.rb
69
+ - lib/insta/ansi.rb
70
+ - lib/insta/ci.rb
71
+ - lib/insta/cli.rb
72
+ - lib/insta/config_manifest.rb
80
73
  - lib/insta/configuration.rb
81
- - lib/insta/constants.rb
82
- - lib/insta/device.rb
83
- - lib/insta/feed.rb
84
- - lib/insta/location.rb
85
- - lib/insta/proxy_manager.rb
86
- - lib/insta/tag.rb
87
- - lib/insta/user.rb
74
+ - lib/insta/diff.rb
75
+ - lib/insta/inline/call_finder.rb
76
+ - lib/insta/inline/edit.rb
77
+ - lib/insta/inline/file_patcher.rb
78
+ - lib/insta/inline/pending_registry.rb
79
+ - lib/insta/inline/pending_store.rb
80
+ - lib/insta/minitest.rb
81
+ - lib/insta/minitest/assertions.rb
82
+ - lib/insta/minitest/lifecycle.rb
83
+ - lib/insta/pending_locations.rb
84
+ - lib/insta/pending_reporter.rb
85
+ - lib/insta/redaction/applicator.rb
86
+ - lib/insta/redaction/selector.rb
87
+ - lib/insta/rspec.rb
88
+ - lib/insta/rspec/hooks.rb
89
+ - lib/insta/rspec/matchers.rb
90
+ - lib/insta/serializers/base.rb
91
+ - lib/insta/serializers/inspect.rb
92
+ - lib/insta/serializers/json.rb
93
+ - lib/insta/serializers/string.rb
94
+ - lib/insta/serializers/yaml.rb
95
+ - lib/insta/snapshot.rb
96
+ - lib/insta/snapshot_content.rb
97
+ - lib/insta/snapshot_file.rb
98
+ - lib/insta/snapshot_mismatch_handler.rb
99
+ - lib/insta/snapshot_name.rb
100
+ - lib/insta/syntax_highlight.rb
101
+ - lib/insta/update_coordinator.rb
88
102
  - lib/insta/version.rb
89
- homepage: https://github.com/renan-garcia/insta
103
+ - lib/minitest/insta_plugin.rb
104
+ - sig/insta.rbs
105
+ - sig/insta/ansi.rbs
106
+ - sig/insta/ci.rbs
107
+ - sig/insta/cli.rbs
108
+ - sig/insta/config_manifest.rbs
109
+ - sig/insta/configuration.rbs
110
+ - sig/insta/diff.rbs
111
+ - sig/insta/inline/call_finder.rbs
112
+ - sig/insta/inline/edit.rbs
113
+ - sig/insta/inline/file_patcher.rbs
114
+ - sig/insta/inline/pending_registry.rbs
115
+ - sig/insta/inline/pending_store.rbs
116
+ - sig/insta/minitest.rbs
117
+ - sig/insta/minitest/assertions.rbs
118
+ - sig/insta/minitest/lifecycle.rbs
119
+ - sig/insta/pending_locations.rbs
120
+ - sig/insta/pending_reporter.rbs
121
+ - sig/insta/redaction/applicator.rbs
122
+ - sig/insta/redaction/selector.rbs
123
+ - sig/insta/rspec.rbs
124
+ - sig/insta/rspec/hooks.rbs
125
+ - sig/insta/rspec/matchers.rbs
126
+ - sig/insta/serializers/base.rbs
127
+ - sig/insta/serializers/inspect.rbs
128
+ - sig/insta/serializers/json.rbs
129
+ - sig/insta/serializers/string.rbs
130
+ - sig/insta/serializers/yaml.rbs
131
+ - sig/insta/snapshot.rbs
132
+ - sig/insta/snapshot_content.rbs
133
+ - sig/insta/snapshot_file.rbs
134
+ - sig/insta/snapshot_mismatch_handler.rbs
135
+ - sig/insta/snapshot_name.rbs
136
+ - sig/insta/syntax_highlight.rbs
137
+ - sig/insta/update_coordinator.rbs
138
+ - sig/insta/version.rbs
139
+ - sig/minitest/insta_plugin.rbs
140
+ - sig/vendor/difftastic.rbs
141
+ - sig/vendor/irb.rbs
142
+ - sig/vendor/psych.rbs
143
+ - sig/vendor/rspec.rbs
144
+ - sig/vendor/rubygems.rbs
145
+ homepage: https://github.com/marcoroth/insta
90
146
  licenses:
91
147
  - MIT
92
148
  metadata:
93
- allowed_push_host: https://rubygems.org
94
- post_install_message:
149
+ homepage_uri: https://github.com/marcoroth/insta
150
+ source_code_uri: https://github.com/marcoroth/insta
151
+ changelog_uri: https://github.com/marcoroth/insta/releases
152
+ rubygems_mfa_required: 'true'
95
153
  rdoc_options: []
96
154
  require_paths:
97
155
  - lib
@@ -99,17 +157,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
157
  requirements:
100
158
  - - ">="
101
159
  - !ruby/object:Gem::Version
102
- version: '0'
160
+ version: 3.2.0
103
161
  required_rubygems_version: !ruby/object:Gem::Requirement
104
162
  requirements:
105
163
  - - ">="
106
164
  - !ruby/object:Gem::Version
107
165
  version: '0'
108
166
  requirements: []
109
- rubyforge_project:
110
- rubygems_version: 2.7.3
111
- signing_key:
167
+ rubygems_version: 4.0.10
112
168
  specification_version: 4
113
- summary: Welcome to Insta(pre-alpha) gem! This Gem is hard fork from vicoerv/instagram-private-api
114
- and the implement from huttarichard/instagram-private-api
169
+ summary: Snapshot testing for Ruby
115
170
  test_files: []
data/.DS_Store DELETED
Binary file
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at email@renangarcia.me. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in insta.gemspec
6
- gemspec
data/Gemfile.lock DELETED
@@ -1,35 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- insta (0.2.9)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- diff-lcs (1.3)
10
- rake (10.5.0)
11
- rspec (3.7.0)
12
- rspec-core (~> 3.7.0)
13
- rspec-expectations (~> 3.7.0)
14
- rspec-mocks (~> 3.7.0)
15
- rspec-core (3.7.1)
16
- rspec-support (~> 3.7.0)
17
- rspec-expectations (3.7.0)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.7.0)
20
- rspec-mocks (3.7.0)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.7.0)
23
- rspec-support (3.7.1)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- bundler (~> 1.16)
30
- insta!
31
- rake (~> 10.0)
32
- rspec (~> 3.0)
33
-
34
- BUNDLED WITH
35
- 1.16.1
data/README.md DELETED
@@ -1,41 +0,0 @@
1
- # Insta (Pre-Alpha)
2
-
3
- Welcome to Insta gem! This Gem is hard fork from [VicoErv/instagram-private-api](https://github.com/VicoErv/instagram-private-api) and the implement from [huttarichard/instagram-private-api](https://github.com/huttarichard/instagram-private-api) the best `Node-JS` Insgtagram private API
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'insta'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install insta
20
-
21
- ## Usage
22
-
23
- TODO: Write usage instructions here
24
-
25
- ## Development
26
-
27
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
-
29
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
-
31
- ## Contributing
32
-
33
- Bug reports and pull requests are welcome on GitHub at https://github.com/renan-garcia/insta. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
-
35
- ## License
36
-
37
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
38
-
39
- ## Code of Conduct
40
-
41
- Everyone interacting in the Insta project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/renan-garcia/insta/blob/master/CODE_OF_CONDUCT.md).
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "insta"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/insta.gemspec DELETED
@@ -1,36 +0,0 @@
1
-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'insta/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'insta'
8
- spec.version = Insta::VERSION
9
- spec.authors = ['Renan Garcia']
10
- spec.email = ['email@renangarcia.me']
11
-
12
- spec.summary = 'Welcome to Insta(pre-alpha) gem! This Gem is hard fork from vicoerv/instagram-private-api and the implement from huttarichard/instagram-private-api'
13
- spec.description = spec.summary
14
- spec.homepage = 'https://github.com/renan-garcia/insta'
15
- spec.license = 'MIT'
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
- else
22
- raise 'RubyGems 2.0 or newer is required to protect against ' \
23
- 'public gem pushes.'
24
- end
25
-
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
- f.match(%r{^(test|spec|features)/})
28
- end
29
- spec.bindir = 'exe'
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ['lib']
32
-
33
- spec.add_development_dependency 'bundler', '~> 1.16'
34
- spec.add_development_dependency 'rake', '~> 10.0'
35
- spec.add_development_dependency 'rspec', '~> 3.0'
36
- end
data/lib/.DS_Store DELETED
Binary file
data/lib/insta/account.rb DELETED
@@ -1,127 +0,0 @@
1
- module Insta
2
- module Account
3
- def self.login(user, config = Insta::Configuration.new)
4
- request = Insta::API.http(
5
- url: CONSTANTS::URL + 'accounts/login/',
6
- method: 'POST',
7
- user: user,
8
- body: format(
9
- 'ig_sig_key_version=4&signed_body=%s',
10
- Insta::API.generate_signature(
11
- device_id: user.device_id,
12
- login_attempt_user: 0, password: user.password, username: user.username,
13
- _csrftoken: 'missing', _uuid: Insta::API.generate_uuid
14
- ))
15
- )
16
- json_body = JSON.parse request.body
17
- logged_in_user = json_body['logged_in_user']
18
- user.data = {
19
- id: logged_in_user['pk'],
20
- full_name: logged_in_user['full_name'],
21
- is_private: logged_in_user['is_private'],
22
- profile_pic_url: logged_in_user['profile_pic_url'],
23
- profile_pic_id: logged_in_user['profile_pic_id'],
24
- is_verified: logged_in_user['is_verified'],
25
- is_business: logged_in_user['is_business']
26
- }
27
- cookies_array = []
28
- all_cookies = request.get_fields('set-cookie')
29
- all_cookies.each do |cookie|
30
- cookies_array.push(cookie.split('; ')[0])
31
- end
32
- cookies = cookies_array.join('; ')
33
- user.config = config
34
- user.session = cookies
35
- end
36
-
37
- def self.search_for_user_graphql(user, username, data)
38
- endpoint = "https://www.instagram.com/#{username}/?__a=1"
39
- proxies = Insta::ProxyManager.new data[:proxies] unless data[:proxies].nil?
40
- result = Insta::API.http(
41
- url: endpoint,
42
- method: 'GET',
43
- user: user,
44
- proxy: proxies&.next
45
- )
46
- response = JSON.parse result.body, symbolize_names: true
47
- return nil unless response[:user].any?
48
- {
49
- profile_id: response[:user][:id],
50
- external_url: response[:user][:external_url],
51
- followers: response[:user][:followed_by][:count],
52
- following: response[:user][:follows][:count],
53
- full_name: response[:user][:full_name],
54
- avatar_url: response[:user][:profile_pic_url],
55
- avatar_url_hd: response[:user][:profile_pic_url_hd],
56
- username: response[:user][:username],
57
- biography: response[:user][:biography],
58
- verified: response[:user][:is_verified],
59
- medias_count: response[:user][:media][:count],
60
- is_private: response[:user][:is_private]
61
- }
62
- end
63
-
64
- def self.by_id(user, profile_id, data)
65
- rank_token = Insta::API.generate_rank_token user.session.scan(/ds_user_id=([\d]+);/)[0][0]
66
- endpoint = "https://i.instagram.com/api/v1/users/#{profile_id}/info/"
67
- proxies = Insta::ProxyManager.new data[:proxies] unless data[:proxies].nil?
68
- param = format('?is_typehead=true&rank_token=%s', rank_token)
69
- result = Insta::API.http(
70
- url: endpoint + param,
71
- method: 'GET',
72
- user: user,
73
- proxy: proxies&.next
74
- )
75
-
76
- response = JSON.parse result.body, symbolize_names: true
77
-
78
- return nil unless response[:user].any?
79
- {
80
- profile_id: response[:user][:id],
81
- external_url: response[:user][:external_url],
82
- followers: response[:user][:follower_count],
83
- following: response[:user][:following_count],
84
- full_name: response[:user][:full_name],
85
- avatar_url: response[:user][:hd_profile_pic_url_info][:url],
86
- avatar_url_hd: response[:user][:hd_profile_pic_url_info][:url],
87
- username: response[:user][:username],
88
- biography: response[:user][:biography],
89
- verified: response[:user][:is_verified],
90
- medias_count: response[:user][:media_count],
91
- is_private: response[:user][:is_private],
92
- phone: response[:user][:contact_phone_number],
93
- email: response[:user][:public_email]
94
- }
95
- end
96
-
97
- def self.search_for_user(user, username, data)
98
- rank_token = Insta::API.generate_rank_token user.session.scan(/ds_user_id=([\d]+);/)[0][0]
99
- endpoint = 'https://i.instagram.com/api/v1/users/search/'
100
- proxies = Insta::ProxyManager.new data[:proxies] unless data[:proxies].nil?
101
- param = format('?is_typehead=true&q=%s&rank_token=%s', username, rank_token)
102
- result = Insta::API.http(
103
- url: endpoint + param,
104
- method: 'GET',
105
- user: user,
106
- proxy: proxies&.next
107
- )
108
-
109
- json_result = JSON.parse result.body
110
- if json_result['num_results'] > 0
111
- user_result = json_result['users'][0]
112
- user_object = Insta::User.new username, nil
113
- user_object.data = {
114
- id: user_result['pk'],
115
- full_name: user_result['full_name'],
116
- is_private: user_result['is_prive'],
117
- profile_pic_url: user_result['profile_pic_url'],
118
- profile_pic_id: user_result['profile_pic_id'],
119
- is_verified: user_result['is_verified'],
120
- is_business: user_result['is_business']
121
- }
122
- user_object.session = user.session
123
- user_object
124
- end
125
- end
126
- end
127
- end