yatter 0.1.0 → 0.4.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 (6) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/yatter.rb +84 -18
  5. metadata +49 -45
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8e443e250647d9dd57bbc336b85b34d19f3e8c91
4
- data.tar.gz: dcc551ccb616ffb61269d97c9abd8528e9fd37b9
2
+ SHA256:
3
+ metadata.gz: 57e3a9dfe36060a15d8a63902c886d152a16cb8454305f9f9ad691c7ae70b686
4
+ data.tar.gz: 484bf93eb830312afd7d4400f51b5bc511c8770b532152a11ad9d2eae5e0805c
5
5
  SHA512:
6
- metadata.gz: 0bdd3a0d2f2e86c8bde5ea4f991a0f7af3eeb432a14774b095338f68a5fa234b9953883d039399f02d24e7329cb329354b8eceeb025f50fdff42582a2855a9c3
7
- data.tar.gz: e9aad6b6ed5090bfd5386cf53e3d7a57bd34c4c59fbbe2390a9fadf97eef7a3a8dca45f0ec643e67be4c3b5bd924069217c94707edc4e9d27ecb469dfc40356d
6
+ metadata.gz: 7645e391ae9cf2733c9186ae2530c14fe57aea92999dd151a1d702aa12a3c13ab64f11fb966bef94fed679b582bf6bb14438380e6ded9ed2b935c6388ccb00b9
7
+ data.tar.gz: 00d99424518a5f1c91c555745db1dc840ce512db7a6d8a68172347f9a07efa72d55aabdc1c9d52c4d27253dd56813122a86382753aa69357e2f5d05ecc512621
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/yatter.rb CHANGED
@@ -6,38 +6,104 @@
6
6
 
7
7
  require 'twitter'
8
8
  require 'dynarex-password'
9
- require 'dws-registry'
9
+ require 'remote_dwsregistry'
10
+
10
11
 
11
12
  class Yatter < Twitter::REST::Client
12
13
 
13
- def initialize(reg, user: nil, lookup_file: nil)
14
-
15
- if user.nil? or lookup_file.nil? then
16
- raise 'You must enter a user and lookup_file'
14
+ def self.fetch_credentials(regx, user)
15
+
16
+ reg = if regx.is_a? String then
17
+ RemoteDwsRegistry.new domain: regx
18
+ else
19
+ regx
17
20
  end
18
21
 
19
- @lookup_file = lookup_file
22
+ decipher = ->(lookup_file, s) {
23
+ DynarexPassword.new.reverse_lookup(s, lookup_file)
24
+ }
25
+
26
+ key = 'hkey_apps/microblog/twitter/'
27
+ e = reg.get_key(key + user)
28
+ lookup_file = e.text('lookup_file').to_s
29
+
30
+ consumer_key = e.text('ctoken').to_s
31
+ consumer_secret = decipher.call(lookup_file, e.text('csecret').to_s)
32
+ access_token = e.text('atoken').to_s
33
+ access_token_secret = decipher.call(lookup_file, e.text('asecret').to_s)
34
+
35
+ [consumer_key, consumer_secret, access_token, access_token_secret]
36
+
37
+ end
38
+
39
+ def initialize(reg, user: nil, debug: false)
40
+
41
+ raise 'You must enter a user' if user.nil?
42
+
43
+ @debug = debug
44
+
45
+ consumer_key, consumer_secret, access_token, access_token_secret = Yatter.fetch_credentials(reg, user)
46
+
47
+ if @debug then
48
+ puts [consumer_key, consumer_secret, access_token, access_token_secret]\
49
+ .inspect
50
+ end
20
51
 
21
- super() do |config|
52
+ super() do |config|
53
+
54
+ config.consumer_key = consumer_key
55
+ config.consumer_secret = consumer_secret
56
+ config.access_token = access_token
57
+ config.access_token_secret = access_token_secret
58
+
59
+ end
60
+
61
+ #if e.text('last_follower').to_s.empty? then
62
+ # reg.set_key(key + 'last_follower', last_follower)
63
+ #end
22
64
 
23
- e = reg.get_key('hkey_apps/microblog/twitter/' + user)
65
+ end
66
+
67
+ def followers()
68
+
69
+ @followers ||= super().take(10)
70
+
71
+ @followers.map do |x|
72
+
73
+ OpenStruct.new({
74
+ name: x.name,
75
+ username: x.screen_name,
76
+ profile: x.description,
77
+ followers: x.followers_count,
78
+ following: x.friends_count,
79
+ member_since: x.created_at,
80
+ website: x.website.to_s
81
+ }).freeze
24
82
 
25
- config.consumer_key = e.text('ctoken')
26
- config.consumer_secret = decipher(e.text('csecret'))
27
- config.access_token = e.text('atoken')
28
- config.access_token_secret = decipher(e.text('asecret'))
29
-
30
83
  end
84
+
85
+ end
86
+
87
+ def last_follower()
88
+
89
+ @followers ||= followers.take(10)
90
+ @followers[0][:username]
31
91
 
32
92
  end
33
93
 
94
+ def mentions()
95
+
96
+ @mentions ||= super()
97
+
98
+ @mentions.map do |x|
99
+ OpenStruct.new({date: x.created_at, user: x.user.screen_name,
100
+ text: x.text}).freeze
101
+ end
102
+
103
+ end
104
+
34
105
  def update(msg)
35
106
  super(msg)
36
107
  end
37
108
 
38
- private
39
-
40
- def decipher(s)
41
- DynarexPassword.new.reverse_lookup(s, @lookup_file)
42
- end
43
109
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,91 +10,95 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE1MDkxOTE4NTYwN1oXDTE2MDkxODE4NTYwN1owSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBAKxAF6OEQOiuursjjg9ZSqwrbNlK+0iO5FLIVU+JWs2+VWzqeqLlIgai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Jg/MbbDkWT2JHQ11B10
31
+ 8aZvVwn/TUUgyLeQFLkAe3OcfasnLl0C89WvsQvslL8/EXRANKSTarSjo9k9lWqh
32
+ VQjAiHNqRyEioKPzqG+rwCKppTEvDPbs4gj5MIVM+3AIhvbuj+pxJKxZjfDqgril
33
+ fTAanruy1KE+3ZyxWiT1Q49xGmtQtupW7IuS2vk0NeRCEsSVQM64at+OX9RgaIeD
34
+ NcEzDa9kEnURT2lq47v9/ZcCV0cCqnNR6qbUtmwDG4tT6lJMlGDAODYErYO4guI1
35
+ bF1sm62RpcufD2HTWYuYaH3HZcB8qO4J0/HmOMbk3yqinABLyOjk0Hp9PETgGpTb
36
+ 0oCGbPPlTLEh7UBynEn9cCqK
33
37
  -----END CERTIFICATE-----
34
- date: 2015-09-19 00:00:00.000000000 Z
38
+ date: 2021-05-10 00:00:00.000000000 Z
35
39
  dependencies:
36
40
  - !ruby/object:Gem::Dependency
37
41
  name: twitter
38
42
  requirement: !ruby/object:Gem::Requirement
39
43
  requirements:
40
- - - "~>"
41
- - !ruby/object:Gem::Version
42
- version: '5.15'
43
44
  - - ">="
44
45
  - !ruby/object:Gem::Version
45
- version: 5.15.0
46
+ version: 7.0.0
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '7.0'
46
50
  type: :runtime
47
51
  prerelease: false
48
52
  version_requirements: !ruby/object:Gem::Requirement
49
53
  requirements:
50
- - - "~>"
51
- - !ruby/object:Gem::Version
52
- version: '5.15'
53
54
  - - ">="
54
55
  - !ruby/object:Gem::Version
55
- version: 5.15.0
56
+ version: 7.0.0
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '7.0'
56
60
  - !ruby/object:Gem::Dependency
57
61
  name: dynarex-password
58
62
  requirement: !ruby/object:Gem::Requirement
59
63
  requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.1'
63
64
  - - ">="
64
65
  - !ruby/object:Gem::Version
65
- version: 0.1.11
66
+ version: 0.2.0
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.2'
66
70
  type: :runtime
67
71
  prerelease: false
68
72
  version_requirements: !ruby/object:Gem::Requirement
69
73
  requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '0.1'
73
74
  - - ">="
74
75
  - !ruby/object:Gem::Version
75
- version: 0.1.11
76
+ version: 0.2.0
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '0.2'
76
80
  - !ruby/object:Gem::Dependency
77
- name: dws-registry
81
+ name: remote_dwsregistry
78
82
  requirement: !ruby/object:Gem::Requirement
79
83
  requirements:
80
84
  - - "~>"
81
85
  - !ruby/object:Gem::Version
82
- version: '0.3'
86
+ version: '0.4'
83
87
  - - ">="
84
88
  - !ruby/object:Gem::Version
85
- version: 0.3.3
89
+ version: 0.4.1
86
90
  type: :runtime
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
93
  requirements:
90
94
  - - "~>"
91
95
  - !ruby/object:Gem::Version
92
- version: '0.3'
96
+ version: '0.4'
93
97
  - - ">="
94
98
  - !ruby/object:Gem::Version
95
- version: 0.3.3
99
+ version: 0.4.1
96
100
  description:
97
- email: james@r0bertson.co.uk
101
+ email: james@jamesrobertson.eu
98
102
  executables: []
99
103
  extensions: []
100
104
  extra_rdoc_files: []
@@ -120,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
124
  version: '0'
121
125
  requirements: []
122
126
  rubyforge_project:
123
- rubygems_version: 2.4.8
127
+ rubygems_version: 2.7.10
124
128
  signing_key:
125
129
  specification_version: 4
126
130
  summary: Yet another Twitter wrapper
metadata.gz.sig CHANGED
Binary file