如何从Parse.com指针对象获取信息

时间:2015-08-17 21:17:21

标签: ruby-on-rails ruby parse-platform

我创建了一个类:

if length == 3:
    for a in range(len(alphabet)):
        for b in range(a,len(alphabet)):
            for c in range(b,len(alphabet)):
                combos.append(alphabet[a] + alphabet[b] + alphabet[c])
elif length == 4:
    for a in range(len(alphabet)):
        for b in range(a,len(alphabet)):
            for c in range(b,len(alphabet)):
                for d in range(c,len(alphabet)):
                    combos.append(alphabet[a] + alphabet[b] + alphabet[c] + alphabet[d])

用它来从Parse.com API获取一些照片。我发送的用于获取用户照片一个月的消息是:

class MyClass
  ...
  def all_photos_this_month(m)
    #Set time interval to get photos - Get only photos of the month.
    month = m
    next_month = month + 1
    @get_month_photos = Parse::Query.new("Photo").tap do |q|
      q.greater_than("createdAt", Parse::Date.new("#{Time.now.year}-#{month}-01T00:00:00-03:00"))
      q.less_than("createdAt", Parse::Date.new("#{Time.now.year}-#{next_month}-01T00:00:00-03:00"))
    end.get
    return @get_month_photos
  end
  def get_user_photos_of_month(userid, month)     
    user_photos_this_month = all_photos_this_month(month).find_all {|user| user["user"]["objectId"] == userid }
    return user_photos_this_month
  end
end

但是我得到了:

.get_user_photos_of_month(userid, month)

这个错误来自哪里?

1 个答案:

答案 0 :(得分:0)

这部分错了:

 Public Class MyWork

    Public Structure thread_Data            
        Dim TCPIPAddr As String
        Dim TCPIPPort As Integer            
    End Structure

    Dim STthread_Data As thread_Data
    STthread_Data.TCPIPAddr = "192.168.2.2"
    STthread_Data.TCPIPPort = 80  

    Dim multiThread As Thread = New Thread(AddressOf testthread)
    multiThread.SetApartmentState(ApartmentState.MTA)
    multiThread.Start(STthread_Data)     

    Private Function testthread(ByVal STthread_Data As thread_Data) 
        Dim IPaddr as string = STthread_Data.TCPIPAddr
        Dim IPport as integer = STthread_Data.TCPIPPort
        'Your work'        
    End Function

End Class

它让我得到了上面显示的错误。

首先,我需要将指针转换为哈希值,然后让用户["用户"] [" objectId"]

像这样:

all_photos_this_month(month).find_all {|user| user["user"]["objectId"] == userid }